RSD Export Plug-in for Blender

Downloadable items posted by PSXDEV members are within this forum.
User avatar
Shadow
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2670
Joined: Dec 31, 2012
PlayStation Model: H2000/5502
Discord: Shadow^PSXDEV

Post by Shadow » May 10th, 2016, 2:52 pm

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; }

Code: Select all

/*=========================================================
               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;
	nsector=(byte+2047)/2048;
	
	// read start
	CdRead(nsector, sectbuf, mode);
	
	while((cnt=CdReadSync(1,NULL))>0) VSync(0);
	return cnt;
}
cd.c
You do not have the required permissions to view the files attached to this post.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
LameGuy64
Verified
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 388
Joined: Apr 10, 2013
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines
Contact:

Post by LameGuy64 » November 23rd, 2017, 12:51 pm

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.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

rubixcube6
C Programming Expert
C Programming Expert
Posts: 10
Joined: Apr 11, 2021

Post by rubixcube6 » April 26th, 2021, 9:07 am

Do you plan on updating the plugin to work with Blender 2.8+?

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests