Page 2 of 2

Re: RSD Export Plug-in for Blender

Posted: May 10th, 2016, 2:52 pm
by Shadow
This should get you going. It's not perfect (there is no return value checking on errors, etc), but you'll get the idea. Rip out all the parts needed and it'll copy what you need from the CD-ROM into memory. I'd recommend using malloc3 so that way you can free memory afterwards, but that's only if you're seriously trying to make a game that needs dynamic RAM adjusting in real-time.

You call "CdRead2Addr" as that is your primary function.
IE: int main() { CdRead2Addr(arguments go here); return 0; }

Sony PlayStation 1 Source Code
CD-ROM RAM Copy Routines

Developers / Programmer.............: Shadow
Software Development Kit............: Psy-Q 4.6
First Release (as v1.0).............: 10/MAY/2016
Current Version.....................: 1.0


// RAM address storage location of the to be loaded TEX1 data
// NOTE: this is at the 1 MB location, but use anything that is available.
u_long TEX1 = 0x80100000L;

// CD-ROM prototypes
CdlFILE* CdRead2Addr(char *fname, void *address);
int _read2(long byte, void *sectbuf, int mode);

// copy the 't_tex.tim' into TEX1
CdRead2Addr("\\TEXTURES\\T_TEX.TIM;1", (u_long *)TEX1);

// Read a file to a hardcoded address
CdlFILE* CdRead2Addr(char *fname, void *address)
int mode = CdlModeSpeed;
int cnt, i;

for (i=0; i<10; i++) // retry ten times
if (CdSearchFile(&fp, fname) == 0) continue;

// set target position
CdControl(CdlSetloc, (u_char *)&(fp.pos), 0);
cnt = _read2(fp.size, address, mode); // read

if(cnt==0) return(&fp); // success

printf("\nCan not read the file: %s", fname);

return 0; // fail

int _read2(long byte, void *sectbuf, int mode)
int nsector,cnt;

// read start
CdRead(nsector, sectbuf, mode);

while((cnt=CdReadSync(1,NULL))>0) VSync(0);
return cnt;

Re: RSD Export Plug-in for Blender

Posted: November 23rd, 2017, 12:51 pm
by LameGuy64
I've made a much newer version of this plug-in I made earlier this year that performs better and is a lot less buggy than the version available here but I forgot to put it out somewhere.

I've updated the first post of this thread to feature a link to the Github repository of the new RSD export plug-in.