Wipeout Source Code Release - trying to build?

Post a topic about yourself to let others know your skills, hobbies, etc.
Post Reply
Golden Potato
What is PSXDEV?
What is PSXDEV?
Posts: 3
Joined: Mar 31, 2022
PlayStation Model: DTL-H2000
Discord: golden potato#8869
Location: USA

Wipeout Source Code Release - trying to build?

Post by Golden Potato » March 31st, 2022, 3:35 am

The source code for Wipeout was unofficially released.

Is anyone interested in getting the game to build on real hardware? I looked through some tweets of a guy getting it partially working for the Windows port, but I think the PSX version would be much more impressive!

https://archive.org/details/wipesrc.7z

I would attempt it myself, but I’ve got enough projects going on right now.
I’ve got a couple of DTL-H2000 dev board setups and the software setup on an old computer, but even if I had time I’m not sure where to begin with setting up a new project and importing this source code and dependencies.

Anyone else interested in taking a stab at it?

-Golden

User avatar
mzxtuelkl
Curious PSXDEV User
Curious PSXDEV User
Posts: 20
Joined: Jul 26, 2021
PlayStation Model: SCPH-5501
Location: United States
Contact:

Post by mzxtuelkl » April 2nd, 2022, 10:21 am

Decided to give it a shot. Seems like it's possible to build it using v2.6 of the psyq runtime libraries, but for some reason the compiler spits out "Software Data Key, or Network Manager not found or present." I'm guessing this is an authentication check?

Image

As a result, it does not produce the necessary CPE file. It's kinda weird since I've never seen this message with later versions of the compiler toolchain. I then tried using the newer DOS executables of the toolchain from the Programmer Tools CD v2.2 but it gave me a page fault:

Image

I'm guessing that there's something wrong with my setup since I've used the 16-bit toolchain (from the Programmer Tools CD 2.2) via DOSBox before. It definitely seems possible..

The command I used was:

Code: Select all

ccpsx -O2 -IC:\WIPESRC\PSX26\INCLUDE -IC:\WIPESRC\WIN95\MARKK -DUSE_ATI @sources.cf -o wipeout.cpe
The sources.cf file (I renamed the "Wipeout PSX" folder to "psx"):

Code: Select all

psx\COLLIDE.C
psx\COLLIDE.obj
psx\Control.c
psx\DD.C
psx\Debug
psx\DOTEX.C
psx\DRAW.C
psx\DYNAM.C
psx\EDITOR.C
psx\GLOBAL.C
psx\Grabber.c
psx\HUD.C
psx\INIT.C
psx\Main.c
psx\MPEGANIM.C
psx\OPTIONS.C
psx\P.C
psx\Racectrl.c
psx\RADSCN.C
psx\RADTRK.C
psx\regread.c
psx\SEARCH.C
psx\SHIPS.C
psx\Sound.c
psx\TRACK.C
psx\TTF.C
psx\UTILS.C
psx\WASSERT.C
psx\WAVE.C
psx\Weapon.c
psx\Win.c
psx\Wincd.c
psx\Winclip.c
psx\Winsnd.c
psx\Wintime.c
psx\WTL.C

User avatar
mzxtuelkl
Curious PSXDEV User
Curious PSXDEV User
Posts: 20
Joined: Jul 26, 2021
PlayStation Model: SCPH-5501
Location: United States
Contact:

Post by mzxtuelkl » April 3rd, 2022, 1:29 pm

Welp. Was hoping the build process would be quick and dirty, but unfortunately it is not. Found a version of the compiler toolchain bundled with the runtime libraries v4.6 that runs correctly under DOSBox, but I could not find the libraries the devs were actually using themselves. I assumed it was the v2.6 runtime libraries due to the 'PSX26' folder, but I was wrong. The 'Wipeout PSX' directory is also littered with Win32 code everywhere, which doesn't help. On a different note, there's apparently code from other Psygnosis games like "Assault Rigs" in the P.C source file (I'm guessing this is either a playable demo in PC Wipeout itself or some code they borrowed):

Code: Select all

/****************************************************************************
 *
 * win.c
 *
 ****************************************************************************
 *
 * $Log$
 * 
 ****************************************************************************/


/****************************************************************************
 *
 * Include Files
 *
 ****************************************************************************/

#define _WIN32
#include <res.h>
#include <windows.h>
#include <windowsx.h>
#include <ddraw.h>
#include <stdlib.h>
#include <stdarg.h>

#include <devices.h>
#include <scancode.h>


/****************************************************************************
 *
 * #defines and macros.
 *
 ****************************************************************************/

#define NAME "Assault Rigs"
#define TITLE "Assault Rigs"

/****************************************************************************
 *
 * User type definitions.
 *
 ****************************************************************************/

/****************************************************************************
 *
 * Structure definitions.
 *
 ****************************************************************************/

/****************************************************************************
 *
 * Function prototypes.
 *
 ****************************************************************************/

/****************************************************************************
 *
 * External (global) variables.
 *
 ****************************************************************************/

LPDIRECTDRAW			lpDD;
LPDIRECTDRAWSURFACE		lpDDSPrimary;
LPDIRECTDRAWSURFACE		lpDDSBack;
LPDIRECTDRAWPALETTE		lpDDPalette;
BOOL				bActive;
PALETTEENTRY			ddPalette[256];

char szMsg[] = "Page Flipping Test: Press F12 to exit";
char szFrontMsg[] = "Front buffer (F12 to quit)";
char szBackMsg[] = "Back buffer (F12 to quit)";

HRESULT ddrval;


/****************************************************************************
 *
 * void TidyUpWin(void)
 *
 ****************************************************************************
 *
 * Tidy up objects once we're finished
 *
 ****************************************************************************/

void TidyUpWin(void)
{
	if(lpDD)
	{
		if(lpDDSPrimary)
		{
			lpDDSPrimary->lpVtbl->Release(lpDDSPrimary);
			lpDDSPrimary=NULL;
		}
		lpDD->lpVtbl->Release(lpDD);
		lpDD=NULL;
	}
}


/****************************************************************************
 *
 * long FAR PASCAL WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
 *
 ****************************************************************************
 *
 * Window message handler
 *
 ****************************************************************************/

long FAR PASCAL WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
//	PAINTSTRUCT ps;
//	RECT rc;
//	SIZE size;

	switch(message)
	{
		case WM_ACTIVATEAPP:
			bActive=wParam;
			break;
	
		case WM_CREATE:
			break;

		case WM_SETCURSOR:
			SetCursor(NULL);
			return(TRUE);

		case WM_KEYDOWN:
			{
				extern void FakeKeyboardHandler(int);
				FakeKeyboardHandler((lParam>>16) & 127);
			}
			break;

		case WM_KEYUP:
			{
				extern void FakeKeyboardHandler(int);
				FakeKeyboardHandler(((lParam>>16) & 127) | 128);
			}
			break;

		case WM_DESTROY:
			TidyUpWin();
			PostQuitMessage(0);
			break;

	}

	return(DefWindowProc(hWnd,message,wParam,lParam));
}

/****************************************************************************
 *
 * BOOL WinCopyScreen(unsigned char *drawScreenPtr)
 *
 ****************************************************************************
 *
 * Copy drawScreenPtr to the screen...
 *
 ****************************************************************************/

void WinCopyScreen(unsigned char *drawScreenPtr)
{
	LPBYTE ptr;
	DDSURFACEDESC	ddsd;
	BYTE buf[256];
	int i;

	GetKeyboardState(&buf[0]);
	if(buf[VK_RCONTROL]&128)
	{
		MessageBeep(0);
	}

//	if(GetAsyncKeyState(VK_MENU)>>7)
//	{
//		MessageBeep(0);
//	}

	/* flip surface */
	if(bActive)
	{
		ZeroMemory(&ddsd, sizeof(ddsd));
		ddsd.dwSize = sizeof(ddsd);

		ddrval = lpDDSBack->lpVtbl->Lock(lpDDSBack, NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);

		if (ddrval == DDERR_SURFACELOST)
		{
			MessageBeep(0);
			lpDDSBack->lpVtbl->Restore(lpDDSBack);
		}

		ptr = (LPBYTE)ddsd.lpSurface;

		for(i=0;i<YRES;i++)
		{
			memcpy(ptr,drawScreenPtr+(i*XRES),XRES);
			ptr+=ddsd.lPitch;
		}

		lpDDSBack->lpVtbl->Unlock(lpDDSBack, ddsd.lpSurface);

		while( 1 )
		{
			ddrval = lpDDSPrimary->lpVtbl->Flip(lpDDSPrimary, NULL, 0 );
			if( ddrval == DD_OK )
			{
				break;
			}
			if( ddrval == DDERR_SURFACELOST )
			{
				ddrval = lpDDSPrimary->lpVtbl->Restore(lpDDSPrimary);
				if( ddrval != DD_OK )
				{
					break;
				}
			}
			if( ddrval != DDERR_WASSTILLDRAWING )
			{
				break;
			}
		}
	}
}



/****************************************************************************
 *
 * BOOL InitWin(HANDLE hInstance, int nCmdShow)
 *
 ****************************************************************************
 *
 * Create window, initialise data...
 *
 ****************************************************************************/

BOOL InitWin(HANDLE hInstance, int nCmdShow)
{
	HWND hwnd;
	WNDCLASS wc;
	DDSURFACEDESC ddsd;
	DDSCAPS ddscaps;
	HRESULT ddrval;
	HDC hdc;
	char buf[256];

	int i;

	/*
	 * Initialise palette
	 */

	for(i=0;i<256;i++)
	{
		ddPalette[i].peRed=i;
		ddPalette[i].peGreen=i;
		ddPalette[i].peBlue=i;
		ddPalette[i].peFlags=0;
	}

	/*
	 * Register window class
	 */

	wc.style=CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc=WindowProc;
	wc.cbClsExtra=0;
	wc.cbWndExtra=0;
	wc.hInstance=hInstance;
	wc.hIcon=NULL;
	wc.hCursor=NULL;
	wc.hbrBackground=NULL;
	wc.lpszMenuName=NAME;
	wc.lpszClassName=NAME;

	RegisterClass(&wc);

	/*
	 * Create window
	 */

	hwnd=CreateWindowEx(
		WS_EX_TOPMOST,
		NAME,
		TITLE,
		WS_POPUP,
		0,0,
		GetSystemMetrics( SM_CXSCREEN ),
		GetSystemMetrics( SM_CYSCREEN ),
		NULL,
		NULL,
		hInstance,
		NULL );

	if(!hwnd)
	{
		return(FALSE);
	}

	ShowWindow(hwnd,nCmdShow);
	UpdateWindow(hwnd);

	/*
	 * Create DirectDraw object
	 */

	ddrval = DirectDrawCreate( NULL, &lpDD, NULL );

	if( ddrval == DD_OK )
	{
		/* get exclusive mode */

		ddrval = lpDD->lpVtbl->SetCooperativeLevel( lpDD, hwnd,
	                         DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX );

		if(ddrval == DD_OK )
		{
			ddrval = lpDD->lpVtbl->SetDisplayMode( lpDD, XRES, YRES, 8 );
			if( ddrval == DD_OK )
			{
				/* create a palette */
				ddrval = lpDD->lpVtbl->CreatePalette(lpDD,DDPCAPS_8BIT,ddPalette,&lpDDPalette,NULL);
				if(ddrval == DD_OK)
				{
					/* create the primary surface with 1 back buffer */
					ddsd.dwSize = sizeof( ddsd );
					ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
					ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
					                DDSCAPS_FLIP | 
					                DDSCAPS_COMPLEX;
					ddsd.dwBackBufferCount = 1;
					ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpDDSPrimary, NULL );
					if( ddrval == DD_OK )
					{
						/* set palette for this surface */
						ddrval=lpDDSPrimary->lpVtbl->SetPalette(lpDDSPrimary,lpDDPalette);

						/* Get a pointer to the back buffer */
						ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
						ddrval = lpDDSPrimary->lpVtbl->GetAttachedSurface(lpDDSPrimary,&ddscaps,&lpDDSBack);
						if( ddrval == DD_OK )
						{
							return(TRUE);

//							/* Create a timer to flip the pages */
//							if( SetTimer( hwnd, TIMER_ID, TIMER_RATE, NULL ) )
//							{
//								return TRUE;
//							}
						}
					}    
				}
			}
		}
	}

	wsprintf(buf, "Direct Draw Init Failed (%08lx)\n", ddrval );
	MessageBox( hwnd, buf, "ERROR", MB_OK );
	TidyUpWin();
	DestroyWindow( hwnd );
	return FALSE;
}

/****************************************************************************
 *
 * void WinChangePalette(void)
 *
 ****************************************************************************
 *
 * Read the 3d-system's internal palette, and use it to update the direct
 * draw palette.
 *
 ****************************************************************************/

void WinChangePalette(void)
{
	HRESULT ddrval;
	int i;
	extern BYTE internalPaletteG[];

	for(i=0;i<256;i++)
	{
		ddPalette[i].peRed=internalPaletteG[i*3]*4;
		ddPalette[i].peGreen=internalPaletteG[i*3+1]*4;
		ddPalette[i].peBlue=internalPaletteG[i*3+2]*4;
		ddPalette[i].peFlags=0;
	}

	ddrval=lpDDPalette->lpVtbl->SetEntries(lpDDPalette,
	                                       DDSETPAL_IMMEDIATE,
						    0,
						    256,
						    ddPalette);
}

/****************************************************************************
 *
 * int ProcessMessages(void)
 *
 ****************************************************************************
 *
 * Process all messages in the message queue... does not block.
 * Called regularly from the main game loop.
 *
 ****************************************************************************/

int ProcessMessages(void)
{
	MSG msg;

	while(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
	{
		if(!GetMessage(&msg,NULL,0,0))
		{
			extern int shutdownFlagG;
			shutdownFlagG=1;
			return(1);
		}
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return(0);
}

void KeyboardGrabSnapshotHook(void)
{
	ProcessMessages();
}

extern void OldMain(void);
extern void (*keyboardGrabSnapshotCallback)(void);

int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	lpCmdLine;
	hPrevInstance;

	keyboardGrabSnapshotCallback=KeyboardGrabSnapshotHook;

	if(!InitWin(hInstance,nCmdShow))
	{
		return(FALSE);
	}

	OldMain();

	return(0);
}
The only thing I can think of is to update the entire source to use the newer psyq runtime libraries (or psn00b), which will require a lengthy time investment. It was probably foolish to think it'll work straight out of the box, but it was worth a shot!

Golden Potato
What is PSXDEV?
What is PSXDEV?
Posts: 3
Joined: Mar 31, 2022
PlayStation Model: DTL-H2000
Discord: golden potato#8869
Location: USA

Post by Golden Potato » April 5th, 2022, 5:33 am

Thanks for attempting this!

I was also hopeful that it would build out of the box, which was definitely wishful thinking.

I’m thinking I probably won’t put the effort in to getting this working if the entire source code needs to be edited to utilize newer runtime libraries. Maybe someone with more time and motivation will accept the challenge.

Thanks again!

-Golden

Jackhead
Verified
Curious PSXDEV User
Curious PSXDEV User
Posts: 13
Joined: Mar 09, 2012

Post by Jackhead » December 26th, 2022, 2:10 pm

Sounds interesting, i will give it a try ..
PS1 Dev PC: DTL-H2500, H2510, H201A, H800, CDU921S, CD-Emu PSY-Q on Asus P2B with Win98SE

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests