Page 1 of 1

Compiled EXE doesn't work

Posted: February 13th, 2019, 2:11 pm
by RootLM
I'm trying to port a game I made in C/MinGW to the PS1. After making everything C89/fixing errors
it compiles, but after using cpe2x the resulting EXE just shows a black screen in no$PSX.

It doesn't even get to the very first line of main (a printf) and somehow just ends up executing some area filled with nops. The hello world example on the site works fine so I have no idea what is causing it.

I'm using this makefile with all the directories with c files added. I've also tried putting every function into main.c but it has the same result.
Any idea why this would happen/how to fix it?

Re: Compiled EXE doesn't work

Posted: February 15th, 2019, 8:57 am
by RootLM
On further investigation, uh.. what the hell is up with this compiler?

It seems like using multiple files AT ALL (except for EXTREMELY small instances?) causes it to make a broken exe.
Like, splitting the graphics setup/buffer swapping code from the example into its own .c/.h causes it to make another black screen exe,
except sometimes messing around with no$psx's animate/jump one frame options will cause it to get to the first printfs and draw the grey background, but no text.

Is there a newer/better compiler that works with Psy-Q's libraries?
Or a way of getting ccpsx to actually work with multiple files? Like surely I have to be doing something wrong here right??

Re: Compiled EXE doesn't work

Posted: February 15th, 2019, 12:48 pm
by TriMesh
It shouldn't be a problem - I've written lots of stuff with the source split over multiple files.

You could try compiling it manually to see if it's a problem with the build system - just use a command like

ccpsx -g -Xo$80010000 file1.c file2.c filex.c -otarget.cpe
cpe2x target.cpe

Someone was working on getting the libraries linkable with a newer compiler, but that seems to have gone quiet. Unfortunately, the psyq libs are using a SN systems in-house format and aren't recognized by other toolchains.

It would be nice to sort it out - using 20 year old tools is generally pretty annoying.