PS-X EXE Loader
PS-X EXE Loader
Hello, everyone, I'm learning a bit about C programing using PSYQ I managed to compile a small exe with music using hitman mod and some TIM sprites with this site expemples, but now I want to make a loader for another exe from X game, I use UPX to compress the main game exe but I don't know how to link them, this is what I have so far:
- I know that the exe files have the entry point pointer is at 0x10.
- UPX decompression routine starts at 0x800, followed by the compressed exe data and is 2048 aligned.
- The combined exe files are smaller that the original game exe.
- I can do a jump to an offset when I exit the loader, I try to find the UPX decompression routine, but I think my loader trash the compressed data of the main exe
What I don't know:
- If exe files have the size somewhere in the header and when the PS calls some LoadExecutable function a parameter of the size of the exe is passed.
- How to load the main exe when I exit the loader
- I know that the exe files have the entry point pointer is at 0x10.
- UPX decompression routine starts at 0x800, followed by the compressed exe data and is 2048 aligned.
- The combined exe files are smaller that the original game exe.
- I can do a jump to an offset when I exit the loader, I try to find the UPX decompression routine, but I think my loader trash the compressed data of the main exe
What I don't know:
- If exe files have the size somewhere in the header and when the PS calls some LoadExecutable function a parameter of the size of the exe is passed.
- How to load the main exe when I exit the loader
- Dedok179
- Serious PSXDEV User
- Posts: 86
- Joined: Jun 11, 2015
- I am a: Programmer, Beginning reverser
- PlayStation Model: SCPH-5502
- Discord: Dedok179#2632
- Location: Tula,RU
Write me in PM, explain what exactly is needed and I will write the code.Z3R0X wrote: ↑June 28th, 2019, 4:31 am Hello, everyone, I'm learning a bit about C programing using PSYQ I managed to compile a small exe with music using hitman mod and some TIM sprites with this site expemples, but now I want to make a loader for another exe from X game, I use UPX to compress the main game exe but I don't know how to link them, this is what I have so far:
- I know that the exe files have the entry point pointer is at 0x10.
- UPX decompression routine starts at 0x800, followed by the compressed exe data and is 2048 aligned.
- The combined exe files are smaller that the original game exe.
- I can do a jump to an offset when I exit the loader, I try to find the UPX decompression routine, but I think my loader trash the compressed data of the main exe
What I don't know:
- If exe files have the size somewhere in the header and when the PS calls some LoadExecutable function a parameter of the size of the exe is passed.
- How to load the main exe when I exit the loader
Thank you so much for your help
-
Verified
- Extreme PSXDEV User
- Posts: 131
- Joined: Jul 17, 2013
I don't mean to stick my nose in someone else's business, everyone is free to do whatever they want afterall, but... was there a specific reason to solve the problem in PM, rather than on the thread itself in such a way to also help other people who might stumble upon a similar issue in the future?
- Dedok179
- Serious PSXDEV User
- Posts: 86
- Joined: Jun 11, 2015
- I am a: Programmer, Beginning reverser
- PlayStation Model: SCPH-5502
- Discord: Dedok179#2632
- Location: Tula,RU
No problem. The start address for the jump is easily searched through the IDA, the address of the depack for the depack.src is calculated manually, depending on how the file is unpacked into memory, basically it is the standard address 8000F800.Yagotzirck wrote: ↑June 29th, 2019, 8:57 pm I don't mean to stick my nose in someone else's business, everyone is free to do whatever they want afterall, but... was there a specific reason to solve the problem in PM, rather than on the thread itself in such a way to also help other people who might stumble upon a similar issue in the future?
I compressed the file after compiling it using UPX, otherwise it is not included in the disk image in size. To replace the file in the disk image via CDmage, it will automatically set the file to the desired size if it is smaller.
Source good
I found that the address that you need to jump is at 0x10 in the EXE header if you don't have IDA.
Thank you once again Dedok179, I'm refining everything to release better things in my channel, so people can enjoy better releases.
Thank you once again Dedok179, I'm refining everything to release better things in my channel, so people can enjoy better releases.
-
inc^lightforce Verified
- Psy-Q Enthusiast
- Posts: 249
- Joined: Mar 07, 2013
- I am a: Programmer Windows+PS1, GFX Artist
- PlayStation Model: Black
- Location: Germany
just use our/ my "Magic Sector Key" Tool.
all information you will get in one hit. no sniffing in the psx exe file is needed, just simple load a game *bin and wait.
You do not have the required permissions to view the files attached to this post.
-
inc^lightforce Verified
- Psy-Q Enthusiast
- Posts: 249
- Joined: Mar 07, 2013
- I am a: Programmer Windows+PS1, GFX Artist
- PlayStation Model: Black
- Location: Germany
here is an example taken from one of my SourceCode
to get the exactly Exec Address you must run the DOLCT.BAT. the files can be found in the attachment.
- DOLCT.BAT
- LCT.EXE
1. rename the original SLUS.. ps1 EXE to game.rnc
2. copy the file into the same folder next to DOLCT.BAT and LCT.EXE
3. run the batch
output = PatchData.txt
see here:
Code: Select all
=============================
Magic PSX Patching Tool v0.1
-----------------------------
(c) 2000 - AVH of PARADOX
=============================
Load address...........: 0x80010000
Decrunch to............: 0x8000f800
Exec address...........: 0x8006a1a8 <------ this is the address that need to be inserted into the source code as you can see below
Patch GetVideoMode() at: 0x8007888c (0x24020001 for PAL, 0x24020000 for NTSC)
0x80078890 (NOP out)
Patch X-Delta at.......: 0x8006b7a8 (0x24900030 for PAL, 0x24900010 for NTSC)
0x8006b7ac (0x24900030 for PAL, 0x24900010 for NTSC)
as you can see, the tool also print the video system Mode Address. if you wanna code a pal 2 ntsc or ntsc2pal selector you now have the values
how to use? see one of my examples in my workshop
REMEMBER:
always do this steps before packing the SLUS, otherwise you fail
Example from my source code
Code: Select all
MOD_Stop();MOD_Free();VSync(3);
PadStop();
ResetGraph(0);
StopCallback();
//-------------------------------------------------------------------------------
//------------------PATCH FUNCTION- DECRUNCH THE GAME------------
//------------------------------------------------------------------------------
EnterCriticalSection();
depack1();
start1();
ExitCriticalSection();
//-------------------------------------------------------------
//************************* starts game ***********************
//-------------------------------------------------------------
asm("nop");
asm("j 0x8006a1a8"); // Execution Address --> Load Game after PAD BREAK
asm("nop");
return 0;
You do not have the required permissions to view the files attached to this post.
Who is online
Users browsing this forum: No registered users and 0 guests