it turns out what I thought was my MSC5.0 install WAS 5.1
so I need to install MSC5.0, not MSC5.1
it turns out what I thought was my MSC5.0 install WAS 5.1
so I need to install MSC5.0, not MSC5.1
I'm currently figuring out functions through the amazing insight of "the linker is simple and linear"
which means when I have _memmove, FUNC_1fb7_6db0, and _strcmp in the EXE, FUNC_1fb7_6db0 is probably not going to be an adlib sound driver. it's going to be something from the libc.
current stats:
Total funcs: 756
Unnamed funcs: 360
% named: 52.4%
after extensive cross-referencing with the msc5.0 manual and the msc5.1 libraries being opened in a parallel copy of ghidra, I have finally been able to determine that the function I named sprintf_maybe is, in fact, _sprintf.
my hard work, as always, pays amazing dividends
__aaltstkovr
that's a name, all right.
yeah it's definitely not 5.0.
ugh. it's not 5.1 either. there may be some minor patch that I don't have access to
also I manged to get my include and lib directories backwards. \lib was full of .h files, and \include was full of .lib files
this is the kind of installation error that hasn't been possible since, like, 1991
I've now got a boolean that has three values (true, false, and 'image')
but it's okay, I have a permit: I'm non-binary.
the compression has a fun quirk: images can be compressed either top to bottom or left to right.
and the game switches between the two compression formats on a per-image basis.
So the developers just compressed each image both ways and used the smaller one. clever.
their compression algorithm is 87 bytes long. as long as supporting two algorithms saved at least 87 bytes, it was worth it
they did modify the random function though: the PoP one checks if the seed has been initialized. Carmen never does
I wonder if it'd be worth automating this. I don't currently have any tools to let me find functions in binary A that are also in binary B
hey look, Prince of Persia uses the same setjmp/longjmp mainloop design!
https://github.com/NagyD/SDLPoP/blob/7bd3bb85d8f7d4cb8ef72557ea0e65d80ba0906d/src/seg000.c#L197
I'm now doing some manual comparison of functions in PRINCE.EXE, and yep. they're byte-for-byte identical. There's shared code here! Awesome.
I've got my own code but it's not fully complete. I can't decompress all chunks yet
yeah from looking at the SDLPoP code, they've got some very familiar looking decompression code. Awesome.
SDLPoP is based on reverse engineering of the DOS PoP, maybe I can see how they implement DAT file reading.
prince of persia 2 shows the same behavior. I think this is a different version of the Brøderbund Chunk Format
The Backyard (1993) has the same later-chunk format
oh wow, it looks like Prince of Persia (DOS) also uses this DAT format!
Sadly, while the source for Prince of Persia is available... it's for the Apple II version. The DOS version is a complete reimplementation
1991's The Treehouse uses DAT files, with some of the same names as carmen... but my parser fails on it. I think it's a variation in the format, so I'm a byte off or something
the programmer credited for Galleons is Louis Ewens, who did work on several of the Carmen Sandiego games, but not the DOS-enhanced one.
Total funcs: 758
Unnamed funcs: 332
% named: 56.2%
pretty good for a day's work: nearly 4% done
made a discovery:
Galleons of Glory: The Secret Voyage of Magellan, released by Brøderbund in 1990, uses the same DAT format for its game files.
I haven't looked into the EXE yet, but that definitely sounds like they're sharing code
okay I've got all the libc stuff named, other than some internal functions (which I don't have names for), and one weird memmove-ish function that I just named "memmoveish"
it looks very similar to memmove, but with an extra check or two, but I can't match it to anything in the library
yeah looks good.
https://gist.github.com/foone/82de72a08f0e973fd3fa19b22d607d9a
The misplaced entries (like Cairo having a leader hint of "left in a vehicle flying a red, white and black flag") are like that in the original data files. Brøderbund just got their hints miscategorized sometimes.
and Where in the U.S.A. Is Carmen Sandiego? (1990, Enhanced)
working on a full dat exporter, to build a JSON of all the hints.
and I'm running into pronoun issues. Story of my fucking life.
I can now extract every image in every DAT for Where in the World is Carmen Sandiego? (1990, Enhanced)!
I'm getting some crashes. I think I'm gonna switch away from CFFI to just making a C wrapper around the code, and subprocessing that. That'll make it easier to debug why it's crashing
(and it won't take out my python process when it crashes)
rome.png wasn't decompressed in a day
okay it's working, but only for even-width'd images.
huh.
well, that's closer. it's an image instead of a segfault, at least.
Rome is the first city in that list that uses the LZG_UD compression format, rather than the LZG_LR format. that's why it's crashing.
Here's the image: Tokyo!
Tokyo: fine.
Sydney: fine.
Singapore: fine.
San Marino: fine.
Rome: PYTHON CRASHED
I have successfully extracted the first image from the game, using the ported SDLPoP compression code!
1 compression method down, 3 to go.
do you have enough cursors, queen of mice?
right now I'm doing this sorta manually by running dosbox with cycles=30 and watching it draw in real time
the original PC ran an 8088 at 4.77mhz, which DOSBox emulates as 240 cycles.
so this is approximately equivalent to a half-megahertz PC
tried bindiff: it doesn't like carmen.exe and binexport really doesn't like PRINCE.EXE, so that's a dead end for now
idea for debugging feature for dosbox:
press a button, then for the next X seonds, all modifications to the display memory are recorded along with the backtrace of what code changed it. So you could see a button get drawn, and check what code did that.
I think all I'd be able to get from it is some canonical names of library functions
fun fact about Prince of Persia (which I am doing research on because of how it reuses code from Carmen or vice versa):
A copy of it leaked with symbols included, but it's not the most normal version you can imagine... it's the mac port recompiled for MIPS.
could this still be relevant to my x86 code? WHO KNOWS?
I got halfway to googling this hint before remembering I'M FROM THERE (that state, at least. I'm from the other end of it)
Idly playing Where in the USA is Carman Sandiego, and found an unexpected example of "things that have changed since 1990": The IMAGE for New Hampshire!
It's the Old Man of the Mountain, which collapsed in 2004.
arg the way this game does travel can be really annoying
if you are in New Delhi and need to go to the USSR, but misclick on Oslo instead of Moscow, you can't just fly to Moscow from Oslo. You have to go back to New Delhi first
I'm like 90% sure that this game actually matches building types to what sorts of hints it gives you, and I'm also like 90% sure that this should have been obvious to me long ago
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.