It is currently 23 Apr 2024, 09:14
   
Text Size

[fix/close]Card Picker can't search Biomass Mutation as blue

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

Re: Rep: Biomass Mutation

Postby drool66 » 01 Oct 2021, 18:13

Hybrid card implementation is that they are searchable by one cost only, in this case green.
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [implementation] Rep: Biomass Mutation

Postby Korath » 01 Oct 2021, 21:17

It's really not hybrid cards' fault, per se - choose_a_card() was never properly updated for multicolor cards at all. I'll look into backporting the Shandalar version.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed] Rep: Biomass Mutation

Postby drool66 » 03 Oct 2021, 06:08

Thank you Korath, the new picker is awesome
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [confirmed] Rep: Biomass Mutation

Postby Aswan jaguar » 04 Oct 2021, 13:39

Korath has backported shandalar's choose_a_card() in commits 69063ab and 51b6a31 and fixed this and other issues and now it has more options. =D>
Korath one little request, if it suits also others and doesn't cause other issues that escape me. Something that was very convenient for me previously was that when you debugged a card in hand or/and in play the choice remained to that type and color you have chosen last if you reopened it. Which was very convenient to put more than 1 of the same card or the same type or the same color without having to change preferences and make extra clicks something very useful and fast while testing cards.
If it was one of the first 10 or so cards that you see when it first opens, if you didn't move the mouse you could very fast debug many same cards very useful especially for lands. 8)
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times

Re: [fixed] Rep: Biomass Mutation

Postby Korath » 04 Oct 2021, 14:56

Sure, I can do that. It hadn't occurred to me since I usually get to the card I want by typing, not mousing.

How long should the choices persist? Between program runs, between games, or just the current game? Debug menu cardpicker only, or whenever it appears?
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [fixed] Rep: Biomass Mutation

Postby Aswan jaguar » 04 Oct 2021, 15:05

I am pretty fine with current game and for Debug menu cardpicker only.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times

Re: [fixed] Rep: Biomass Mutation

Postby Korath » 04 Oct 2021, 17:24

2599b75b3.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby Aswan jaguar » 09 Oct 2021, 09:17

The debugger picker can't search for Swamp. I didn't test the rest.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby Korath » 09 Oct 2021, 13:15

Not my fault; something you guys do overwrites it with On an Adventure.

Swamp is iid 0, gdb outputs:
Code: Select all
(gdb) p cards_data[0]
$1 = {secret = 0 '\000', name = "On an Adventure\000\000", reserved1 = '\000' <repeats 16 times>, id = 239,
  reserved2 = 0, type = 1 '\001', subtype = 13 '\r', color = 2 '\002', cc = "\000\000", power = 0, toughness = 0,
  new_field = 0 '\000', reserved3 = 0 '\000', code_pointer = 0x200352c <CodeSectionEx+9510>, static_ability = 0,
  extra_ability = 4096, rarity = 1 '\001', act_phases = 1 '\001', expansion = 2 '\002', unused = 0 '\000',
  creature_rating = 0}
(The rest of that is Swamp's data; code_pointer matches, and 239 is CARD_ID_SWAMP, which is definitive.)

Not a data issue; Shandalar sees it ok:
Code: Select all
(gdb) p raw_cards_data[0]
$1 = {secret = 0 '\000', name = "Swamp", '\000' <repeats 12 times>, reserved1 = '\000' <repeats 16 times>, id = 239,
  reserved2 = 0, type = 1, color = 2 '\002', cc = "\000\000", power = 0, toughness = 0, new_field = 0 '\000',
  reserved3 = 0 '\000', code_pointer = 0x53e97550 <Card_card_mana_producer1::self(int, int, event_t)>,
  static_ability = 0, extra_ability = 4096, rarity = 1 '\001', act_phases = 1 '\001', expansion = 1 '\001',
  unused = 0 '\000', creature_rating = 0}
And it's not data Shandalar fixes at runtime; it's still "Swamp" in the data written in Magic.exe:
Code: Select all
.../pristine/master$ hexdump -C -s 1024000 -n 1200 Magic.exe
000fa000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
000fa010  00 53 77 61 6d 70 00 00  00 00 00 00 00 00 00 00  |.Swamp..........|
000fa020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa030  00 00 00 00 ef 00 00 00  01 0d 02 00 00 00 00 00  |................|
000fa040  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa050  00 01 00 00 00 00 00 00  00 49 73 6c 61 6e 64 00  |.........Island.|
000fa060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa070  00 00 00 00 00 00 00 00  00 00 00 00 7e 00 00 00  |............~...|
000fa080  01 0d 04 00 00 00 00 00  00 00 00 00 2c 35 00 02  |............,5..|
000fa090  00 00 00 00 00 10 00 00  00 01 00 00 00 00 00 00  |................|
000fa0a0  00 46 6f 72 65 73 74 00  00 00 00 00 00 00 00 00  |.Forest.........|
000fa0b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa0c0  00 00 00 00 5b 00 00 00  01 0d 08 00 00 00 00 00  |....[...........|
000fa0d0  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa0e0  00 01 00 00 00 00 00 00  00 4d 6f 75 6e 74 61 69  |.........Mountai|
000fa0f0  6e 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |n...............|
000fa100  00 00 00 00 00 00 00 00  00 00 00 00 a4 00 00 00  |................|
000fa110  01 0d 10 00 00 00 00 00  00 00 00 00 2c 35 00 02  |............,5..|
000fa120  00 00 00 00 00 10 00 00  00 01 00 00 00 00 00 00  |................|
000fa130  00 50 6c 61 69 6e 73 00  00 00 00 00 00 00 00 00  |.Plains.........|
000fa140  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa150  00 00 00 00 bc 00 00 00  01 0d 20 00 00 00 00 00  |.......... .....|
000fa160  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa170  00 01 00 00 00 00 00 00  00 42 61 64 6c 61 6e 64  |.........Badland|
000fa180  73 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |s...............|
000fa190  00 00 00 00 00 00 00 00  00 00 00 00 09 00 00 00  |................|
000fa1a0  01 0c 12 00 00 00 00 00  00 00 00 00 2c 35 00 02  |............,5..|
000fa1b0  00 00 00 00 00 10 00 00  00 01 00 00 02 00 00 00  |................|
000fa1c0  00 42 61 79 6f 75 00 00  00 00 00 00 00 00 00 00  |.Bayou..........|
000fa1d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa1e0  00 00 00 00 0c 00 00 00  01 0c 0a 00 00 00 00 00  |................|
000fa1f0  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa200  00 01 00 00 02 00 00 00  00 50 6c 61 74 65 61 75  |.........Plateau|
000fa210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa220  00 00 00 00 00 00 00 00  00 00 00 00 bd 00 00 00  |................|
000fa230  01 0c 30 00 00 00 00 00  00 00 00 00 2c 35 00 02  |..0.........,5..|
000fa240  00 00 00 00 00 10 00 00  00 01 00 00 02 00 00 00  |................|
000fa250  00 53 61 76 61 6e 6e 61  68 00 00 00 00 00 00 00  |.Savannah.......|
000fa260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa270  00 00 00 00 d4 00 00 00  01 0c 28 00 00 00 00 00  |..........(.....|
000fa280  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa290  00 01 00 00 02 00 00 00  00 53 63 72 75 62 6c 61  |.........Scrubla|
000fa2a0  6e 64 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |nd..............|
000fa2b0  00 00 00 00 00 00 00 00  00 00 00 00 d8 00 00 00  |................|
000fa2c0  01 0c 22 00 00 00 00 00  00 00 00 00 2c 35 00 02  |..".........,5..|
000fa2d0  00 00 00 00 00 10 00 00  00 01 00 00 02 00 00 00  |................|
000fa2e0  00 54 61 69 67 61 00 00  00 00 00 00 00 00 00 00  |.Taiga..........|
000fa2f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa300  00 00 00 00 f1 00 00 00  01 0c 18 00 00 00 00 00  |................|
000fa310  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa320  00 01 00 00 02 00 00 00  00 54 72 6f 70 69 63 61  |.........Tropica|
000fa330  6c 20 49 73 6c 61 6e 64  00 00 00 00 00 00 00 00  |l Island........|
000fa340  00 00 00 00 00 00 00 00  00 00 00 00 fc 00 00 00  |................|
000fa350  01 0c 0c 00 00 00 00 00  00 00 00 00 2c 35 00 02  |............,5..|
000fa360  00 00 00 00 00 10 00 00  00 01 00 00 02 00 00 00  |................|
000fa370  00 54 75 6e 64 72 61 00  00 00 00 00 00 00 00 00  |.Tundra.........|
000fa380  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa390  00 00 00 00 fe 00 00 00  01 0c 24 00 00 00 00 00  |..........$.....|
000fa3a0  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa3b0  00 01 00 00 02 00 00 00  00 55 6e 64 65 72 67 72  |.........Undergr|
000fa3c0  6f 75 6e 64 20 53 65 61  00 00 00 00 00 00 00 00  |ound Sea........|
000fa3d0  00 00 00 00 00 00 00 00  00 00 00 00 02 01 00 00  |................|
000fa3e0  01 0c 06 00 00 00 00 00  00 00 00 00 2c 35 00 02  |............,5..|
000fa3f0  00 00 00 00 00 10 00 00  00 01 00 00 02 00 00 00  |................|
000fa400  00 56 6f 6c 63 61 6e 69  63 20 49 73 6c 61 6e 64  |.Volcanic Island|
000fa410  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa420  00 00 00 00 0a 01 00 00  01 0c 14 00 00 00 00 00  |................|
000fa430  00 00 00 00 2c 35 00 02  00 00 00 00 00 10 00 00  |....,5..........|
000fa440  00 01 00 00 02 00 00 00  00 2a 20 41 72 63 68 65  |.........* Arche|
000fa450  6e 65 6d 79 00 00 00 00  00 00 00 00 00 00 00 00  |nemy............|
000fa460  00 00 00 00 00 00 00 00  00 00 00 00 51 39 00 00  |............Q9..|
000fa470  80 ff 00 00 63 03 00 00  00 00 00 00 52 3c 00 02  |....c.......R<..|
000fa480  00 00 00 00 01 00 00 40  00 01 00 00 00 00 00 00  |.......@........|
000fa490  00 2a 20 44 72 61 66 74  00 00 00 00 00 00 00 00  |.* Draft........|
000fa4a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000fa4b0
I can put a hack in dlgproc_choose_a_card_helper() to use "Swamp" instead of what cards_data[] says for iid 0 (which would break internationalization, if anyone's still crazy enough to try that), or pull it from the string in cards_ptr[] which is apparently unbroken. But whatever it is that's overwriting it is plainly wrong, could cause other problems down the line, and should be tracked down and fixed in its own right.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby drool66 » 11 Oct 2021, 16:52

I failed to add an entry in ct_all for On an Adventure. Adding one returns a proper iid for On an Adventure through the ingame dialog sic:
Code: Select all
char buffer[100];
sprintf(buffer, " iid 0: %s\n On an Adventure iid: %d", get_card_name_by_id(cards_data[0].id), get_internal_card_id_from_csv_id(CARD_ID_ON_AN_ADVENTURE));
do_dialog(player, player, card, -1, -1, buffer, 0);
but Swamp still can't be selected in the card picker. My guess is there's something else overwriting iid 0 as well. How would I get the first output you list? I haven't used gdb at all yet. Loading either ManalinkEh.dbg or an unstripped ManalinkEh.dll into gdb and running "p cards_data[0]" returns
Code: Select all
'cards_data' has unknown type; cast it to its declared type
Trying to attach to a running magic.exe with its PID from Task Manager returns "no such process"
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby Korath » 11 Oct 2021, 17:53

drool66 wrote:I failed to add an entry in ct_all for On an Adventure. Adding one returns a proper iid for On an Adventure through the ingame dialog sic:
Code: Select all
char buffer[100];
sprintf(buffer, " iid 0: %s\n On an Adventure iid: %d", get_card_name_by_id(cards_data[0].id), get_internal_card_id_from_csv_id(CARD_ID_ON_AN_ADVENTURE));
do_dialog(player, player, card, -1, -1, buffer, 0);
but Swamp still can't be selected in the card picker.
It then gets overwritten by the next-last csvid with no corresponding iid, which is "Spawnwrithe Token" at 18825. Put cards_data[0].name in your debug dialog to see it; get_card_name_by_id() pulls from cards_ptr[]->name.

The function overwriting cards_data[].name (and .rarity) is fixup_cards_data() at 0x4abf40 (confirmed by adding a breakpoint at its start, printing cards_data[0], running it to its end, and printing it again). It's triggered by an old, old bug in get_internal_card_id_from_csv_id(), which caused it to return 0 instead of -1 if an iid isn't found, and which I fixed and pushed last night in commit dd409c2ad.

drool66 wrote:How would I get the first output you list? I haven't used gdb at all yet. Loading either ManalinkEh.dbg or an unstripped ManalinkEh.dll into gdb and running "p cards_data[0]" returns
Code: Select all
'cards_data' has unknown type; cast it to its declared type
Code: Select all
$ i686-w64-mingw32-gdb magic.exe
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from magic.exe...
(No debugging symbols found in magic.exe)
(gdb) directory ../../src/manalink/master/src
Source directories searched: G:\dev\pristine\master/../../src/manalink/master/src;$cdir;$cwd
(gdb) sym ManalinkEh.dbg
Reading symbols from ManalinkEh.dbg...
(gdb) break pregame
Breakpoint 1 at 0x25f0160: file functions/rules_engine.c, line 538.
(gdb) run
Starting program: G:\dev\pristine\master\magic.exe
[New Thread 2372.0x2200]
[New Thread 2372.0x2ba8]
[New Thread 2372.0x6ac]
warning: onecore\com\combase\objact\objact.cxx(826)\combase.dll!75B6E399: (caller: 75B6CD9B) ReturnHr(1) tid(2898) 80040
1F0 CoInitialize has not been called.
[New Thread 2372.0x2954]
[New Thread 2372.0x2990]
[New Thread 2372.0xdcc]
[New Thread 2372.0x16a4]
[New Thread 2372.0x150c]
[New Thread 2372.0x201c]
[Thread 2372.0x201c exited with code 0]
[Thread 2372.0x2954 exited with code 0]
[Thread 2372.0xdcc exited with code 0]
[New Thread 2372.0x2280]
[New Thread 2372.0xf04]
[New Thread 2372.0x1cb0]
[Switching to Thread 2372.0x1cb0]

Thread 13 hit Breakpoint 1, pregame () at functions/rules_engine.c:538
538     void pregame(void){
(gdb) p cards_data[0]
$1 = {secret = 0 '\000', name = "Swamp", '\000' <repeats 12 times>, reserved1 = '\000' <repeats 16 times>, id = 239,
  reserved2 = 0, type = 1 '\001', subtype = 13 '\r', color = 2 '\002', cc = "\000\000", power = 0, toughness = 0,
  new_field = 0 '\000', reserved3 = 0 '\000', code_pointer = 0x200352c <CodeSectionEx+9510>, static_ability = 0,
  extra_ability = 4096, rarity = 1 '\001', act_phases = 1 '\001', expansion = 2 '\002', unused = 0 '\000',
  creature_rating = 0}
(gdb) bt
#0  pregame () at functions/rules_engine.c:538
#1  0x004524d0 in ?? ()
#2  0x004524a2 in ?? ()
#3  0x004946e9 in ?? ()
#4  0x760bfa29 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\SysWOW64\kernel32.dll
#5  0x775c7a9e in ntdll!RtlGetAppContainerNamedObjectPath () from C:\WINDOWS\SysWOW64\ntdll.dll
#6  0x775c7a6e in ntdll!RtlGetAppContainerNamedObjectPath () from C:\WINDOWS\SysWOW64\ntdll.dll
#7  0x00000000 in ?? ()
(gdb) quit
A debugging session is active.

        Inferior 1 [process 2372] will be killed.

Quit anyway? (y or n) y
drool66 wrote: Trying to attach to a running magic.exe with its PID from Task Manager returns "no such process"
Sounds like you're using the native wsl gdb. It's looking for a wsl pid, as shown by ps (or ps aux, if plain ps is insufficient). It wouldn't work anyway, because you're compiling and trying to debug a windows executable; you have to use the one targeted to windows binaries, which do use the pids shown by Task Manager.

I did have to build gdb from source to get it working; the i686-w64-mingw32-gdb supplied by the os couldn't run executables. You're running a more recent Ubuntu than me, though, so maybe it's ok.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby drool66 » 11 Oct 2021, 18:44

Thank you for all that. As you expected, (gdb) run returns "Don't know how to run". "attach (windows PID)" returns "don't know how to attach"
It then gets overwritten by the next-last csvid with no corresponding iid
So then it seems we just iterate adding ct_all entries until cards_data[0].name == Swamp, right?
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby Korath » 11 Oct 2021, 18:52

drool66 wrote:Thank you for all that. As you expected, (gdb) run returns "Don't know how to run". "attach (windows PID)" returns "don't know how to attach"
I'll pm you a link to the one I built - building was nontrivial (it needed a cross-compiled libexpat, which was stubborn), and it'd take some effort to track down all the steps again.
drool66 wrote:So then it seems we just iterate adding ct_all entries until cards_data[0].name == Swamp, right?
Can't work, because most of the csvids in question have empty names. Just rebuild with the one-character change from commit dd409c2ad.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [fixed] Card Picker doesn't search Biomass Mutation as b

Postby Aswan jaguar » 12 Oct 2021, 11:05

Just confirming that after your fix Korath now Swamp can be fetched.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times


Return to Archived Reports

Who is online

Users browsing this forum: No registered users and 34 guests


Who is online

In total there are 34 users online :: 0 registered, 0 hidden and 34 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 34 guests

Login Form