Bad idea: build a captcha library that embeds DOSBox so it can make you beat levels/puzzles from DOS games to continue.
-
OKAY realistically this is a game that features several different games you can play, and games between games. they're just gonna make each one a separate overlay.
so I need to figure out how it shifts overlays and how to track which overlay is active
-
looks like the separate game engines are called puzzler, electric, and simple.
-
I love when games use __FILE__ in their assertions. please tell me all your filenames please
-
can I not set an I/O breakpoint in dosbox-x's debugger? I forget.
-
@foone some of these could probably do double duty as age verification challenges .
-
@enno mean
but yeah, clearly. -
oh sweet laser jesus I found the upload palette function and THEY UNROLLED IT
-
why do:
for(int i=0;i<256;i++){
upload_color(i,palette[i]);
}when you can do
upload_color(0,palette[0]);
upload_color(1,palette[1]);
upload_color(2,palette[2]);
upload_color(3,palette[3]);
upload_color(4,palette[4]);
upload_color(5,palette[5]);and just repeat 251 more times
-
the worst part is that this was done with a compiler from 1991 so there's no way it unrolled the loop itself. they did this manually
-
@foone Any idea why? I have extremely little experience with programming in that era, but I remember that code size was always a serious concern ... so unrolling it sounds like a bad idea, unless they really needed it for performance.
-
@saua it runs slightly faster. like a couple cycles per "iteration".
This is aiming at CPUs so slow that that might matter
-
No compiler flags that would do this? ️
-
oh that's cute. their set_palette function takes two arguments: a pointer to the palette, and a number of extra palettes to apply.
so they could set up an array of palettes in decreasing brightness, and just do set_palette(&fade_pallets[0], 64) to go through them.
but the same function is a regular one-time set_palette if you just pass 1 for the second argument.
-
@simonzerafa in 1991? I don't think so. Not a for loop this big.
-
"hey ghidra what calls set_palette?"
"I don't know! you're in 16bit segmented mode! pointers are MEANINGLESS
-
ahh, nope! I misidentified it.
the second parameter on set_palette is how many frames to set it for.
The same palette gets set.it vsyncs every time so this is a set_palette that's also a timing function
-
@foone the only thing better than __FILE__ is __func__
-
or maybe not? it's too 2am to tell.
ANYWAY I'm currently debugging through a function that's 256 palette entry uploads and my debugger has no "run until return" function so I have to manually hit next instruction SO MANY TIMES
-
(approximately 1536 times)
-
this set_palette code got loaded into the segment 0BBC, one of the only 16-bit DOS segments marked red in shinigami eyes