nago Posted December 24, 2024 Share Posted December 24, 2024 I'm trying to figure out how to extract the .dat files in QP Shooting to translate it to English. (Not putting it in the Game Localization category as I do not need help with translation itself) QP Shooting is a bullet hell game released in 2004. It uses the Luna3D engine (pretty obscure Japanese game engine using DirectX, near impossible to find) About the Game Engine: From the game's main .exe file: Luna3rd Phase 10.20... 2003.07.29 Luna Homepage | twin-tail.jp/contents/luna/index.htm There's a game called Magical Broom Extreme made by the author of the engine. Might be helpful. The source code isn't included in "All Package", so you'll have to download that one separately from the rest. Self Extracting Installer | twin-tail.jp/contents/game/mbx/index.htm About the Game: QP Shooting Download (Trial, should be sufficient): daidai.moo.jp/dl.html Download is at the bottom of the list, 13MB. Right click and open as new tab for the Dropbox link to work. Presumably compiled with Borland C++. Checking the .exe in a hex editor shows some things: file names from the inside of the .dat files dat\st_00.txt through st_06.txt as previously listed, it uses Luna3rd Phase 10.20... 2003.07.29 along with that, it uses DirectX 8.1 And for the .dat files: some have a LAG/4C 41 47 file header (stg3.dat, stg4.dat, stg5.dat, stg6.dat) BMP converted to LAG (Luna image format) some have legible text, likely for filenames stg3.dat: "bgp_01", etc. (looks like main menu + UI stuff) stg4.dat: "face_mi01", "face_qp01", "face_qp02", "face_yu01", "face_yu02" (face sprites) the 2 letters before the last 2 numbers are in reference to which character's portrait it is stg5.dat: "cutin_01", "cutin_06" stg6.dat: (presumably) stuff relating to winning and bullet formations The later games made by the same developer use DXArchive from DXLibrary, but it's different for the older games. I figure I should link it just in case. (Source) / Link to DXLibrary Link to comment Share on other sites More sharing options...
barncastle Posted December 24, 2024 Share Posted December 24, 2024 (edited) There are two sets of .dat files in this game; system files (replay\qprpy_%d2.rpy, config.dat, stag.dat, stag2.dat) which are encrypted and asset files (stag[3-6].dat) which are blobs containing various DirectX compatible image assets The asset file starts with an 8 byte header followed by the below structure for each asset. The game has a function that loads assets by archive and file name which literally just scans the archive byte-by-byte for the filename struct { char filename[16]; uint32_t width; uint32_t height; uint32_t flags; // not 100% uint32_t size; char data[size]; } asset; The system files are encrypted with the below XOR cipher. The first uint32_t of the file is the length of the file minus the field itself and this is validated within the game as a very basic tamper check bool DecryptDat(char *filepath, void *output_buffer, int expected_size) { int index; FILE *file_ptr; char val; int size; bool success; success = 0; index = 0; size = 0; file_ptr = fopen(filepath, 'rb'); if ( !file_ptr ) return 0; // read first uin32_t size field fread(&size, 4u, 1u, file_ptr); if ( size == expected_size ) { while ( index < expected_size ) { val = fgetc(file_ptr); val = size++ ^ (16 * val | (val >> 4) & 0xF); output_buffer[index++] = val; } success = 1; } fclose(file_ptr); return success; } Hope this helps Edited December 24, 2024 by barncastle Link to comment Share on other sites More sharing options...
nago Posted December 25, 2024 Author Share Posted December 25, 2024 10 hours ago, barncastle said: The system files are encrypted with the below XOR cipher. The first uint32_t of the file is the length of the file minus the field itself and this is validated within the game as a very basic tamper check Sorry, I forgot to mention I'm not very well versed in C or backend code... Usually I only make minor modifications. Not sure if I need any specific dependencies or what to do to prevent it from throwing errors on debug. I'm using Visual Studio 2022. Link to comment Share on other sites More sharing options...
Thief1987 Posted December 28, 2024 Share Posted December 28, 2024 (edited) It seems like game text is in stg2.dat file, looks like each string have predetermined size of 256 byte with padding. Text is in UTF-8. I don't see anything useful in the stg.dat. QPShooting.rar Do you need an extractor of other archives? Edit kinda works Edited December 28, 2024 by Thief1987 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now