mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
sdl2: remove unsupported platform-specific folders
This commit is contained in:
parent
648a91adec
commit
0fb3e3e568
32 changed files with 0 additions and 2517 deletions
|
@ -1,12 +0,0 @@
|
|||
#
|
||||
# Makefile.cfg for WinCE with GCC
|
||||
#
|
||||
|
||||
OPTS+=-D_WIN32_WCE -D_UNICODE
|
||||
SDL_CFLAGS?=
|
||||
SDL_LDFLAGS?=
|
||||
NOHS=1
|
||||
NOHW=1
|
||||
NONET=1
|
||||
NOMIXER=1
|
||||
NOPNG=1
|
Binary file not shown.
|
@ -1,447 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2004 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// stub and replacement "ANSI" C functions for use under Windows CE
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../doomdef.h"
|
||||
#include "cehelp.h"
|
||||
|
||||
#define _SEC_IN_MINUTE 60
|
||||
#define _SEC_IN_HOUR 3600
|
||||
#define _SEC_IN_DAY 86400
|
||||
|
||||
static const int DAYS_IN_MONTH[12] =
|
||||
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
|
||||
#define _DAYS_IN_MONTH(x) ((x == 1) ? days_in_feb : DAYS_IN_MONTH[x])
|
||||
|
||||
static const int _DAYS_BEFORE_MONTH[12] =
|
||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
|
||||
|
||||
#define _ISLEAP(y) (((y) % 4) == 0 && (((y) % 100) != 0 || (((y)+1900) % 400) == 0))
|
||||
#define _DAYS_IN_YEAR(year) (_ISLEAP(year) ? 366 : 365)
|
||||
|
||||
char *strerror(int ecode)
|
||||
{
|
||||
static char buff[1024 + 1];
|
||||
DWORD dwMsgLen = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
|
||||
ecode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &buff[0], 1024, NULL);
|
||||
return buff;
|
||||
}
|
||||
|
||||
int unlink( const char *filename )
|
||||
{
|
||||
return remove(filename);
|
||||
}
|
||||
|
||||
int remove( const char *path )
|
||||
{
|
||||
return DeleteFileA(path)-1;
|
||||
}
|
||||
|
||||
int rename( const char *oldname, const char *newname )
|
||||
{
|
||||
return MoveFileA(oldname, newname)!=0;
|
||||
}
|
||||
|
||||
static inline void STToTM(const SYSTEMTIME *st, struct tm *tm)
|
||||
{
|
||||
if (!st || !tm) return;
|
||||
tm->tm_sec = st->wSecond;
|
||||
tm->tm_min = st->wMinute;
|
||||
tm->tm_hour = st->wHour;
|
||||
tm->tm_mday = st->wDay;
|
||||
tm->tm_mon = st->wMonth - 1;
|
||||
tm->tm_year = st->wYear - 1900;
|
||||
tm->tm_wday = st->wDayOfWeek;
|
||||
tm->tm_yday = 0;
|
||||
tm->tm_isdst = 0;
|
||||
}
|
||||
|
||||
time_t time(time_t *T)
|
||||
{
|
||||
time_t returntime;
|
||||
SYSTEMTIME st;
|
||||
struct tm stft;
|
||||
GetSystemTime(&st);
|
||||
STToTM(&st,&stft);
|
||||
returntime = mktime(&stft);
|
||||
if (T) *T = returntime;
|
||||
return returntime;
|
||||
}
|
||||
|
||||
static inline UINT64 TTtoFT(const time_t wt, FILETIME *ft)
|
||||
{
|
||||
UINT64 temptime = wt; // FILETIME: 1/(10^7) secs since January 1, 1601
|
||||
temptime *= 10000000; // time_t : 1 secs since January 1, 1970
|
||||
// 369 years * 365 days * 24 hours * 60 mins * 60 secs * 10
|
||||
// 123 leaps days * 24 hours * 60 mins * 60 secs * 10
|
||||
temptime += 116444736000000000;
|
||||
if (ft) CopyMemory(ft,&temptime,sizeof (ULARGE_INTEGER));
|
||||
return temptime;
|
||||
}
|
||||
|
||||
static struct tm cehelptm;
|
||||
|
||||
struct tm * localtime(const time_t *CLOCK)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
FILETIME stft;
|
||||
UINT64 ftli = 0;
|
||||
if (CLOCK) ftli = TTtoFT(*CLOCK, &stft);
|
||||
if (ftli)
|
||||
FileTimeToSystemTime(&stft,&st);
|
||||
else
|
||||
GetSystemTime(&st);
|
||||
STToTM(&st,&cehelptm);
|
||||
if (st.wYear >= 1970)
|
||||
return &cehelptm;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void validate_structure (struct tm *tim_p) // from newlib
|
||||
{
|
||||
div_t res;
|
||||
int days_in_feb = 28;
|
||||
|
||||
/* calculate time & date to account for out of range values */
|
||||
if (tim_p->tm_sec < 0 || tim_p->tm_sec > 59)
|
||||
{
|
||||
res = div (tim_p->tm_sec, 60);
|
||||
tim_p->tm_min += res.quot;
|
||||
if ((tim_p->tm_sec = res.rem) < 0)
|
||||
{
|
||||
tim_p->tm_sec += 60;
|
||||
--tim_p->tm_min;
|
||||
}
|
||||
}
|
||||
|
||||
if (tim_p->tm_min < 0 || tim_p->tm_min > 59)
|
||||
{
|
||||
res = div (tim_p->tm_min, 60);
|
||||
tim_p->tm_hour += res.quot;
|
||||
if ((tim_p->tm_min = res.rem) < 0)
|
||||
{
|
||||
tim_p->tm_min += 60;
|
||||
--tim_p->tm_hour;
|
||||
}
|
||||
}
|
||||
|
||||
if (tim_p->tm_hour < 0 || tim_p->tm_hour > 23)
|
||||
{
|
||||
res = div (tim_p->tm_hour, 24);
|
||||
tim_p->tm_mday += res.quot;
|
||||
if ((tim_p->tm_hour = res.rem) < 0)
|
||||
{
|
||||
tim_p->tm_hour += 24;
|
||||
--tim_p->tm_mday;
|
||||
}
|
||||
}
|
||||
|
||||
if (tim_p->tm_mon > 11)
|
||||
{
|
||||
res = div (tim_p->tm_mon, 12);
|
||||
tim_p->tm_year += res.quot;
|
||||
if ((tim_p->tm_mon = res.rem) < 0)
|
||||
{
|
||||
tim_p->tm_mon += 12;
|
||||
--tim_p->tm_year;
|
||||
}
|
||||
}
|
||||
|
||||
if (_DAYS_IN_YEAR (tim_p->tm_year) == 366)
|
||||
days_in_feb = 29;
|
||||
|
||||
if (tim_p->tm_mday <= 0)
|
||||
{
|
||||
while (tim_p->tm_mday <= 0)
|
||||
{
|
||||
if (--tim_p->tm_mon == -1)
|
||||
{
|
||||
tim_p->tm_year--;
|
||||
tim_p->tm_mon = 11;
|
||||
days_in_feb =
|
||||
((_DAYS_IN_YEAR (tim_p->tm_year) == 366) ?
|
||||
29 : 28);
|
||||
}
|
||||
tim_p->tm_mday += _DAYS_IN_MONTH (tim_p->tm_mon);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (tim_p->tm_mday > _DAYS_IN_MONTH (tim_p->tm_mon))
|
||||
{
|
||||
tim_p->tm_mday -= _DAYS_IN_MONTH (tim_p->tm_mon);
|
||||
if (++tim_p->tm_mon == 12)
|
||||
{
|
||||
tim_p->tm_year++;
|
||||
tim_p->tm_mon = 0;
|
||||
days_in_feb =
|
||||
((_DAYS_IN_YEAR (tim_p->tm_year) == 366) ?
|
||||
29 : 28);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
time_t mktime (struct tm *tim_p) // from newlib
|
||||
{
|
||||
time_t tim = 0;
|
||||
long days = 0;
|
||||
int year;
|
||||
|
||||
/* validate structure */
|
||||
validate_structure (tim_p);
|
||||
|
||||
/* compute hours, minutes, seconds */
|
||||
tim += tim_p->tm_sec + (tim_p->tm_min * _SEC_IN_MINUTE) +
|
||||
(tim_p->tm_hour * _SEC_IN_HOUR);
|
||||
|
||||
/* compute days in year */
|
||||
days += tim_p->tm_mday - 1;
|
||||
days += _DAYS_BEFORE_MONTH[tim_p->tm_mon];
|
||||
if (tim_p->tm_mon > 1 && _DAYS_IN_YEAR (tim_p->tm_year) == 366)
|
||||
days++;
|
||||
|
||||
/* compute day of the year */
|
||||
tim_p->tm_yday = days;
|
||||
|
||||
if (tim_p->tm_year > 10000
|
||||
|| tim_p->tm_year < -10000)
|
||||
{
|
||||
return (time_t) -1;
|
||||
}
|
||||
|
||||
/* compute days in other years */
|
||||
if (tim_p->tm_year > 70)
|
||||
{
|
||||
for (year = 70; year < tim_p->tm_year; year++)
|
||||
days += _DAYS_IN_YEAR (year);
|
||||
}
|
||||
else if (tim_p->tm_year < 70)
|
||||
{
|
||||
for (year = 69; year > tim_p->tm_year; year--)
|
||||
days -= _DAYS_IN_YEAR (year);
|
||||
days -= _DAYS_IN_YEAR (year);
|
||||
}
|
||||
|
||||
/* compute day of the week */
|
||||
if ((tim_p->tm_wday = (days + 4) % 7) < 0)
|
||||
tim_p->tm_wday += 7;
|
||||
|
||||
/* compute total seconds */
|
||||
tim += (days * _SEC_IN_DAY);
|
||||
|
||||
return tim;
|
||||
}
|
||||
|
||||
#undef WINAPI
|
||||
#define WINAPI __stdcall //__delcspec(dllexport)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning(disable : 4273)
|
||||
#endif
|
||||
|
||||
|
||||
static __forceinline int STRtoWSTR(LPCSTR lpMultiByteStr, int cchMultiByte,
|
||||
LPWSTR lpWideCharStr, int cchWideChar)
|
||||
{
|
||||
return MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpMultiByteStr,
|
||||
cchMultiByte,lpWideCharStr,cchWideChar);
|
||||
}
|
||||
|
||||
static __forceinline int WSTRtoSTR(LPCWSTR lpWideCharStr, int cchWideChar,
|
||||
LPSTR lpMultiByteStr, int cbMultiByte)
|
||||
{
|
||||
return WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK|WC_SEPCHARS,
|
||||
lpWideCharStr,cchWideChar,lpMultiByteStr,cbMultiByte,NULL,NULL);
|
||||
}
|
||||
|
||||
DWORD WINAPI FormatMessageA(
|
||||
DWORD dwFlags,
|
||||
LPCVOID lpSource,
|
||||
DWORD dwMessageId,
|
||||
DWORD dwLanguageId,
|
||||
LPSTR lpBuffer,
|
||||
DWORD nSize,
|
||||
va_list *Arguments)
|
||||
{
|
||||
const int nSizeW = STRtoWSTR(lpBuffer,nSize,NULL,0);
|
||||
int nSizeF = 0;
|
||||
LPWSTR lpBufferW = alloca(sizeof (wchar_t)*nSizeW);
|
||||
LPWSTR lpSourceW = NULL;
|
||||
|
||||
if (!lpBufferW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
ZeroMemory(lpBuffer,nSize);
|
||||
return nSizeF;
|
||||
}
|
||||
|
||||
if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
|
||||
{
|
||||
const int sLen = STRtoWSTR(lpSource, -1, NULL, 0);
|
||||
lpSourceW = alloca(sizeof (wchar_t)*sLen);
|
||||
|
||||
if (lpSourceW)
|
||||
STRtoWSTR(lpSource, -1, lpSourceW, sLen);
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return nSizeF;
|
||||
}
|
||||
}
|
||||
|
||||
if (lpSourceW)
|
||||
nSizeF = FormatMessageW(dwFlags, lpSourceW, dwMessageId, dwLanguageId,
|
||||
lpBufferW, nSizeW, Arguments);
|
||||
else
|
||||
nSizeF = FormatMessageW(dwFlags, lpSource, dwMessageId, dwLanguageId,
|
||||
lpBufferW, nSizeW, Arguments);
|
||||
|
||||
return WSTRtoSTR(lpBufferW, nSizeF, lpBuffer, nSize);
|
||||
}
|
||||
|
||||
BOOL WINAPI DeleteFileA(
|
||||
LPCSTR lpFileName)
|
||||
{
|
||||
const int sLen = STRtoWSTR(lpFileName, -1, NULL, 0);
|
||||
LPWSTR lpFileNameW = alloca(sizeof (wchar_t)*sLen);
|
||||
|
||||
if (lpFileNameW)
|
||||
STRtoWSTR(lpFileName, -1, lpFileNameW, sLen);
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DeleteFileW(lpFileNameW);
|
||||
}
|
||||
|
||||
BOOL WINAPI MoveFileA(
|
||||
LPCSTR lpExistingFileName,
|
||||
LPCSTR lpNewFileName
|
||||
)
|
||||
{
|
||||
const int sLen1 = STRtoWSTR(lpExistingFileName, -1, NULL, 0);
|
||||
LPWSTR lpExistingFileNameW = alloca(sizeof (wchar_t)*sLen1);
|
||||
|
||||
const int sLen2 = STRtoWSTR(lpNewFileName, -1, NULL, 0);
|
||||
LPWSTR lpNewFileNameW = alloca(sizeof (wchar_t)*sLen2);
|
||||
|
||||
|
||||
if (!lpExistingFileNameW || !lpNewFileNameW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STRtoWSTR(lpExistingFileName, -1, lpExistingFileNameW, sLen1);
|
||||
STRtoWSTR(lpNewFileName, -1, lpNewFileNameW, sLen2);
|
||||
|
||||
return MoveFileW(lpExistingFileNameW, lpNewFileNameW);
|
||||
}
|
||||
|
||||
|
||||
HANDLE WINAPI CreateFileA(
|
||||
LPCSTR lpFileName,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwShareMode,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition,
|
||||
DWORD dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile)
|
||||
{
|
||||
const int sLen = STRtoWSTR(lpFileName, -1, NULL, 0);
|
||||
LPWSTR lpFileNameW = alloca(sizeof (wchar_t)*sLen);
|
||||
|
||||
if (lpFileNameW)
|
||||
STRtoWSTR(lpFileName, -1, lpFileNameW, sLen);
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
return CreateFileW(lpFileNameW, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
}
|
||||
|
||||
BOOL WINAPI CreateDirectoryA(
|
||||
LPCSTR lpPathName,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||
{
|
||||
const int sLen = STRtoWSTR(lpPathName, -1, NULL, 0);
|
||||
LPWSTR lpPathNameW = alloca(sizeof (wchar_t)*sLen);
|
||||
|
||||
if (lpPathNameW)
|
||||
STRtoWSTR(lpPathName, -1, lpPathNameW, sLen);
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return CreateDirectoryW(lpPathNameW, lpSecurityAttributes);
|
||||
}
|
||||
|
||||
int WINAPI MessageBoxA(
|
||||
HWND hWnd ,
|
||||
LPCSTR lpText,
|
||||
LPCSTR lpCaption,
|
||||
UINT uType)
|
||||
{
|
||||
const int sLen1 = STRtoWSTR(lpText, -1, NULL, 0);
|
||||
LPWSTR lpTextW = alloca(sizeof (wchar_t)*sLen1);
|
||||
|
||||
const int sLen2 = STRtoWSTR(lpCaption, -1, NULL, 0);
|
||||
LPWSTR lpCaptionW = alloca(sizeof (wchar_t)*sLen2);
|
||||
|
||||
|
||||
if (!lpTextW || !lpCaptionW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STRtoWSTR(lpText, -1, lpTextW, sLen1);
|
||||
STRtoWSTR(lpCaption, -1, lpCaptionW, sLen2);
|
||||
|
||||
return MessageBoxW(hWnd, lpTextW, lpCaptionW, uType);
|
||||
}
|
||||
|
||||
VOID WINAPI OutputDebugStringA(
|
||||
LPCSTR lpOutputString)
|
||||
{
|
||||
const int sLen = STRtoWSTR(lpOutputString, -1, NULL, 0);
|
||||
LPWSTR lpOutputStringW = alloca(sizeof (wchar_t)*sLen);
|
||||
|
||||
if (lpOutputStringW)
|
||||
STRtoWSTR(lpOutputString, -1, lpOutputStringW, sLen);
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
OutputDebugStringW(lpOutputStringW);
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2004 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// stub and replacement "ANSI" C functions for use under Windows CE
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __I_WINCE__
|
||||
#define __I_WINCE__
|
||||
|
||||
#ifdef USEASMCE
|
||||
#define USEASM // Remline if NASM doesn't work on x86 targets
|
||||
#endif
|
||||
|
||||
char *strerror(int ecode);
|
||||
int access(const char *path, int amode);
|
||||
int unlink( const char *filename );
|
||||
int remove( const char *path );
|
||||
int rename( const char *oldname, const char *newname );
|
||||
//CreateDirectoryEx( const char *currectpath, const char *path,SECURITY_ATTRIBUTES)
|
||||
|
||||
#ifndef _TIME_T_DEFINED
|
||||
typedef long time_t; /* time value */
|
||||
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
|
||||
#endif
|
||||
|
||||
time_t time(time_t *T);
|
||||
|
||||
#ifndef __GNUC__
|
||||
#ifndef _TM_DEFINED
|
||||
struct tm {
|
||||
int tm_sec; /* seconds after the minute - [0,59] */
|
||||
int tm_min; /* minutes after the hour - [0,59] */
|
||||
int tm_hour; /* hours since midnight - [0,23] */
|
||||
int tm_mday; /* day of the month - [1,31] */
|
||||
int tm_mon; /* months since January - [0,11] */
|
||||
int tm_year; /* years since 1900 */
|
||||
int tm_wday; /* days since Sunday - [0,6] */
|
||||
int tm_yday; /* days since January 1 - [0,365] */
|
||||
int tm_isdst; /* daylight savings time flag */
|
||||
};
|
||||
#define _TM_DEFINED
|
||||
#endif
|
||||
|
||||
struct tm * localtime(const time_t *CLOCK);
|
||||
|
||||
time_t mktime (struct tm *tim_p);
|
||||
#endif
|
||||
|
||||
#endif
|
1
src/sdl2/SRB2DC/.gitignore
vendored
1
src/sdl2/SRB2DC/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
/scramble
|
Binary file not shown.
|
@ -1,53 +0,0 @@
|
|||
#
|
||||
# Makefile.cfg for SRB2/Dreamcast
|
||||
#
|
||||
|
||||
#include $(KOS_BASE)/Makefile.rules
|
||||
|
||||
#
|
||||
#hmmm, the Dreamcast
|
||||
#
|
||||
|
||||
HOSTCC:=$(CC)
|
||||
CC=$(KOS_CC)
|
||||
PREFIX=$(KOS_CC_BASE)/bin/$(KOS_CC_PREFIX)
|
||||
OBJDUMP=$(PREFIX)-objdump
|
||||
OBJCOPY=$(PREFIX)-objcopy
|
||||
|
||||
#NOHW=1 #No working MiniGL right now
|
||||
NOHS=1 #No HWSound right now
|
||||
ifndef LWIP
|
||||
NONET=1 #No LWIP
|
||||
endif
|
||||
#i_net_o=$(OBJDIR)/i_udp.o #use KOS's UDP
|
||||
#NOMIXER=1 #Basic sound only
|
||||
NOIPX=1 #No IPX network code
|
||||
NOPNG=1 #No Screenshot
|
||||
|
||||
OPTS=$(KOS_CFLAGS) -DUNIXCOMMON -DDC
|
||||
ifndef NOHW
|
||||
OPTS+=-DSTATIC_OPENGL -DMINI_GL_COMPATIBILITY -DKOS_GL_COMPATIBILITY
|
||||
endif
|
||||
SDL_CFLAGS?=-I$(KOS_BASE)/addons/include/SDL
|
||||
SDL_LDFLAGS?=-lSDL
|
||||
LDFLAGS=$(KOS_LDFLAGS)
|
||||
LIBS:=$(KOS_LIBS) -lconio -lm
|
||||
ifndef NOMIXER
|
||||
LIBS:=-loggvorbisplay -lSDL $(LIBS)
|
||||
endif
|
||||
|
||||
ifdef LWIP
|
||||
OPTS+=-I$(KOS_BASE)/../kos-ports/lwip/kos/include -I$(KOS_BASE)/../kos-ports/lwip/lwip/src/include/ipv4 -I$(KOS_BASE)/../kos-ports/lwip/lwip/src/include -DIPv4
|
||||
LIBS:=-llwip4 -lkosutils $(LIBS)
|
||||
OPTS+=-DHAVE_LWIP
|
||||
endif
|
||||
ifndef NOHW
|
||||
LIBS+=-lgl
|
||||
endif
|
||||
|
||||
i_system_o+=$(OBJDIR)/dchelp.o
|
||||
i_main_o=$(KOS_START) $(OBJDIR)/i_main.o $(OBJEXTRA)
|
||||
|
||||
# name of the exefile
|
||||
EXENAME?=SRB2.elf
|
||||
BINNAME?=SRB2.BIN
|
Binary file not shown.
|
@ -1,19 +0,0 @@
|
|||
#define VMU_width 48
|
||||
#define VMU_height 32
|
||||
static unsigned char VMU_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x58, 0x75, 0x00, 0x00, 0x00, 0x00, 0xee, 0xaa, 0x00, 0x00,
|
||||
0x00, 0x86, 0x55, 0x55, 0x01, 0x00, 0x00, 0xda, 0xc8, 0xaf, 0x00, 0x00,
|
||||
0x00, 0x62, 0x55, 0x54, 0x00, 0x00, 0x00, 0x32, 0xa2, 0x6c, 0x00, 0x00,
|
||||
0x00, 0x5c, 0x55, 0xfd, 0x01, 0x00, 0x00, 0xac, 0x88, 0xaa, 0x02, 0x00,
|
||||
0x00, 0x54, 0x75, 0x55, 0x05, 0x00, 0x00, 0xac, 0xbf, 0xaa, 0x0a, 0x00,
|
||||
0x00, 0xd6, 0x61, 0x55, 0x15, 0x00, 0x00, 0xe9, 0xc0, 0xaa, 0x2a, 0x00,
|
||||
0x00, 0x39, 0x40, 0x55, 0x55, 0x00, 0x00, 0x6d, 0xc0, 0xaa, 0xbe, 0x00,
|
||||
0x00, 0x6d, 0x40, 0xd5, 0xc3, 0x00, 0x00, 0x6d, 0xc0, 0xea, 0x00, 0x00,
|
||||
0x00, 0x29, 0x60, 0xf5, 0x00, 0x00, 0x00, 0x26, 0xe0, 0xfa, 0x00, 0x00,
|
||||
0x00, 0x58, 0xb8, 0xbd, 0x00, 0x00, 0x00, 0x84, 0x07, 0xdf, 0x00, 0x00,
|
||||
0x00, 0x08, 0x20, 0xae, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x5f, 0x01, 0x00,
|
||||
0x00, 0xc0, 0x3f, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
@ -1,134 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2006 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// stub and replacement "ANSI" C functions for use on Dreamcast/KOS
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <kos/fs.h>
|
||||
#include <errno.h>
|
||||
#ifndef HAVE_LWIP
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include "../../doomdef.h"
|
||||
#include "dchelp.h"
|
||||
|
||||
int access(const char *path, int amode)
|
||||
{
|
||||
file_t handle = FILEHND_INVALID;
|
||||
|
||||
if (amode == F_OK || amode == R_OK)
|
||||
handle=fs_open(path,O_RDONLY);
|
||||
else if (amode == (R_OK|W_OK))
|
||||
handle=fs_open(path,O_RDWR);
|
||||
else if (amode == W_OK)
|
||||
handle=fs_open(path,O_WRONLY);
|
||||
|
||||
if (handle != FILEHND_INVALID)
|
||||
{
|
||||
fs_close(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
double hypot(double x, double y)
|
||||
{
|
||||
double ax, yx, yx2, yx1;
|
||||
if (abs(y) > abs(x)) // |y|>|x|
|
||||
{
|
||||
ax = abs(y); // |y| => ax
|
||||
yx = (x/y);
|
||||
}
|
||||
else // |x|>|y|
|
||||
{
|
||||
ax = abs(x); // |x| => ax
|
||||
yx = (x/y);
|
||||
}
|
||||
yx2 = yx*yx; // (x/y)^2
|
||||
yx1 = sqrt(1+yx2); // (1 + (x/y)^2)^1/2
|
||||
return ax*yx1; // |x|*((1 + (x/y)^2)^1/2)
|
||||
}
|
||||
|
||||
#if !(defined (NONET) || defined (NOMD5))
|
||||
#ifdef HAVE_LWIP
|
||||
|
||||
#include <lwip/lwip.h>
|
||||
|
||||
static uint8 ip[4];
|
||||
static char *h_addr_listtmp[2] = {ip, NULL};
|
||||
static struct hostent hostenttmp = {NULL, NULL, 0, 1, h_addr_listtmp};
|
||||
|
||||
struct hostent *gethostbyname(const char *name)
|
||||
{
|
||||
struct sockaddr_in dnssrv;
|
||||
dnssrv.sin_family = AF_INET;
|
||||
dnssrv.sin_port = htons(53);
|
||||
dnssrv.sin_addr.s_addr = htonl(0x0a030202); ///< what?
|
||||
if (lwip_gethostbyname(&dnssrv, name, ip) < 0)
|
||||
return NULL;
|
||||
else
|
||||
return &hostenttmp;
|
||||
}
|
||||
#else
|
||||
|
||||
struct hostent *gethostbyname(const char *name)
|
||||
{
|
||||
(void)name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ioctl(int s, long cmd, void *argp)
|
||||
{
|
||||
return fs_ioctl(s, argp, cmd); //FIONBIO?
|
||||
}
|
||||
|
||||
int select(int maxfdp1, void *readset, void *writeset, void *exceptset,
|
||||
void *timeout)
|
||||
{
|
||||
(void)maxfdp1;
|
||||
(void)readset;
|
||||
(void)writeset;
|
||||
(void)exceptset;
|
||||
(void)timeout;
|
||||
errno = EAFNOSUPPORT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||
{
|
||||
(void)s;
|
||||
(void)level; //SOL_SOCKET
|
||||
(void)optname; //SO_RCVBUF, SO_ERROR
|
||||
(void)optval;
|
||||
(void)optlen;
|
||||
errno = EAFNOSUPPORT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int setsockopt (int s, int level, int optname, void *optval, socklen_t optlen)
|
||||
{
|
||||
(void)s;
|
||||
(void)level; //SOL_SOCKET
|
||||
(void)optname; //SO_REUSEADDR, SO_BROADCAST, SO_RCVBUF
|
||||
(void)optval;
|
||||
(void)optlen;
|
||||
errno = EAFNOSUPPORT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,51 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2006 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// stub and replacement "ANSI" C functions for use on Dreamcast/KOS
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __I_DREAMCAST__
|
||||
#define __I_DREAMCAST__
|
||||
|
||||
struct hostent
|
||||
{
|
||||
char *h_name; /* Official name of host. */
|
||||
char **h_aliases; /* Alias list. */
|
||||
int h_addrtype; /* Host address type. */
|
||||
int h_length; /* Length of address. */
|
||||
char **h_addr_list; /* List of addresses from name server. */
|
||||
#define h_addr h_addr_list[0] /* Address, for backward compatibility. */
|
||||
};
|
||||
|
||||
struct hostent *gethostbyname(const char *name);
|
||||
|
||||
#ifndef HAVE_LWIP
|
||||
#define INADDR_NONE ((uint32) 0xffffffff)
|
||||
#define INADDR_LOOPBACK ((uint32) 0x7f000001)
|
||||
#define SOCK_STREAM 1
|
||||
#define FIONBIO 0
|
||||
#define SOL_SOCKET 0
|
||||
#define SO_ERROR 0
|
||||
#define SO_REUSEADDR 0
|
||||
#define SO_BROADCAST 0
|
||||
#define SO_RCVBUF 0
|
||||
int ioctl(int s, long cmd, void *argp);
|
||||
int select(int maxfdp1, void *readset, void *writeset, void *exceptset, void *timeout);
|
||||
int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
|
||||
int setsockopt(int s, int level, int optname, void *optval, socklen_t optlen);
|
||||
#endif
|
||||
#endif
|
|
@ -1,455 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 2005 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief KOS UDP network interface
|
||||
|
||||
#include "../../doomdef.h"
|
||||
|
||||
#include "../../i_system.h"
|
||||
#include "../../d_event.h"
|
||||
#include "../../d_net.h"
|
||||
#include "../../m_argv.h"
|
||||
|
||||
#include "../../doomstat.h"
|
||||
|
||||
#include "../../i_net.h"
|
||||
|
||||
#include "../../z_zone.h"
|
||||
|
||||
#include "../../i_tcp.h"
|
||||
|
||||
#include <kos/net.h>
|
||||
//#include <net/net_ipv4.h>
|
||||
#define NET_NONE 0x00000000
|
||||
#define NET_LOCAL 0x0100007F
|
||||
#define NET_ANY 0xFFFFFFFF
|
||||
|
||||
#define MAXBANS 20
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 host;
|
||||
uint16 port;
|
||||
} IPaddress;
|
||||
|
||||
static IPaddress clientaddress[MAXNETNODES+1];
|
||||
static boolean nodeconnected[MAXNETNODES+1];
|
||||
|
||||
static int mysocket = 0;
|
||||
static boolean init_KOSUDP_driver = false;
|
||||
|
||||
static size_t numbans = 0;
|
||||
static IPaddress banned[MAXBANS];
|
||||
static boolean KOSUDP_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
|
||||
|
||||
static inline int net_udp_sendto(int sock, const uint8 *data, int size, uint16 rem_port, uint32 rem_addr)
|
||||
{
|
||||
uint8 dst_ip[4] = {((uint8*)(&(rem_addr)))[0],
|
||||
((uint8*)(&(rem_addr)))[1],
|
||||
((uint8*)(&(rem_addr)))[2],
|
||||
((uint8*)(&(rem_addr)))[3]};
|
||||
return net_udp_send_raw(net_default_dev, clientaddress[0].port, rem_port, dst_ip, data, size);
|
||||
(void)sock;
|
||||
}
|
||||
|
||||
static inline int net_udp_recvfrom(int sock, uint8 *buf, int size, uint16 *rem_port, uint32 *rem_addr)
|
||||
{
|
||||
return net_udp_recv(sock, buf, size);
|
||||
(void)rem_port;
|
||||
(void)rem_addr;
|
||||
}
|
||||
|
||||
static const char *KOSUDP_AddrToStr(IPaddress* sk)
|
||||
{
|
||||
static char s[22]; // 255.255.255.255:65535
|
||||
sprintf(s,"%d.%d.%d.%d:%d",
|
||||
((uint8*)(&(sk->host)))[3],
|
||||
((uint8*)(&(sk->host)))[2],
|
||||
((uint8*)(&(sk->host)))[1],
|
||||
((uint8*)(&(sk->host)))[0],
|
||||
net_ntohs(sk->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static const char *KOSUDP_GetNodeAddress(int node)
|
||||
{
|
||||
if (!nodeconnected[node])
|
||||
return NULL;
|
||||
return KOSUDP_AddrToStr(&clientaddress[node]);
|
||||
}
|
||||
|
||||
static const char *KOSUDP_GetBanAddress(size_t ban)
|
||||
{
|
||||
if (ban > numbans)
|
||||
return NULL;
|
||||
return KOSUDP_AddrToStr(&banned[ban]);
|
||||
}
|
||||
|
||||
static boolean KOSUDP_cmpaddr(IPaddress* a, IPaddress* b)
|
||||
{
|
||||
return (a->host == b->host && (b->port == 0 || a->port == b->port));
|
||||
}
|
||||
|
||||
static SINT8 getfreenode(void)
|
||||
{
|
||||
SINT8 j;
|
||||
|
||||
for (j = 0; j < MAXNETNODES; j++)
|
||||
if (!nodeconnected[j])
|
||||
{
|
||||
nodeconnected[j] = true;
|
||||
return j;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void KOSUDP_Get(void)
|
||||
{
|
||||
int size;
|
||||
size_t i;
|
||||
SINT8 j;
|
||||
IPaddress temp = {clientaddress[BROADCASTADDR].host,clientaddress[BROADCASTADDR].port};
|
||||
|
||||
size = net_udp_recvfrom(mysocket,(char *)&doomcom->data, MAXPACKETLENGTH, &temp.port, &temp.host);
|
||||
if (size == 0)
|
||||
{
|
||||
doomcom->remotenode = -1; // no packet
|
||||
return;
|
||||
}
|
||||
|
||||
// find remote node number
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
if (KOSUDP_cmpaddr(&temp, &(clientaddress[i])))
|
||||
{
|
||||
doomcom->remotenode = (INT16)i; // good packet from a game player
|
||||
doomcom->datalength = (INT16)size;
|
||||
return;
|
||||
}
|
||||
|
||||
// not found
|
||||
|
||||
// find a free slot
|
||||
j = getfreenode();
|
||||
if (j > 0)
|
||||
{
|
||||
M_Memcpy(&clientaddress[j], &temp, sizeof (temp));
|
||||
DEBFILE(va("New node detected: node:%d address:%s\n", j,
|
||||
KOSUDP_GetNodeAddress(j)));
|
||||
doomcom->remotenode = (INT16)j; // good packet from a game player
|
||||
doomcom->datalength = (INT16)size;
|
||||
// check if it's a banned dude so we can send a refusal later
|
||||
for (i = 0; i < numbans; i++)
|
||||
if (KOSUDP_cmpaddr(&temp, &banned[i]))
|
||||
{
|
||||
KOSUDP_bannednode[j] = true;
|
||||
DEBFILE("This dude has been banned\n");
|
||||
break;
|
||||
}
|
||||
if (i == numbans)
|
||||
KOSUDP_bannednode[j] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
DEBFILE("New node detected: No more free slots\n");
|
||||
doomcom->remotenode = -1; // no packet
|
||||
}
|
||||
|
||||
#if 0
|
||||
static boolean KOSUDP_CanSend(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void KOSUDP_Send(void)
|
||||
{
|
||||
const IPaddress *nodeinfo;
|
||||
|
||||
if (!doomcom->remotenode || !nodeconnected[doomcom->remotenode])
|
||||
return;
|
||||
|
||||
nodeinfo = clientaddress + doomcom->remotenode;
|
||||
|
||||
if (net_udp_sendto(mysocket, (char *)&doomcom->data, doomcom->datalength, nodeinfo->port, nodeinfo->host) == -1)
|
||||
{
|
||||
CONS_Printf("KOSUDP: error sending data\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void KOSUDP_FreeNodenum(int numnode)
|
||||
{
|
||||
// can't disconnect from self :)
|
||||
if (!numnode)
|
||||
return;
|
||||
|
||||
DEBFILE(va("Free node %d (%s)\n", numnode, KOSUDP_GetNodeAddress(numnode)));
|
||||
|
||||
nodeconnected[numnode] = false;
|
||||
|
||||
memset(&clientaddress[numnode], 0, sizeof (IPaddress));
|
||||
}
|
||||
|
||||
static int KOSUDP_Socket(void)
|
||||
{
|
||||
int temp = 0;
|
||||
uint16 portnum = 0;
|
||||
const uint32 hostip = net_default_dev?net_ntohl(net_ipv4_address(net_default_dev->ip_addr)):NET_LOCAL;
|
||||
//Hurdler: I'd like to put a server and a client on the same computer
|
||||
//Logan: Me too
|
||||
//BP: in fact for client we can use any free port we want i have read
|
||||
// in some doc that connect in udp can do it for us...
|
||||
//Alam: where?
|
||||
if (M_CheckParm("-clientport"))
|
||||
{
|
||||
if (!M_IsNextParm())
|
||||
I_Error("syntax: -clientport <portnum>");
|
||||
portnum = net_ntohs(atoi(M_GetNextParm()));
|
||||
}
|
||||
else
|
||||
portnum = net_ntohs(sock_port);
|
||||
|
||||
temp = net_udp_sock_open(portnum, hostip, portnum, NET_NONE);
|
||||
if (temp)
|
||||
{
|
||||
int btemp = net_udp_sock_open(portnum, hostip, portnum, NET_ANY);
|
||||
clientaddress[0].port = portnum;
|
||||
clientaddress[0].host = NET_NONE;
|
||||
if (btemp)
|
||||
{
|
||||
clientaddress[BROADCASTADDR].port = net_ntohs(sock_port);
|
||||
clientaddress[BROADCASTADDR].host = NET_ANY;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("KOSUDP: can't setup broadcast sock\n");
|
||||
net_udp_sock_close(temp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("KOSUDP: can't setup main sock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
doomcom->extratics = 1; // internet is very high ping
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void I_ShutdownKOSUDPDriver(void)
|
||||
{
|
||||
//net_shutdown();
|
||||
init_KOSUDP_driver = false;
|
||||
}
|
||||
|
||||
static void I_InitKOSUDPDriver(void)
|
||||
{
|
||||
if (init_KOSUDP_driver)
|
||||
I_ShutdownKOSUDPDriver();
|
||||
else
|
||||
net_init();
|
||||
D_SetDoomcom();
|
||||
memset(&clientaddress,0,sizeof (clientaddress));
|
||||
init_KOSUDP_driver = true;
|
||||
}
|
||||
|
||||
static void KOSUDP_CloseSocket(void)
|
||||
{
|
||||
if (mysocket)
|
||||
net_udp_sock_close(mysocket);
|
||||
mysocket = 0;
|
||||
}
|
||||
|
||||
static SINT8 KOSUDP_NetMakeNodewPort(const char *hostname, const char* port)
|
||||
{
|
||||
SINT8 newnode;
|
||||
uint16 portnum = net_ntohs(sock_port);
|
||||
|
||||
if (port && !port[0])
|
||||
portnum = net_ntohs((UINT16)atoi(port));
|
||||
|
||||
newnode = getfreenode();
|
||||
if (newnode == -1)
|
||||
return -1;
|
||||
// find ip of the server
|
||||
clientaddress[newnode].port = portnum;
|
||||
clientaddress[newnode].host = inet_addr(hostname);
|
||||
|
||||
if (clientaddress[newnode].host == NET_NONE)
|
||||
{
|
||||
free(hostname);
|
||||
return -1;
|
||||
}
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static boolean KOSUDP_OpenSocket(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
memset(clientaddress, 0, sizeof (clientaddress));
|
||||
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
nodeconnected[i] = false;
|
||||
|
||||
//CONS_Printf("KOSUDP Code starting up\n");
|
||||
|
||||
nodeconnected[0] = true; // always connected to self
|
||||
nodeconnected[BROADCASTADDR] = true;
|
||||
I_NetSend = KOSUDP_Send;
|
||||
I_NetGet = KOSUDP_Get;
|
||||
I_NetCloseSocket = KOSUDP_CloseSocket;
|
||||
I_NetFreeNodenum = KOSUDP_FreeNodenum;
|
||||
I_NetMakeNodewPort = KOSUDP_NetMakeNodewPort;
|
||||
|
||||
//I_NetCanSend = KOSUDP_CanSend;
|
||||
|
||||
// build the socket but close it first
|
||||
KOSUDP_CloseSocket();
|
||||
mysocket = KOSUDP_Socket();
|
||||
|
||||
if (mysocket)
|
||||
{
|
||||
#if 0
|
||||
// for select
|
||||
myset = SDLNet_AllocSocketSet(1);
|
||||
if (!myset)
|
||||
{
|
||||
CONS_Printf("SDL_Net: %s",SDLNet_GetError());
|
||||
return false;
|
||||
}
|
||||
if (SDLNet_UDP_AddSocket(myset,mysocket) == -1)
|
||||
{
|
||||
CONS_Printf("SDL_Net: %s",SDLNet_GetError());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean KOSUDP_Ban(int node)
|
||||
{
|
||||
if (numbans == MAXBANS)
|
||||
return false;
|
||||
|
||||
M_Memcpy(&banned[numbans], &clientaddress[node], sizeof (IPaddress));
|
||||
banned[numbans].port = 0'
|
||||
numbans++;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void KOSUDP_ClearBans(void)
|
||||
{
|
||||
numbans = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// I_InitNetwork
|
||||
// Only required for DOS, so this is more a dummy
|
||||
//
|
||||
boolean I_InitNetwork(void)
|
||||
{
|
||||
char serverhostname[255];
|
||||
boolean ret = false;
|
||||
//if (!M_CheckParm ("-kosnet"))
|
||||
// return false;
|
||||
// initilize the driver
|
||||
I_InitKOSUDPDriver();
|
||||
I_AddExitFunc(I_ShutdownKOSUDPDriver);
|
||||
if (!init_KOSUDP_driver)
|
||||
return false;
|
||||
|
||||
if (M_CheckParm("-udpport"))
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
sock_port = (UINT16)atoi(M_GetNextParm());
|
||||
else
|
||||
sock_port = 0;
|
||||
}
|
||||
|
||||
// parse network game options,
|
||||
if (M_CheckParm("-server") || dedicated)
|
||||
{
|
||||
server = true;
|
||||
|
||||
// If a number of clients (i.e. nodes) is specified, the server will wait for the clients
|
||||
// to connect before starting.
|
||||
// If no number is specified here, the server starts with 1 client, and others can join
|
||||
// in-game.
|
||||
// Since Boris has implemented join in-game, there is no actual need for specifying a
|
||||
// particular number here.
|
||||
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
|
||||
/* if (M_IsNextParm())
|
||||
doomcom->numnodes = (INT16)atoi(M_GetNextParm());
|
||||
else */if (dedicated)
|
||||
doomcom->numnodes = 0;
|
||||
else
|
||||
doomcom->numnodes = 1;
|
||||
|
||||
if (doomcom->numnodes < 0)
|
||||
doomcom->numnodes = 0;
|
||||
if (doomcom->numnodes > MAXNETNODES)
|
||||
doomcom->numnodes = MAXNETNODES;
|
||||
|
||||
// server
|
||||
servernode = 0;
|
||||
// FIXME:
|
||||
// ??? and now ?
|
||||
// server on a big modem ??? 4*isdn
|
||||
net_bandwidth = 16000;
|
||||
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
|
||||
|
||||
ret = true;
|
||||
}
|
||||
else if (M_CheckParm("-connect"))
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
strcpy(serverhostname, M_GetNextParm());
|
||||
else
|
||||
serverhostname[0] = 0; // assuming server in the LAN, use broadcast to detect it
|
||||
|
||||
// server address only in ip
|
||||
if (serverhostname[0])
|
||||
{
|
||||
COM_BufAddText("connect \"");
|
||||
COM_BufAddText(serverhostname);
|
||||
COM_BufAddText("\"\n");
|
||||
|
||||
// probably modem
|
||||
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
// so we're on a LAN
|
||||
COM_BufAddText("connect any\n");
|
||||
|
||||
net_bandwidth = 800000;
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
I_NetOpenSocket = KOSUDP_OpenSocket;
|
||||
I_Ban = KOSUDP_Ban;
|
||||
I_ClearBans = KOSUDP_ClearBans;
|
||||
I_GetNodeAddress = KOSUDP_GetNodeAddress;
|
||||
I_GetBanAddress = KOSUDP_GetBanAddress;
|
||||
bannednode = KOSUDP_bannednode;
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -1,259 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAXCHUNK (2048*1024)
|
||||
|
||||
static unsigned int seed;
|
||||
|
||||
void my_srand(unsigned int n)
|
||||
{
|
||||
seed = n & 0xffff;
|
||||
}
|
||||
|
||||
unsigned int my_rand()
|
||||
{
|
||||
seed = (seed * 2109 + 9273) & 0x7fff;
|
||||
return (seed + 0xc000) & 0xffff;
|
||||
}
|
||||
|
||||
void load(FILE *fh, unsigned char *ptr, unsigned long sz)
|
||||
{
|
||||
if (fread(ptr, 1, sz, fh) != sz)
|
||||
{
|
||||
fprintf(stderr, "Read error!\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void load_chunk(FILE *fh, unsigned char *ptr, unsigned long sz)
|
||||
{
|
||||
static int idx[MAXCHUNK/32];
|
||||
int i;
|
||||
|
||||
/* Convert chunk size to number of slices */
|
||||
sz /= 32;
|
||||
|
||||
/* Initialize index table with unity,
|
||||
so that each slice gets loaded exactly once */
|
||||
for (i = 0; i < sz; i++)
|
||||
idx[i] = i;
|
||||
|
||||
for (i = sz-1; i >= 0; --i)
|
||||
{
|
||||
/* Select a replacement index */
|
||||
int x = (my_rand() * i) >> 16;
|
||||
|
||||
/* Swap */
|
||||
int tmp = idx[i];
|
||||
idx[i] = idx[x];
|
||||
idx[x] = tmp;
|
||||
|
||||
/* Load resulting slice */
|
||||
load(fh, ptr+32*idx[i], 32);
|
||||
}
|
||||
}
|
||||
|
||||
void load_file(FILE *fh, unsigned char *ptr, unsigned long filesz)
|
||||
{
|
||||
unsigned long chunksz;
|
||||
|
||||
my_srand(filesz);
|
||||
|
||||
/* Descramble 2 meg blocks for as long as possible, then
|
||||
gradually reduce the window down to 32 bytes (1 slice) */
|
||||
for (chunksz = MAXCHUNK; chunksz >= 32; chunksz >>= 1)
|
||||
while (filesz >= chunksz)
|
||||
{
|
||||
load_chunk(fh, ptr, chunksz);
|
||||
filesz -= chunksz;
|
||||
ptr += chunksz;
|
||||
}
|
||||
|
||||
/* Load final incomplete slice */
|
||||
if (filesz)
|
||||
load(fh, ptr, filesz);
|
||||
}
|
||||
|
||||
void read_file(char *filename, unsigned char **ptr, unsigned long *sz)
|
||||
{
|
||||
FILE *fh = fopen(filename, "rb");
|
||||
if (fh == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open \"%s\".\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
if (fseek(fh, 0, SEEK_END)<0)
|
||||
{
|
||||
fprintf(stderr, "Seek error.\n");
|
||||
exit(1);
|
||||
}
|
||||
*sz = ftell(fh);
|
||||
*ptr = malloc(*sz);
|
||||
if ( *ptr == NULL )
|
||||
{
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
exit(1);
|
||||
}
|
||||
if (fseek(fh, 0, SEEK_SET)<0)
|
||||
{
|
||||
fprintf(stderr, "Seek error.\n");
|
||||
exit(1);
|
||||
}
|
||||
load_file(fh, *ptr, *sz);
|
||||
fclose(fh);
|
||||
}
|
||||
|
||||
void save(FILE *fh, unsigned char *ptr, unsigned long sz)
|
||||
{
|
||||
if (fwrite(ptr, 1, sz, fh) != sz)
|
||||
{
|
||||
fprintf(stderr, "Write error!\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void save_chunk(FILE *fh, unsigned char *ptr, unsigned long sz)
|
||||
{
|
||||
static int idx[MAXCHUNK/32];
|
||||
int i;
|
||||
|
||||
/* Convert chunk size to number of slices */
|
||||
sz /= 32;
|
||||
|
||||
/* Initialize index table with unity,
|
||||
so that each slice gets saved exactly once */
|
||||
for (i = 0; i < sz; i++)
|
||||
idx[i] = i;
|
||||
|
||||
for (i = sz-1; i >= 0; --i)
|
||||
{
|
||||
/* Select a replacement index */
|
||||
int x = (my_rand() * i) >> 16;
|
||||
|
||||
/* Swap */
|
||||
int tmp = idx[i];
|
||||
idx[i] = idx[x];
|
||||
idx[x] = tmp;
|
||||
|
||||
/* Save resulting slice */
|
||||
save(fh, ptr+32*idx[i], 32);
|
||||
}
|
||||
}
|
||||
|
||||
void save_file(FILE *fh, unsigned char *ptr, unsigned long filesz)
|
||||
{
|
||||
unsigned long chunksz;
|
||||
|
||||
my_srand(filesz);
|
||||
|
||||
/* Descramble 2 meg blocks for as long as possible, then
|
||||
gradually reduce the window down to 32 bytes (1 slice) */
|
||||
for (chunksz = MAXCHUNK; chunksz >= 32; chunksz >>= 1)
|
||||
while (filesz >= chunksz)
|
||||
{
|
||||
save_chunk(fh, ptr, chunksz);
|
||||
filesz -= chunksz;
|
||||
ptr += chunksz;
|
||||
}
|
||||
|
||||
/* Save final incomplete slice */
|
||||
if (filesz)
|
||||
save(fh, ptr, filesz);
|
||||
}
|
||||
|
||||
void write_file(char *filename, unsigned char *ptr, unsigned long sz)
|
||||
{
|
||||
FILE *fh = fopen(filename, "wb");
|
||||
if (fh == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open \"%s\".\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
save_file(fh, ptr, sz);
|
||||
fclose(fh);
|
||||
}
|
||||
|
||||
void descramble(char *src, char *dst)
|
||||
{
|
||||
unsigned char *ptr = NULL;
|
||||
unsigned long sz = 0;
|
||||
FILE *fh;
|
||||
|
||||
read_file(src, &ptr, &sz);
|
||||
|
||||
fh = fopen(dst, "wb");
|
||||
if (fh == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open \"%s\".\n", dst);
|
||||
exit(1);
|
||||
}
|
||||
if ( fwrite(ptr, 1, sz, fh) != sz )
|
||||
{
|
||||
fprintf(stderr, "Write error.\n");
|
||||
exit(1);
|
||||
}
|
||||
fclose(fh);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void scramble(char *src, char *dst)
|
||||
{
|
||||
unsigned char *ptr = NULL;
|
||||
unsigned long sz = 0;
|
||||
FILE *fh;
|
||||
|
||||
fh = fopen(src, "rb");
|
||||
if (fh == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open \"%s\".\n", src);
|
||||
exit(1);
|
||||
}
|
||||
if (fseek(fh, 0, SEEK_END)<0)
|
||||
{
|
||||
fprintf(stderr, "Seek error.\n");
|
||||
exit(1);
|
||||
}
|
||||
sz = ftell(fh);
|
||||
ptr = malloc(sz);
|
||||
if ( ptr == NULL )
|
||||
{
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
exit(1);
|
||||
}
|
||||
if (fseek(fh, 0, SEEK_SET)<0)
|
||||
{
|
||||
fprintf(stderr, "Seek error.\n");
|
||||
exit(1);
|
||||
}
|
||||
if ( fread(ptr, 1, sz, fh) != sz )
|
||||
{
|
||||
fprintf(stderr, "Read error.\n");
|
||||
exit(1);
|
||||
}
|
||||
fclose(fh);
|
||||
|
||||
write_file(dst, ptr, sz);
|
||||
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int opt = 0;
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-d"))
|
||||
opt ++;
|
||||
|
||||
if (argc != 3+opt)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [-d] from to\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (opt)
|
||||
descramble(argv[2], argv[3]);
|
||||
else
|
||||
scramble(argv[1], argv[2]);
|
||||
|
||||
return 0;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
|
@ -1,139 +0,0 @@
|
|||
#
|
||||
# Makefile.cfg for SRB2 for the PlayStation 3 using PSL1GHT
|
||||
#
|
||||
|
||||
# Check if PS3DEV and PSL1GHT is set in the environment. If so, continue with compilation.
|
||||
.SUFFIXES:
|
||||
|
||||
ifeq ($(strip $(PS3DEV)),)
|
||||
$(error "Please set PS3DEV in your environment. export PS3DEV=<path to>ps3dev-toolchain")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(PSL1GHT)),)
|
||||
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path to>PSL1GHT")
|
||||
endif
|
||||
|
||||
# Set compiler flags
|
||||
|
||||
# Disable same warning flags
|
||||
WFLAGS+=-Wno-shadow -Wno-char-subscripts -Wno-format
|
||||
|
||||
ifdef JAILBREAK
|
||||
EXENAME?=SRB2PS3-jb.elf
|
||||
PKGNAME?=SRB2PS3-jb.pkg
|
||||
else
|
||||
EXENAME?=SRB2PS3.elf
|
||||
PKGNAME?=SRB2PS3.pkg
|
||||
endif
|
||||
DGBNAME?=$(EXENAME).debug
|
||||
|
||||
SRB2PS3DIR=sdl/SRB2PS3
|
||||
ICON0?=$(SRB2PS3DIR)/ICON0.png
|
||||
SFOXML?=sfo.xml
|
||||
SRB2TTF?=sdl/srb2.ttf
|
||||
|
||||
TITLE=Sonic Robo Blast 2 v2.0.6
|
||||
APPID=SRB2-PS3
|
||||
CONTENTID=UP0001-$(APPID)_00-0000000000000000
|
||||
|
||||
FSELF=$(PS3DEV)/bin/fself.py
|
||||
MAKE_SELF_NPDRM=$(PS3DEV)/ps3publictools/make_self_npdrm
|
||||
FINALIZE=$(PS3DEV)/ps3publictools/package_finalize
|
||||
SFO=$(PS3DEV)/bin/sfo.py
|
||||
PKG=$(PS3DEV)/bin/pkg.py
|
||||
PS3LOADEXE=$(PS3DEV)/ps3tools/ps3load
|
||||
SED=sed
|
||||
MV=mv
|
||||
XARGS=xargs
|
||||
FOR=for
|
||||
SHXARGS:=$(XARGS)
|
||||
SHSED:=$(SED)
|
||||
SPRXLINKER=$(PS3DEV)/bin/sprxlinker
|
||||
|
||||
ifdef JAILBREAK
|
||||
PKGDIR=$(BIN)/pkg-jb
|
||||
else
|
||||
PKGDIR=$(BIN)/pkg
|
||||
endif
|
||||
USRDIR=$(PKGDIR)/USRDIR
|
||||
ETCDIR=$(USRDIR)/etc
|
||||
WGET=wget -P $(ETCDIR) -c -nc
|
||||
|
||||
ifndef ECHO
|
||||
FSELF:=@$(FSELF)
|
||||
MAKE_SELF_NPDRM:=@$(MAKE_SELF_NPDRM)
|
||||
FINALIZE:=@$(FINALIZE)
|
||||
SFO:=@$(SFO)
|
||||
PKG:=@$(PKG)
|
||||
PS3LOADEXE:=@$(PS3LOADEXE)
|
||||
SED:=@$(SED)
|
||||
MV:=@$(MV)
|
||||
SPRXLINKER:=@$(SPRXLINKER)
|
||||
XARGS:=@$(XARGS)
|
||||
FOR:=@(FOR)
|
||||
endif
|
||||
|
||||
# SRB2PS3 needs SDL_ttf to display any console text
|
||||
SDL_TTF=1
|
||||
|
||||
# newlib has no support for networking
|
||||
#NONET=1
|
||||
|
||||
# use absolute paths because changing PATH variable breaks distcc
|
||||
PREFIX := $(PS3DEV)/ppu/bin/$(PREFIX)
|
||||
|
||||
# PS3DEV toolchain libdir and includedir
|
||||
PS3DEV_INC := $(PS3DEV)/ppu/include
|
||||
PS3DEV_LIB := $(PS3DEV)/ppu/lib
|
||||
|
||||
# PSL1GHT libdir and includedir
|
||||
PSL1GHT_INC := $(PSL1GHT)/ppu/include
|
||||
PSL1GHT_LIB := $(PSL1GHT)/ppu/lib
|
||||
|
||||
PS3PORTS := $(PS3DEV)/portlibs
|
||||
PS3PORTS_BIN := $(PS3PORTS)/ppu/bin
|
||||
PS3PORTS_INC := $(PS3PORTS)/ppu/include
|
||||
|
||||
PNG_CONFIG := $(PS3PORTS_BIN)/libpng-config
|
||||
# static compilation
|
||||
PNG_STATIC=1
|
||||
|
||||
SDL_CONFIG := $(PS3PORTS_BIN)/sdl-config
|
||||
|
||||
INCLUDE := -I$(PSL1GHT_INC) -I$(PS3DEV_INC) -I$(PS3PORTS_INC)
|
||||
|
||||
OPTS+=-D_PS3 -DUNIXCOMMON
|
||||
CFLAGS+= -g $(INCLUDE) -L$(PSL1GHT_LIB) -L$(PS3DEV_LIB) -L$(PS3DEV)/lib
|
||||
CXXFLAGS+=$(CFLAGS)
|
||||
LDFLAGS+= -B$(PSL1GHT_LIB) -B$(PS3DEV_LIB) -B$(PS3DEV)/lib
|
||||
LIBS+=-lrsx
|
||||
ifndef NONET
|
||||
LIBS+=-lnet -lsysmodule
|
||||
endif
|
||||
|
||||
$(BIN)/$(PKGNAME): $(OBJS) $(BIN)/$(EXENAME)
|
||||
@echo Linking $(PKGNAME)...
|
||||
-$(MKDIR) $(ETCDIR)
|
||||
$(CP) $(ICON0) $(PKGDIR)
|
||||
$(CP) $(SRB2TTF) $(ETCDIR)
|
||||
ifdef WITHDATA
|
||||
$(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) 's/\.srb/\.wad/' | $(SHXARGS) -n 1 basename); do \
|
||||
$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \
|
||||
done
|
||||
endif
|
||||
$(SPRXLINKER) $(BIN)/$(EXENAME)
|
||||
ifdef JAILBREAK
|
||||
$(SED) 's/@@PS3_SYSTEM_VER@@/3.41/' $(SRB2PS3DIR)/$(SFOXML) > $(BIN)/$(SFOXML)
|
||||
$(FSELF) -n $(BIN)/$(EXENAME) $(USRDIR)/EBOOT.BIN
|
||||
else
|
||||
$(SED) 's/@@PS3_SYSTEM_VER@@/3.55/' $(SRB2PS3DIR)/$(SFOXML) > $(BIN)/$(SFOXML)
|
||||
$(MAKE_SELF_NPDRM) $(BIN)/$(EXENAME) $(USRDIR)/EBOOT.BIN $(CONTENTID)
|
||||
endif
|
||||
$(SFO) --title "$(TITLE)" --appid "$(APPID)" -f $(BIN)/$(SFOXML) $(PKGDIR)/PARAM.SFO
|
||||
$(PKG) --contentid $(CONTENTID) $(PKGDIR)/ $(BIN)/$(PKGNAME)
|
||||
ifndef JAILBREAK
|
||||
$(FINALIZE) $(BIN)/$(PKGNAME)
|
||||
endif
|
||||
|
||||
run: $(BIN)/$(EXENAME)
|
||||
$(PS3LOADEXE) $(USRDIR)/EBOOT.BIN
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<sfo>
|
||||
<value name="APP_VER" type="string">
|
||||
02.06
|
||||
</value>
|
||||
<value name="ATTRIBUTE" type="integer">
|
||||
0
|
||||
</value>
|
||||
<value name="BOOTABLE" type="integer">
|
||||
1
|
||||
</value>
|
||||
<value name="CATEGORY" type="string">
|
||||
HG
|
||||
</value>
|
||||
<value name="LICENSE" type="string">
|
||||
This application was created with the official non-official SDK called PSL1GHT, for more information visit http://www.psl1ght.com/ . This is in no way associated with Sony Computer Entertainment Inc., please do not contact them for help, they will not be able to provide it.
|
||||
</value>
|
||||
<value name="PARENTAL_LEVEL" type="integer">
|
||||
0
|
||||
</value>
|
||||
<value name="PS3_SYSTEM_VER" type="string">
|
||||
0@@PS3_SYSTEM_VER@@00
|
||||
</value>
|
||||
<value name="RESOLUTION" type="integer">
|
||||
63
|
||||
</value>
|
||||
<value name="SOUND_FORMAT" type="integer">
|
||||
279
|
||||
</value>
|
||||
<value name="TITLE" type="string">
|
||||
Sonic Robo Blast 2
|
||||
</value>
|
||||
<value name="TITLE_ID" type="string">
|
||||
SRB200000
|
||||
</value>
|
||||
<value name="VERSION" type="string">
|
||||
02.06
|
||||
</value>
|
||||
</sfo>
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
|
@ -1,126 +0,0 @@
|
|||
#
|
||||
# Makefile.cfg for SRB2/PSP
|
||||
#
|
||||
|
||||
#
|
||||
#hmmm, the PSP
|
||||
#
|
||||
|
||||
PSPSDK=$(shell psp-config -p)
|
||||
PSPDEV=$(shell psp-config -d)
|
||||
PSPPREFIX=$(shell psp-config -P)
|
||||
STRIP=psp-strip
|
||||
MKSFO?=mksfoex -d MEMSIZE=1
|
||||
#MKSFO=mksfo
|
||||
PACK_PBP=pack-pbp
|
||||
FIXUP=psp-fixup-imports
|
||||
HOSTCC:=$(CC)
|
||||
CC=$(PSPDEV)/bin/psp-gcc
|
||||
OBJCOPY=psp-objcopy
|
||||
OBJDUMP=psp-objdump
|
||||
ifdef FIXEDPRX
|
||||
PRXGEN=psp-prxgen
|
||||
else
|
||||
PRXGEN=$(OBJCOPY)
|
||||
endif
|
||||
ifndef PRXSIGN
|
||||
SIGNER:=$(PSPDEV)/bin/$(OBJCOPY)
|
||||
endif
|
||||
|
||||
ifndef ECHO
|
||||
MKSFO:=@$(MKSFO)
|
||||
PACK_PBP:=@$(PACK_PBP)
|
||||
FIXUP:=@$(FIXUP)
|
||||
PRXGEN:=@$(PRXGEN)
|
||||
endif
|
||||
|
||||
PSP_EBOOT_TITLE=SRB2-PSP vME
|
||||
PSP_EBOOT_SFO=$(BIN)/PARAM.SFO
|
||||
PSP_EBOOT_ICON=sdl/SRB2PSP/ICON0.png
|
||||
PSP_EBOOT_ICON1=NULL
|
||||
PSP_EBOOT_UNKPNG=NULL
|
||||
PSP_EBOOT_PIC1=sdl/SRB2PSP/PIC1.png
|
||||
PSP_EBOOT_SND0=NULL
|
||||
PSP_EBOOT_PSAR=NULL
|
||||
|
||||
SIGNER?=sdl/SRB2PSP/psp-prxsign/psp-prxsign
|
||||
|
||||
SDL=1
|
||||
PREFIX=psp
|
||||
NONX86=1
|
||||
#NOHW=1
|
||||
NOHS=1
|
||||
NOMD5=1
|
||||
NONET=1 #No TCPIP code
|
||||
NOPNG=1 #No Screenshot
|
||||
|
||||
OPTS=-I$(PSPPREFIX)/include -I$(PSPSDK)/include
|
||||
OPTS+=-DUNIXCOMMON -DFORCESDLMAIN -G0
|
||||
WFLAGS+=-Wno-undef
|
||||
WFLAGS+=-O1
|
||||
LIBS=-lm
|
||||
SDL_CONFIG?=$(PSPPREFIX)/bin/sdl-config
|
||||
#SDL_CFLAGS?=-I$(PSPDEV)/psp/include/SDL
|
||||
#SDL_LDFLAGS?=-lSDLmain -lSDL -lglut -lGLU -lGL -lpspgu -lpspaudiolib -lpspaudio -lpsphprm -lpspvfpu -lpsprtc
|
||||
ifndef NOMIXER
|
||||
LIBS:=-liberty -lvorbisfile -lvorbis -logg -lSDL $(LIBS)
|
||||
endif
|
||||
ifndef NOHW
|
||||
OPTS+=-DSTATIC_OPENGL -DMINI_GL_COMPATIBILITY
|
||||
LIBS+=-lGLU -lGL -lm
|
||||
endif
|
||||
#PSPSDK_LIBS=-L$(PSPSDK)/lib -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
|
||||
#LIBS+=$(PSPSDK_LIBS) -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel
|
||||
ifdef FIXEDPRX
|
||||
LDFLAGS := -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx $(LDFLAGS)
|
||||
LIBS+=$(PSPSDK)/lib/prxexports.o
|
||||
endif
|
||||
|
||||
ifeq ($(PSP_FW_VERSION),)
|
||||
PSP_FW_VERSION=150
|
||||
endif
|
||||
|
||||
CPPFLAGS:=-D_PSP_FW_VERSION=$(PSP_FW_VERSION) $(CPPFLAGS)
|
||||
|
||||
|
||||
# name of the exefile
|
||||
EXENAME?=SRB2PSP.elf
|
||||
PRXNAME?=SRB2PSP.prx
|
||||
DBGNAME?=SRB2PSP.debug
|
||||
|
||||
post-build: $(BIN)/EBOOT.PBP
|
||||
|
||||
kxploit: $(BIN)/$(EXENAME) $(PSP_EBOOT_SFO)
|
||||
-$(MKDIR) "$(BIN)/kxploit/srb2"
|
||||
@echo emitting kxploit/srb2/
|
||||
$(STRIP) $(BIN)/$(EXENAME) -o $(BIN)/kxploit/srb2/EBOOT.PBP
|
||||
@echo emitting kxploit/srb2%
|
||||
-$(MKDIR) "$(BIN)/kxploit/srb2%/"
|
||||
$(PACK_PBP) "$(BIN)/kxploit/srb2%/EBOOT.PBP" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
|
||||
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
|
||||
$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
|
||||
|
||||
sdl/SRB2PSP/psp-prxsign/psp-prxsign:
|
||||
-$(MAKE) -C sdl/SRB2PSP/psp-prxsign CFLAGS=-pipe CC="$(HOSTCC)"
|
||||
|
||||
fix-up: $(BIN)/$(EXENAME)
|
||||
@echo Running psp-fixup-imports on $(EXENAME)
|
||||
$(FIXUP) $(BIN)/$(EXENAME)
|
||||
|
||||
$(BIN)/$(PRXNAME): $(BIN)/$(EXENAME) fix-up
|
||||
@echo Building $(PRXNAME) out of $(EXENAME)
|
||||
$(PRXGEN) $(BIN)/$(EXENAME) $@
|
||||
|
||||
$(BIN)/EBOOT.PBP: $(BIN)/$(PRXNAME) $(SIGNER) $(PSP_EBOOT_SFO)
|
||||
@echo Signing and running pack-pbp to make PBP
|
||||
$(SIGNER) $(BIN)/$(PRXNAME) $(BIN)/$(PRXNAME).sign
|
||||
$(PACK_PBP) $@ $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
|
||||
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
|
||||
$(PSP_EBOOT_SND0) $(BIN)/$(PRXNAME).sign $(PSP_EBOOT_PSAR)
|
||||
$(REMOVE) $(BIN)/$(PRXNAME).sign
|
||||
|
||||
$(PSP_EBOOT_SFO):
|
||||
-$(MKDIR) $(BIN)
|
||||
$(MKSFO) '$(PSP_EBOOT_TITLE)' $@
|
||||
|
||||
#include $(PSPSDK)/lib/build.mak
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
2
src/sdl2/SRB2PSP/psp-prxsign/.gitignore
vendored
2
src/sdl2/SRB2PSP/psp-prxsign/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
/psp-prxsign
|
||||
/psp-prxsign.exe
|
|
@ -1,22 +0,0 @@
|
|||
EXE=psp-prxsign
|
||||
SRC=main.c cmac.c
|
||||
OBJ=$(SRC:.c=.o)# replaces the .c from SRC with .o
|
||||
|
||||
OPENSSL_PKGCONFIG?=openssl
|
||||
OPENSSL_CFLAGS?=$(shell pkg-config $(OPENSSL_PKGCONFIG) --cflags)
|
||||
OPENSSL_LDFLAGS?=$(shell pkg-config $(OPENSSL_PKGCONFIG) --libs)
|
||||
|
||||
CFLAGS+=$(OPENSSL_CFLAGS)
|
||||
LDFLAGS+=$(OPENSSL_LDFLAGS)
|
||||
|
||||
.PHONY : all # .PHONY ignores files named all
|
||||
|
||||
all: $(EXE) # all is dependent on $(BIN) to be complete
|
||||
|
||||
|
||||
$(EXE): $(OBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
.PHONY : clean # .PHONY ignores files named clean
|
||||
clean:
|
||||
-$(RM) $(OBJ) $(EXE)
|
|
@ -1,130 +0,0 @@
|
|||
#include "cmac.h"
|
||||
|
||||
#define AES_128 0
|
||||
unsigned char const_Rb[16] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87
|
||||
};
|
||||
unsigned char const_Zero[16] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
void xor_128(unsigned char *a, unsigned char *b, unsigned char *out)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<16; i++)
|
||||
{
|
||||
out[i] = a[i] ^ b[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* AES-CMAC Generation Function */
|
||||
|
||||
static inline void leftshift_onebit(unsigned char *input,unsigned char *output)
|
||||
{
|
||||
int i;
|
||||
unsigned char overflow = 0;
|
||||
|
||||
for ( i=15; i>=0; i-- )
|
||||
{
|
||||
output[i] = input[i] << 1;
|
||||
output[i] |= overflow;
|
||||
overflow = (input[i] & 0x80)?1:0;
|
||||
}
|
||||
}
|
||||
|
||||
void generate_subkey(unsigned char *key, unsigned char *K1, unsigned char *K2)
|
||||
{
|
||||
unsigned char L[16];
|
||||
unsigned char Z[16];
|
||||
unsigned char tmp[16];
|
||||
int i;
|
||||
|
||||
for ( i=0; i<16; i++ ) Z[i] = 0;
|
||||
|
||||
AES_KEY aes;
|
||||
AES_set_encrypt_key(key, 128, &aes);
|
||||
|
||||
AES_encrypt(Z, L, &aes);
|
||||
|
||||
if ( (L[0] & 0x80) == 0 ) /* If MSB(L) = 0, then K1 = L << 1 */
|
||||
{
|
||||
leftshift_onebit(L,K1);
|
||||
} else { /* Else K1 = ( L << 1 ) (+) Rb */
|
||||
leftshift_onebit(L,tmp);
|
||||
xor_128(tmp,const_Rb,K1);
|
||||
}
|
||||
|
||||
if ( (K1[0] & 0x80) == 0 )
|
||||
{
|
||||
leftshift_onebit(K1,K2);
|
||||
} else {
|
||||
leftshift_onebit(K1,tmp);
|
||||
xor_128(tmp,const_Rb,K2);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void padding ( unsigned char *lastb, unsigned char *pad, int length )
|
||||
{
|
||||
int j;
|
||||
|
||||
/* original last block */
|
||||
for ( j=0; j<16; j++ )
|
||||
{
|
||||
if ( j < length )
|
||||
{
|
||||
pad[j] = lastb[j];
|
||||
} else if ( j == length ) {
|
||||
pad[j] = 0x80;
|
||||
} else {
|
||||
pad[j] = 0x00;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AES_CMAC ( unsigned char *key, unsigned char *input, int length, unsigned char *mac )
|
||||
{
|
||||
unsigned char X[16],Y[16], M_last[16], padded[16];
|
||||
unsigned char K1[16], K2[16];
|
||||
int n, i, flag;
|
||||
generate_subkey(key,K1,K2);
|
||||
|
||||
n = (length+15) / 16; /* n is number of rounds */
|
||||
|
||||
if ( n == 0 )
|
||||
{
|
||||
n = 1;
|
||||
flag = 0;
|
||||
} else {
|
||||
if ( (length%16) == 0 ) { /* last block is a complete block */
|
||||
flag = 1;
|
||||
} else { /* last block is not complete block */
|
||||
flag = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( flag ) { /* last block is complete block */
|
||||
xor_128(&input[16*(n-1)],K1,M_last);
|
||||
} else {
|
||||
padding(&input[16*(n-1)],padded,length%16);
|
||||
xor_128(padded,K2,M_last);
|
||||
}
|
||||
AES_KEY aes;
|
||||
AES_set_encrypt_key(key, 128, &aes);
|
||||
|
||||
for ( i=0; i<16; i++ ) X[i] = 0;
|
||||
for ( i=0; i<n-1; i++ )
|
||||
{
|
||||
xor_128(X,&input[16*i],Y); /* Y := Mi (+) X */
|
||||
AES_encrypt(Y, X, &aes); /* X := AES-128(KEY, Y); */
|
||||
}
|
||||
|
||||
xor_128(X,M_last,Y);
|
||||
AES_encrypt(Y, X, &aes);
|
||||
|
||||
for ( i=0; i<16; i++ ) {
|
||||
mac[i] = X[i];
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
|
||||
|
||||
LICENSE TERMS
|
||||
|
||||
The redistribution and use of this software (with or without changes)
|
||||
is allowed without the payment of fees or royalties provided that:
|
||||
|
||||
1. source code distributions include the above copyright notice, this
|
||||
list of conditions and the following disclaimer;
|
||||
|
||||
2. binary distributions include the above copyright notice, this list
|
||||
of conditions and the following disclaimer in their documentation;
|
||||
|
||||
3. the name of the copyright holder is not used to endorse products
|
||||
built using this software without specific written permission.
|
||||
|
||||
DISCLAIMER
|
||||
|
||||
This software is provided 'as is' with no explicit or implied warranties
|
||||
in respect of its properties, including, but not limited to, correctness
|
||||
and/or fitness for purpose.
|
||||
---------------------------------------------------------------------------
|
||||
Issue Date: 6/10/2008
|
||||
*/
|
||||
|
||||
#ifndef CMAC_AES_H
|
||||
#define CMAC_AES_H
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/aes.h>
|
||||
|
||||
void xor_128(unsigned char *a, unsigned char *b, unsigned char *out);
|
||||
void generate_subkey(unsigned char *key, unsigned char *K1, unsigned char *K2);
|
||||
void AES_CMAC(unsigned char *key, unsigned char *input, int length, unsigned char *mac);
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef __kirk_header__
|
||||
#define __kirk_header__
|
||||
|
||||
static unsigned int size_kirk_header = 272;
|
||||
static unsigned char kirk_header[] __attribute__((aligned(16))) = {
|
||||
0x2a, 0x4f, 0x3c, 0x49, 0x8a, 0x73, 0x4e, 0xd1, 0xf4, 0x55, 0x93, 0x0b, 0x9b, 0x69, 0xdc, 0x65,
|
||||
0x73, 0x22, 0x69, 0xd3, 0x73, 0x96, 0x7a, 0x60, 0x66, 0x8c, 0x88, 0xcf, 0x2f, 0x83, 0x58, 0xbc,
|
||||
0xb2, 0x00, 0x0a, 0x11, 0x72, 0x43, 0xc5, 0xde, 0xef, 0xbb, 0x2c, 0xbf, 0x97, 0x79, 0x6b, 0x9c,
|
||||
0x10, 0x1e, 0x7c, 0x57, 0x0e, 0xdb, 0x1d, 0x61, 0x6e, 0xb5, 0xf9, 0x3d, 0x35, 0xe9, 0x5c, 0xd8,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x33, 0x55, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7e, 0x50, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x22, 0x74, 0x69, 0x66, 0x70, 0x73,
|
||||
0x70, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x33, 0x55, 0x00, 0x50, 0x34, 0x55, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x67, 0x3d, 0x00, 0x50, 0x55, 0x0a, 0x01, 0x10, 0x00, 0x40, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6b, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4c, 0x6b, 0x3d, 0x00, 0xcc, 0xbb, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,190 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <elf.h>
|
||||
#include "cmac.h"
|
||||
#include "kirk_header.h"
|
||||
#include "psp_header.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
typedef struct {
|
||||
byte key[16];
|
||||
byte ckey[16];
|
||||
byte head_hash[16];
|
||||
byte data_hash[16];
|
||||
byte unused[32];
|
||||
int unk1; // 1
|
||||
int unk2; // 0
|
||||
int unk3[2];
|
||||
int datasize;
|
||||
int dataoffset;
|
||||
int unk4[6];
|
||||
} kirk1head_t;
|
||||
|
||||
// secret kirk command 1 key
|
||||
byte kirk_key[] = {
|
||||
0x98, 0xc9, 0x40, 0x97, 0x5c, 0x1d, 0x10, 0xe8, 0x7f, 0xe6, 0x0e, 0xa3, 0xfd, 0x03, 0xa8, 0xba
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, relrem, size, fullsize, blocks, datasize;
|
||||
size_t j;
|
||||
kirk1head_t kirk;
|
||||
byte iv[16];
|
||||
byte cmac[32];
|
||||
byte subk[32];
|
||||
byte psph[0x150];
|
||||
byte *datablob;
|
||||
byte *filebuff;
|
||||
FILE *f;
|
||||
AES_KEY aesKey;
|
||||
Elf32_Ehdr *ehdr;
|
||||
Elf32_Shdr *shdr;
|
||||
Elf32_Rel *relo;
|
||||
|
||||
if(argc < 3) {
|
||||
printf("Usage: %s unsigned.prx signed.prx\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// clean kirk header, use modified PRXdecrypter to get it
|
||||
/*f = fopen(argv[1], "rb");
|
||||
if(!f) {
|
||||
printf("failed to open %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
fread(&kirk, 1, sizeof(kirk1head_t), f);
|
||||
fclose(f);*/
|
||||
//memcpy(&kirk, kirk_header, size_kirk_header);
|
||||
memcpy(&kirk, kirk_header, sizeof(kirk1head_t));
|
||||
|
||||
datasize = kirk.datasize;
|
||||
if(datasize % 16) datasize += 16 - (datasize % 16);
|
||||
|
||||
// original ~PSP header
|
||||
/*f = fopen(argv[2], "rb");
|
||||
if(!f) {
|
||||
free(datablob);
|
||||
printf("failed to open %s\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
fread(psph, 1, 0x150, f);
|
||||
fclose(f);*/
|
||||
memcpy(&psph, psp_header, size_psp_header);
|
||||
|
||||
// file to encrypt
|
||||
f = fopen(argv[1], "rb");
|
||||
if(!f) {
|
||||
printf("psp-prxsign: Unable to open PRX\n");
|
||||
return 1;
|
||||
}
|
||||
fseek(f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
if(size > datasize - 16) {
|
||||
fclose(f);
|
||||
printf("psp-prxsign: PRX is too large\n");
|
||||
return 1;
|
||||
}
|
||||
printf("%s : %i\n", argv[1], size);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
fullsize = datasize + 0x30 + kirk.dataoffset;
|
||||
|
||||
// datablob holds everything needed to calculate data HASH
|
||||
datablob = malloc(fullsize);
|
||||
if(!datablob) {
|
||||
fclose(f);
|
||||
printf("psp-prxsign: Failed to allocate memory for blob\n");
|
||||
return 1;
|
||||
}
|
||||
memset(datablob, 0, fullsize);
|
||||
memcpy(datablob, &kirk.unk1, 0x30);
|
||||
memcpy(datablob + 0x30, psph, kirk.dataoffset);
|
||||
filebuff = datablob + 0x30 + kirk.dataoffset;
|
||||
|
||||
int whocares = fread(filebuff, 1, size, f);
|
||||
(void)whocares;
|
||||
fclose(f);
|
||||
|
||||
// remove relocations type 7
|
||||
relrem = 0;
|
||||
ehdr = (void *)filebuff;
|
||||
if(!memcmp(ehdr->e_ident, ELFMAG, 4) && ehdr->e_shnum) {
|
||||
shdr = (void *)(filebuff + ehdr->e_shoff);
|
||||
for(i = 0; i < ehdr->e_shnum; i++) {
|
||||
if(shdr[i].sh_type == 0x700000A0) {
|
||||
relo = (void *)(filebuff + shdr[i].sh_offset);
|
||||
for(j = 0; j < shdr[i].sh_size / sizeof(Elf32_Rel); j++) {
|
||||
if((relo[j].r_info & 0xFF) == 7) {
|
||||
relo[j].r_info = 0;
|
||||
relrem++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//printf("%i relocations type 7 removed\ncalculating ...\n", relrem);
|
||||
|
||||
// get AES/CMAC key
|
||||
AES_set_decrypt_key(kirk_key, 128, &aesKey);
|
||||
memset(iv, 0, 16);
|
||||
AES_cbc_encrypt(kirk.key, kirk.key, 32, &aesKey, iv, AES_DECRYPT);
|
||||
|
||||
// check header hash, optional
|
||||
// if you take correct kirk header, hash is always correct
|
||||
/* AES_CMAC(kirk.ckey, datablob, 0x30, cmac);
|
||||
if(memcmp(cmac, kirk.head_hash, 16)) {
|
||||
free(datablob);
|
||||
printf("header hash invalid\n");
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
// encrypt input file
|
||||
AES_set_encrypt_key(kirk.key, 128, &aesKey);
|
||||
memset(iv, 0, 16);
|
||||
AES_cbc_encrypt(filebuff, filebuff, datasize, &aesKey, iv, AES_ENCRYPT);
|
||||
|
||||
// make CMAC correct
|
||||
generate_subkey(kirk.ckey, subk, subk + 16);
|
||||
AES_set_encrypt_key(kirk.ckey, 128, &aesKey);
|
||||
blocks = fullsize / 16;
|
||||
memset(cmac, 0, 16);
|
||||
for(i = 0; i < blocks - 1; i++) {
|
||||
xor_128(cmac, &datablob[16 * i], cmac + 16);
|
||||
AES_encrypt(cmac + 16, cmac, &aesKey);
|
||||
}
|
||||
|
||||
AES_set_decrypt_key(kirk.ckey, 128, &aesKey);
|
||||
AES_decrypt(kirk.data_hash, iv, &aesKey);
|
||||
xor_128(cmac, iv, iv);
|
||||
xor_128(iv, subk, &datablob[16 * (blocks-1)]);
|
||||
// check it, optional
|
||||
// it works, this is only if you want to change something
|
||||
/* AES_CMAC(kirk.ckey, datablob, fullsize, cmac);
|
||||
if(memcmp(cmac, kirk.data_hash, 16)) {
|
||||
fclose(f);
|
||||
free(datablob);
|
||||
printf("data hash calculation error\n");
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
f = fopen(argv[2], "wb");
|
||||
if(!f) {
|
||||
free(datablob);
|
||||
printf("psp-prxsign: Failed to write signed PRX\n");
|
||||
return 1;
|
||||
}
|
||||
//printf("saving ...\n");
|
||||
// save ~PSP header
|
||||
fwrite(psph, 1, 0x150, f);
|
||||
// save encrypted file
|
||||
fwrite(filebuff, 1, fullsize - 0x30 - kirk.dataoffset, f);
|
||||
fclose(f);
|
||||
free(datablob);
|
||||
//printf("everything done\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef __psp_header__
|
||||
#define __psp_header__
|
||||
|
||||
static unsigned int size_psp_header = 336;
|
||||
static unsigned char psp_header[] __attribute__((aligned(16))) = {
|
||||
0x7e, 0x50, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x22, 0x74, 0x69, 0x66, 0x70, 0x73,
|
||||
0x70, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x33, 0x55, 0x00, 0x50, 0x34, 0x55, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x67, 0x3d, 0x00, 0x50, 0x55, 0x0a, 0x01, 0x10, 0x00, 0x40, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6b, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4c, 0x6b, 0x3d, 0x00, 0xcc, 0xbb, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
|
||||
0x90, 0x82, 0x4c, 0x48, 0xa3, 0x53, 0xb2, 0x1b, 0x13, 0x95, 0x2f, 0xf1, 0x0b, 0x90, 0x9c, 0x11,
|
||||
0x61, 0x40, 0x20, 0x67, 0xf8, 0xdb, 0xfc, 0x95, 0x5c, 0xbe, 0x8c, 0x80, 0xf3, 0x92, 0x03, 0x01,
|
||||
0xb0, 0xbe, 0xf5, 0xf8, 0xa1, 0xaf, 0xaf, 0xa8, 0x38, 0x26, 0x63, 0x09, 0x26, 0x0e, 0xb7, 0xd5,
|
||||
0x00, 0x33, 0x55, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5c, 0x3e, 0x03, 0x22, 0xe5, 0x7d, 0xb9, 0xd1, 0x13, 0x67, 0x97, 0xa3, 0x5b, 0xd8, 0x77, 0x1f,
|
||||
0xf0, 0x05, 0xf3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x4a, 0xd7, 0x37,
|
||||
0xc2, 0x8f, 0x15, 0x43, 0x33, 0x93, 0x4d, 0x5b, 0xc0, 0x6e, 0xe4, 0x00, 0xc6, 0x0a, 0x71, 0x11,
|
||||
0x98, 0xb6, 0xc3, 0xb7, 0x59, 0x66, 0x21, 0xa8, 0x65, 0xf6, 0x53, 0xa9, 0x7a, 0x48, 0x17, 0xb6,
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,124 +0,0 @@
|
|||
#
|
||||
# Makefile.cfg for SRB2Wii native using libogc
|
||||
#
|
||||
|
||||
# Check if DEVKITPPC is set in the environment. If so, continue with compilation.
|
||||
.SUFFIXES:
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
# Set compiler flags
|
||||
|
||||
SRB2NAME?=srb2wii
|
||||
EXENAME?=$(SRB2NAME).elf
|
||||
DBGNAME?=$(SRB2NAME).elf.debug
|
||||
DOLNAME?=$(SRB2NAME).dol
|
||||
|
||||
ICONPNG?=sdl/SRB2WII/icon.png
|
||||
METAXML?=sdl/SRB2WII/meta.xml
|
||||
|
||||
APPDIR=apps/$(SRB2NAME)
|
||||
ZIPNAME=$(SRB2NAME).zip
|
||||
|
||||
ELF2DOL=$(DEVKITPPC)/bin/elf2dol
|
||||
WIILOADEXE=$(DEVKITPPC)/bin/wiiload
|
||||
ZIP=zip -r -9
|
||||
WGET=wget -P srb2wii -c -nc
|
||||
SED=sed
|
||||
XARGS=xargs
|
||||
SHXARGS:=$(XARGS)
|
||||
SHSED:=$(SED)
|
||||
FOR=for
|
||||
|
||||
ifndef ECHO
|
||||
ELF2DOL:=@$(ELF2DOL)
|
||||
WIILOADEXE:=@$(WIILOADEXE)
|
||||
ZIP:=@$(ZIP)
|
||||
SED:=@$(SED)
|
||||
XARGS:=@$(XARGS)
|
||||
FOR:=@$(FOR)
|
||||
endif
|
||||
|
||||
# Disable same warning flags
|
||||
WFLAGS+=-Wno-shadow -Wno-char-subscripts -Wno-old-style-definition -Wno-unsuffixed-float-constants
|
||||
|
||||
# newlib has no support for networking
|
||||
NONET=1
|
||||
|
||||
# use pkgconfig for PKG
|
||||
PNG_PKGCONFIG=libpng
|
||||
|
||||
# use absolute paths because changing PATH variable breaks distcc
|
||||
PREFIX := $(DEVKITPPC)/bin/$(PREFIX)
|
||||
|
||||
# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
|
||||
# libogc/DevkitPro required stuff
|
||||
LIBOGC := $(DEVKITPRO)/libogc
|
||||
LIBOGC_INC := $(LIBOGC)/include
|
||||
LIBOGC_LIB := $(LIBOGC)/lib
|
||||
|
||||
PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
||||
PORTLIBS_INC := $(PORTLIBS)/include
|
||||
PORTLIBS_LIB := $(PORTLIBS)/lib
|
||||
|
||||
SDL_CPPFLAGS := -I$(LIBOGC_INC)/SDL
|
||||
SDL_LIB := $(DEVKITPRO)/libogc/lib/wii
|
||||
INCLUDE := -I$(LIBOGC_INC) $(SDL_CPPFLAGS) -I$(PORTLIBS_INC)
|
||||
|
||||
PKG_CONFIG_PATH := $(PORTLIBS)/lib/pkgconfig
|
||||
PKG_BROKEN_SWTICH := --static --define-variable=DEVKITPRO=$(DEVKITPRO)
|
||||
PNG_PKGCONFIG := $(PKG_CONFIG_PATH)/libpng.pc $(PKG_BROKEN_SWTICH)
|
||||
ZLIB_PKGCONFIG := $(PKG_CONFIG_PATH)/zlib.pc $(PKG_BROKEN_SWTICH)
|
||||
|
||||
ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
|
||||
ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
|
||||
|
||||
ifdef RDB
|
||||
LIBS+=-ldb
|
||||
OPTS+=-DREMOTE_DEBUGGING=$(RDB)
|
||||
endif
|
||||
|
||||
LIBS+= -L$(SDL_LIB)
|
||||
ifndef NOMIXER
|
||||
LD=$(CXX)
|
||||
LIBS+=-lSDL_mixer -lvorbisidec -lsmpeg
|
||||
endif
|
||||
LIBS+=-lSDL
|
||||
|
||||
LIBS+=$(ZLIB_LDFLAGS) -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard -L$(LIBOGC_LIB)
|
||||
|
||||
MACHDEP = -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
|
||||
OPTS+=-DWII -D_WII -DUNIXCOMMON
|
||||
CFLAGS+=-D__BIG_ENDIAN__ -g -O3 -fsigned-char $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS+=$(CFLAGS)
|
||||
LDFLAGS+=-g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
SDL_CONFIG=/bin/true
|
||||
SDL_CFLAGS=
|
||||
SDL_LDFLAGS=
|
||||
|
||||
$(BIN)/$(DOLNAME): $(BIN)/$(EXENAME)
|
||||
@echo Linking $(DOLNAME)...
|
||||
$(ELF2DOL) $(BIN)/$(EXENAME) $(BIN)/$(DOLNAME)
|
||||
@echo Creating /apps/$(SRB2NAME)...
|
||||
$(MKDIR) $(APPDIR)
|
||||
$(CP) $(BIN)/$(DOLNAME) $(APPDIR)/boot.dol
|
||||
$(CP) $(ICONPNG) $(APPDIR)
|
||||
$(CP) $(METAXML) $(APPDIR)
|
||||
ifdef WITHDATA
|
||||
$(MKDIR) srb2wii
|
||||
$(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) -e 's/\.srb/\.wad/' -e 's/music.dta//' | $(SHXARGS) -n 1 basename); do \
|
||||
$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \
|
||||
done
|
||||
# downsampled music.dta specially for SRB2Wii
|
||||
$(WGET) http://repos.srb2.org/srb2ports/music.dta
|
||||
$(ZIP) $(BIN)/$(ZIPNAME) $(APPDIR) srb2wii
|
||||
else
|
||||
$(ZIP) $(BIN)/$(ZIPNAME) $(APPDIR)
|
||||
endif
|
||||
$(REMOVE) -r $(APPDIR)
|
||||
|
||||
run: $(BIN)/$(EXENAME)
|
||||
$(WIILOADEXE) $(BIN)/$(DBGNAME)
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<app version="1">
|
||||
<name>SRB2Wii</name>
|
||||
<coder>Callum</coder>
|
||||
<version>2.0.6</version>
|
||||
<release_date>20101207</release_date>
|
||||
<short_description>A 3D Sonic fangame</short_description>
|
||||
<long_description>Sonic Robo Blast 2 is a 3D fangame by a small group called
|
||||
Sonic Team Junior, using the Doom engine as a base.
|
||||
The game has been worked on for almost 11 years so far, and
|
||||
it is still being very much developed today, with a huge
|
||||
fanbase developing custom content, including characters,
|
||||
levels, and even large-scale modifications that play out
|
||||
a brand new adventure.
|
||||
Based on the Doom II engine, SRB2's system requirements
|
||||
are very low, even the oldest computers can play it at a
|
||||
decent speed.</long_description>
|
||||
</app>
|
|
@ -1,44 +0,0 @@
|
|||
#
|
||||
# Makefile.cfg for SRB2/XBOX
|
||||
#
|
||||
|
||||
#
|
||||
#hmmm, the XBOX
|
||||
#
|
||||
|
||||
NOHW=1 #No working OpenGL right now
|
||||
NOHS=1 #No HWSound right now
|
||||
NOASM=1 #No Fast code
|
||||
NONET=1 #No network code
|
||||
NOMD5=1 #No Slow MD5
|
||||
NOPNG=1 #No Screenshot
|
||||
#SDLMAIN=1 #SDLMain!
|
||||
|
||||
ifndef OPENXDK
|
||||
OPENXDK=/usr/local/openxdk
|
||||
endif
|
||||
|
||||
CXBE=$(OPENXDK)/bin/cxbe
|
||||
|
||||
ifdef ECHO
|
||||
CXBE:=@$(CXBE)
|
||||
endif
|
||||
|
||||
ifndef NOHW
|
||||
OPTS+=-DMINI_GL_COMPATIBILITY
|
||||
endif
|
||||
|
||||
BUILTLM=-fno-builtin
|
||||
CFLAGS+=-D_XBOX -std=gnu99 -ffreestanding $(BUILTLM) -fno-exceptions
|
||||
CFLAGS+=-I$(OPENXDK)/i386-pc-xbox/include -I$(OPENXDK)/include
|
||||
OPTS+=-nostdlib -mno-cygwin -march=i386
|
||||
LDFLAGS+=-nostdlib -Wl,--file-alignment,0x20 -Wl,--section-alignment,0x20 -shared -Wl,--entry,_WinMainCRTStartup -Wl,--strip-all -L$(OPENXDK)/i386-pc-xbox/lib -L$(OPENXDK)/lib
|
||||
LIBS=-lg -lc -lm
|
||||
SDL_CFLAGS?=-I$(OPENXDK)/include/SDL
|
||||
SDL_LDFLAGS?=-lSDL -lopenxdk -lhal -lc -lhal -lusb -lhal -lc -lxboxkrnl
|
||||
|
||||
i_system_o+=$(OBJDIR)/xboxhelp.o
|
||||
|
||||
# name of the exefile
|
||||
EXENAME?=SRB2XBOX.EXE
|
||||
BINNAME?=default.xbe
|
|
@ -1,91 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2004 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// stub and replacement "ANSI" C functions for use under OpenXDK
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../doomdef.h"
|
||||
#include "xboxhelp.h"
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
char *getcwd(char *_buf, size_t _size )
|
||||
{
|
||||
(void)_buf;
|
||||
(void)_size;
|
||||
return _buf;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
int mkdir(const char *path)
|
||||
{
|
||||
(void)path;
|
||||
return 0;
|
||||
}
|
||||
#elif 0 //__GNUC__?
|
||||
int mkdir(const char *path, mode_t _mode)
|
||||
{
|
||||
(void)path;
|
||||
(void)_mode;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int chdir (const char *__path )
|
||||
{
|
||||
(void)__path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
time_t time(time_t *T)
|
||||
{
|
||||
long returntime = 0;
|
||||
(void)T;
|
||||
/*
|
||||
SYSTEMTIME st;
|
||||
FILETIME stft;
|
||||
INT64 ftli;
|
||||
if (!T) return returntime;
|
||||
GetSystemTime(&st);
|
||||
SystemTimeToFileTime(&st,&stft);
|
||||
CopyMemory(&ftli,&stft,sizeof (LARGE_INTEGER));
|
||||
returntime = (long)ftli;
|
||||
*T = returntime;
|
||||
*/
|
||||
return returntime;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <RtcApi.h>
|
||||
void __cdecl _RTC_Initialize(void)
|
||||
{
|
||||
}
|
||||
char *getenv(const char *__env)
|
||||
{
|
||||
__env = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int putenv(const char *__env)
|
||||
{
|
||||
__env = NULL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
|
@ -1,6 +0,0 @@
|
|||
#if defined (_MSC_VER)
|
||||
int access(const char *path, int amode);
|
||||
char *getcwd(char *_buf, size_t _size );
|
||||
int mkdir(const char *path);
|
||||
int chdir (const char *__path );
|
||||
#endif
|
Loading…
Reference in a new issue