mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 00:59:15 +01:00
wiiu: merge fixes and other polishing
This commit is contained in:
parent
7e860c5c53
commit
676f71e2d1
8
Makefile
8
Makefile
@ -24,9 +24,13 @@ SOURCES := src \
|
||||
src/audio \
|
||||
src/audio/oal \
|
||||
src/audio/eax \
|
||||
src/buildings \
|
||||
src/collision \
|
||||
src/control \
|
||||
src/core \
|
||||
src/entities \
|
||||
src/extras \
|
||||
src/fakerw \
|
||||
src/math \
|
||||
src/modelinfo \
|
||||
src/objects \
|
||||
@ -39,9 +43,7 @@ SOURCES := src \
|
||||
src/skel/wiiu/debug \
|
||||
src/text \
|
||||
src/vehicles \
|
||||
src/weapons \
|
||||
src/extras \
|
||||
src/fakerw
|
||||
src/weapons
|
||||
DATA := data
|
||||
INCLUDES := $(SOURCES) \
|
||||
vendor/librw \
|
||||
|
@ -11,7 +11,9 @@ void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props);
|
||||
void EAX3_SetReverbMix(ALuint filter, float mix);
|
||||
void SetEffectsLevel(ALuint uiFilter, float level);
|
||||
|
||||
#ifndef __WIIU__
|
||||
namespace re3_openal {
|
||||
#endif
|
||||
|
||||
extern LPALGENEFFECTS alGenEffects;
|
||||
extern LPALDELETEEFFECTS alDeleteEffects;
|
||||
@ -47,8 +49,10 @@ extern LPALGETFILTERIV alGetFilteriv;
|
||||
extern LPALGETFILTERF alGetFilterf;
|
||||
extern LPALGETFILTERFV alGetFilterfv;
|
||||
|
||||
#ifndef __WIIU__
|
||||
}
|
||||
|
||||
using namespace re3_openal;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -47,6 +47,8 @@
|
||||
#include <direct.h>
|
||||
#include <shobjidl.h>
|
||||
#include <shlguid.h>
|
||||
#elif defined __WIIU__
|
||||
extern "C" char *_getcwd (char *__buf, size_t __size);
|
||||
#else
|
||||
#define _getcwd getcwd
|
||||
#endif
|
||||
@ -501,6 +503,8 @@ _ResolveLink(char const *path, char *out)
|
||||
psl->Release();
|
||||
}
|
||||
|
||||
return false;
|
||||
#elif defined __WIIU__
|
||||
return false;
|
||||
#else
|
||||
struct stat sb;
|
||||
@ -542,7 +546,7 @@ _FindMP3s(void)
|
||||
int total_ms;
|
||||
WIN32_FIND_DATA fd;
|
||||
|
||||
if (getcwd(_mp3DirectoryPath, MAX_PATH) == NULL) {
|
||||
if (_getcwd(_mp3DirectoryPath, MAX_PATH) == NULL) {
|
||||
perror("getcwd: ");
|
||||
return;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ static int wiiu_thread_create(OSThread *thread, const void *attr, void *(*start_
|
||||
{
|
||||
OSThread *handle = (OSThread *)memalign(16, sizeof(OSThread));
|
||||
unsigned int stackSize = 0x8000;
|
||||
void *stackTop = memalign(16, stackSize) + stackSize;
|
||||
void *stackTop = (uint8*) memalign(16, stackSize) + stackSize;
|
||||
|
||||
if (!OSCreateThread(handle,
|
||||
(OSThreadEntryPointFn)start_routine,
|
||||
@ -85,7 +85,11 @@ struct CdReadInfo
|
||||
pthread_t pChannelThread;
|
||||
sem_t *pStartSemaphore;
|
||||
#endif
|
||||
#ifdef __WIIU__
|
||||
OSSemaphore pDoneSemaphore;
|
||||
#else
|
||||
sem_t *pDoneSemaphore; // used for CdStreamSync
|
||||
#endif
|
||||
int32 hFile;
|
||||
};
|
||||
|
||||
@ -103,10 +107,10 @@ OSSemaphore gCdStreamSema;
|
||||
#else
|
||||
pthread_t _gCdStreamThread;
|
||||
sem_t *gCdStreamSema; // released when we have new thing to read(so channel is set)
|
||||
#endif
|
||||
int8 gCdStreamThreadStatus; // 0: created 1:priority set up 2:abort now
|
||||
Queue gChannelRequestQ;
|
||||
bool _gbCdStreamOverlapped;
|
||||
#endif
|
||||
|
||||
CdReadInfo *gpReadInfo;
|
||||
|
||||
@ -127,6 +131,9 @@ CdStreamInitThread(void)
|
||||
gChannelRequestQ.tail = 0;
|
||||
gChannelRequestQ.size = gNumChannels + 1;
|
||||
ASSERT(gChannelRequestQ.items != nil );
|
||||
#ifdef __WIIU__
|
||||
OSInitSemaphore(&gCdStreamSema, 0);
|
||||
#else
|
||||
gCdStreamSema = sem_open("/semaphore_cd_stream", O_CREAT, 0644, 1);
|
||||
|
||||
|
||||
@ -135,12 +142,16 @@ CdStreamInitThread(void)
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( gNumChannels > 0 )
|
||||
{
|
||||
for ( int32 i = 0; i < gNumChannels; i++ )
|
||||
{
|
||||
#ifdef __WIIU__
|
||||
OSInitSemaphore(&gpReadInfo[i].pDoneSemaphore, 0);
|
||||
#else
|
||||
sprintf(semName,"/semaphore_done%d",i);
|
||||
gpReadInfo[i].pDoneSemaphore = sem_open(semName, O_CREAT, 0644, 1);
|
||||
|
||||
@ -150,6 +161,7 @@ CdStreamInitThread(void)
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
sprintf(semName,"/semaphore_start%d",i);
|
||||
gpReadInfo[i].pStartSemaphore = sem_open(semName, O_CREAT, 0644, 1);
|
||||
@ -178,6 +190,9 @@ CdStreamInitThread(void)
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
debug("Using one streaming thread for all channels\n");
|
||||
gCdStreamThreadStatus = 0;
|
||||
#ifdef __WIIU__
|
||||
wiiu_thread_create(&_gCdStreamThread, NULL, CdStreamThread, nil);
|
||||
#else
|
||||
status = pthread_create(&_gCdStreamThread, NULL, CdStreamThread, nil);
|
||||
|
||||
if (status == -1)
|
||||
@ -186,6 +201,7 @@ CdStreamInitThread(void)
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
debug("Using separate streaming threads for each channel\n");
|
||||
#endif
|
||||
@ -194,6 +210,7 @@ CdStreamInitThread(void)
|
||||
void
|
||||
CdStreamInit(int32 numChannels)
|
||||
{
|
||||
#ifndef __WIIU__
|
||||
struct statvfs fsInfo;
|
||||
|
||||
if((statvfs("models/gta3.img", &fsInfo)) < 0)
|
||||
@ -216,6 +233,11 @@ CdStreamInit(int32 numChannels)
|
||||
}
|
||||
*/
|
||||
void *pBuffer = (void *)RwMallocAlign(CDSTREAM_SECTOR_SIZE, (RwUInt32)fsInfo.f_bsize);
|
||||
|
||||
#else
|
||||
// statvfs doesn't work properly on wiiu
|
||||
void *pBuffer = (void *)RwMallocAlign(CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
#endif
|
||||
ASSERT( pBuffer != nil );
|
||||
|
||||
gNumImages = 0;
|
||||
@ -266,8 +288,14 @@ CdStreamShutdown(void)
|
||||
// Destroying semaphores and free(gpReadInfo) will be done at threads
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
gCdStreamThreadStatus = 2;
|
||||
#ifdef __WIIU__
|
||||
OSSignalSemaphore(&gCdStreamSema);
|
||||
// softlocks
|
||||
// OSJoinThread(&_gCdStreamThread, NULL);
|
||||
#else
|
||||
sem_post(gCdStreamSema);
|
||||
pthread_join(_gCdStreamThread, nil);
|
||||
#endif
|
||||
#else
|
||||
for ( int32 i = 0; i < gNumChannels; i++ ) {
|
||||
gpReadInfo[i].nThreadStatus = 2;
|
||||
@ -311,8 +339,12 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
||||
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
AddToQueue(&gChannelRequestQ, channel);
|
||||
#ifdef __WIIU__
|
||||
OSSignalSemaphore(&gCdStreamSema);
|
||||
#else
|
||||
if ( sem_post(gCdStreamSema) != 0 )
|
||||
printf("Signal Sema Error\n");
|
||||
#endif
|
||||
#else
|
||||
if ( sem_post(pChannel->pStartSemaphore) != 0 )
|
||||
printf("Signal Sema Error\n");
|
||||
@ -380,9 +412,15 @@ CdStreamSync(int32 channel)
|
||||
pChannel->nSectorsToRead = 0;
|
||||
if (pChannel->bReading) {
|
||||
pChannel->bLocked = true;
|
||||
#ifdef __WIIU__
|
||||
OSCancelThread(&_gCdStreamThread);
|
||||
while (pChannel->bLocked)
|
||||
OSWaitSemaphore(&pChannel->pDoneSemaphore);
|
||||
#else
|
||||
pthread_kill(_gCdStreamThread, SIGUSR1);
|
||||
while (pChannel->bLocked)
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
pChannel->bReading = false;
|
||||
@ -394,7 +432,11 @@ CdStreamSync(int32 channel)
|
||||
{
|
||||
pChannel->bLocked = true;
|
||||
while (pChannel->bLocked)
|
||||
#ifdef __WIIU__
|
||||
OSWaitSemaphore(&pChannel->pDoneSemaphore);
|
||||
#else
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
#endif
|
||||
}
|
||||
|
||||
pChannel->bReading = false;
|
||||
@ -445,7 +487,11 @@ void *CdStreamThread(void *param)
|
||||
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
while (gCdStreamThreadStatus != 2) {
|
||||
#ifdef __WIIU__
|
||||
OSWaitSemaphore(&gCdStreamSema);
|
||||
#else
|
||||
sem_wait(gCdStreamSema);
|
||||
#endif
|
||||
int32 channel = GetFirstInQueue(&gChannelRequestQ);
|
||||
#else
|
||||
int channel = *((int*)param);
|
||||
@ -498,12 +544,17 @@ void *CdStreamThread(void *param)
|
||||
if ( pChannel->bLocked )
|
||||
{
|
||||
pChannel->bLocked = 0;
|
||||
#ifdef __WIIU__
|
||||
OSSignalSemaphore(&pChannel->pDoneSemaphore);
|
||||
#else
|
||||
sem_post(pChannel->pDoneSemaphore);
|
||||
#endif
|
||||
}
|
||||
pChannel->bReading = false;
|
||||
}
|
||||
char semName[20];
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
#ifndef __WIIU__
|
||||
for ( int32 i = 0; i < gNumChannels; i++ )
|
||||
{
|
||||
sem_close(gpReadInfo[i].pDoneSemaphore);
|
||||
@ -512,6 +563,7 @@ void *CdStreamThread(void *param)
|
||||
}
|
||||
sem_close(gCdStreamSema);
|
||||
sem_unlink("/semaphore_cd_stream");
|
||||
#endif
|
||||
free(gChannelRequestQ.items);
|
||||
#else
|
||||
sem_close(gpReadInfo[channel].pStartSemaphore);
|
||||
@ -525,8 +577,13 @@ void *CdStreamThread(void *param)
|
||||
if (gpReadInfo)
|
||||
free(gpReadInfo);
|
||||
gpReadInfo = nil;
|
||||
#ifdef __WIIU__
|
||||
//OSExitThread(0);
|
||||
return 0;
|
||||
#else
|
||||
pthread_exit(nil);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -213,7 +213,11 @@ CFileLoader::LoadCollisionFile(const char *filename)
|
||||
fd = CFileMgr::OpenFile(filename, "rb");
|
||||
|
||||
while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){
|
||||
assert(strncmp(header.ident, "COLL", 4) == 0);
|
||||
#ifdef BIGENDIAN
|
||||
assert(header.ident == 'COLL');
|
||||
#else
|
||||
assert(header.ident == 'LLOC');
|
||||
#endif
|
||||
#ifdef BIGENDIAN
|
||||
header.size = BSWAP32(header.size);
|
||||
#endif
|
||||
|
@ -269,7 +269,7 @@ enum Config {
|
||||
#if !defined(RW_GL3) && defined(_WIN32)
|
||||
#define XINPUT
|
||||
#endif
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__)
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__) && !defined(__WIIU__)
|
||||
#define DONT_TRUST_RECOGNIZED_JOYSTICKS // Then we'll only rely on GLFW gamepad DB, and expect user to enter Controller->Detect joysticks if his joystick isn't on that list.
|
||||
#endif
|
||||
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
|
||||
@ -305,7 +305,9 @@ enum Config {
|
||||
# define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable
|
||||
# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
|
||||
# define CUTSCENE_BORDERS_SWITCH
|
||||
# define MULTISAMPLING // adds MSAA option
|
||||
# ifndef __WIIU__ // not supported in gx2 librw
|
||||
# define MULTISAMPLING // adds MSAA option
|
||||
# endif
|
||||
# define INVERT_LOOK_FOR_PAD // add bInvertLook4Pad from VC
|
||||
# endif
|
||||
#endif
|
||||
|
@ -41,14 +41,14 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WIIU__
|
||||
#include <coreinit/debug.h>
|
||||
#include <whb/log.h>
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
|
||||
#ifdef RWLIBS
|
||||
|
||||
extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PS2_RAND
|
||||
unsigned long long myrand_seed = 1;
|
||||
|
@ -38,7 +38,7 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
||||
|
||||
// Case-sensitivity and backslashes...
|
||||
// Will be freed at the bottom
|
||||
char *realFolder = casepath(folder);
|
||||
char *realFolder = casepath(folder, false);
|
||||
if (realFolder) {
|
||||
folder = realFolder;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "Sprite2d.h"
|
||||
#include "AnimViewer.h"
|
||||
#include "Font.h"
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <locale.h>
|
||||
@ -74,7 +75,7 @@ void _psCreateFolder(const char *path)
|
||||
char fullpath[PATH_MAX];
|
||||
realpath(path, fullpath);
|
||||
|
||||
if (lstat(fullpath, &info) != 0) {
|
||||
if (stat(fullpath, &info) != 0) {
|
||||
if (errno == ENOENT || (errno != EACCES && !S_ISDIR(info.st_mode))) {
|
||||
mkdir(fullpath, 0755);
|
||||
}
|
||||
@ -168,7 +169,11 @@ psMouseSetPos(RwV2d *pos)
|
||||
RwMemoryFunctions*
|
||||
psGetMemoryFunctions(void)
|
||||
{
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
return &memFuncs;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -196,8 +201,6 @@ psNativeTextureSupport(void)
|
||||
RwBool
|
||||
psInitialize(void)
|
||||
{
|
||||
WHBLogPrintf("psInitialize");
|
||||
|
||||
PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f;
|
||||
|
||||
RsGlobal.ps = &PsGlobal;
|
||||
@ -208,7 +211,6 @@ psInitialize(void)
|
||||
PsGlobal.joy1id = -1;
|
||||
PsGlobal.joy2id = -1;
|
||||
|
||||
WHBLogPrintf("Initializing CFileMgr");
|
||||
CFileMgr::Initialise();
|
||||
|
||||
#ifdef PS2_MENU
|
||||
@ -261,36 +263,31 @@ psInitialize(void)
|
||||
|
||||
TheMemoryCard.Init();
|
||||
#else
|
||||
WHBLogPrintf("Setting save dir");
|
||||
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
||||
|
||||
WHBLogPrintf("Initializing language");
|
||||
InitialiseLanguage();
|
||||
|
||||
#ifndef GTA3_1_1_PATCH
|
||||
#if GTA_VERSION < GTA3_PC_11
|
||||
FrontEndMenuManager.LoadSettings();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
WHBLogPrintf("gGameState = GS_START_UP");
|
||||
gGameState = GS_START_UP;
|
||||
TRACE("gGameState = GS_START_UP");
|
||||
|
||||
_dwOperatingSystemVersion = OS_WINXP;
|
||||
|
||||
#ifndef PS2_MENU
|
||||
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
#if GTA_VERSION < GTA3_PC_11
|
||||
FrontEndMenuManager.LoadSettings();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// TODO: Is there a way to get free ram on wiiu?
|
||||
|
||||
_dwMemAvailPhys = 1024*1024*170; //systemInfo.freeram;
|
||||
_dwOperatingSystemVersion = OS_WINXP; // To fool other classes
|
||||
|
||||
// debug("Physical memory size %u\n", systemInfo.totalram);
|
||||
// debug("Available physical memory %u\n", systemInfo.freeram);
|
||||
// memory required to have all vehicles loaded
|
||||
_dwMemAvailPhys = 1024*1024*170;
|
||||
|
||||
TheText.Unload();
|
||||
|
||||
@ -414,18 +411,15 @@ psSelectDevice()
|
||||
RwVideoMode vm;
|
||||
RwInt32 subSysNum;
|
||||
RwInt32 AutoRenderer = 0;
|
||||
|
||||
WHBLogPrintf("psSelectDevice");
|
||||
|
||||
RwBool modeFound = FALSE;
|
||||
|
||||
if ( !useDefault )
|
||||
{
|
||||
WHBLogPrintf("Not using default");
|
||||
|
||||
GnumSubSystems = RwEngineGetNumSubSystems();
|
||||
if ( !GnumSubSystems )
|
||||
{
|
||||
WHBLogPrintf("no subsystems");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -438,7 +432,6 @@ psSelectDevice()
|
||||
RwEngineGetSubSystemInfo(&GsubSysInfo[subSysNum], subSysNum);
|
||||
}
|
||||
|
||||
WHBLogPrintf("RwEngineGetCurrentSubSystem");
|
||||
/* Get the default selection */
|
||||
GcurSel = RwEngineGetCurrentSubSystem();
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
@ -450,7 +443,6 @@ psSelectDevice()
|
||||
/* Set the driver to use the correct sub system */
|
||||
if (!RwEngineSetSubSystem(GcurSel))
|
||||
{
|
||||
WHBLogPrintf("cannot set subsystem %d", GcurSel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -575,7 +567,6 @@ psSelectDevice()
|
||||
* dimensions to match */
|
||||
if (!RwEngineSetVideoMode(GcurSelVM))
|
||||
{
|
||||
WHBLogPrintf("Cannot set video mode");
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
@ -630,24 +621,9 @@ long _InputInitialiseMouse()
|
||||
|
||||
void psPostRWinit(void)
|
||||
{
|
||||
RwVideoMode vm;
|
||||
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
|
||||
|
||||
// TODO: wiiu
|
||||
|
||||
// glfwSetKeyCallback(PSGLOBAL(window), keypressCB);
|
||||
// glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB);
|
||||
// glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
|
||||
// glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
|
||||
// glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB);
|
||||
// glfwSetJoystickCallback(joysChangeCB);
|
||||
|
||||
_InputInitialiseJoys();
|
||||
_InputInitialiseMouse();
|
||||
|
||||
// if(!(vm.flags & rwVIDEOMODEEXCLUSIVE))
|
||||
// glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight);
|
||||
|
||||
// Make sure all keys are released
|
||||
CPad::GetPad(0)->Clear(true);
|
||||
CPad::GetPad(1)->Clear(true);
|
||||
@ -693,7 +669,7 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
|
||||
void InitialiseLanguage()
|
||||
{
|
||||
|
||||
// TODO: wiiu get system language
|
||||
// TODO: wiiu get system language
|
||||
// Mandatory for Linux(Unix? Posix?) to set lang. to environment lang.
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
@ -875,9 +851,12 @@ main(int argc, char *argv[])
|
||||
RwV2d pos;
|
||||
RwInt32 i;
|
||||
|
||||
WHBProcInit();
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
InitMemoryMgr();
|
||||
#endif
|
||||
|
||||
WHBProcInit();
|
||||
WHBInitCrashHandler();
|
||||
WHBMountSdCard();
|
||||
|
||||
WHBLogUdpInit();
|
||||
|
||||
@ -899,7 +878,6 @@ main(int argc, char *argv[])
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WHBLogPrintf("RE3 Wii U initialized");
|
||||
|
||||
// for(i=1; i<argc; i++)
|
||||
// {
|
||||
@ -913,8 +891,8 @@ main(int argc, char *argv[])
|
||||
openParams.width = RsGlobal.maximumWidth;
|
||||
openParams.height = RsGlobal.maximumHeight;
|
||||
openParams.windowtitle = RsGlobal.appName;
|
||||
// TODO wiiu openParams.window = &PSGLOBAL(window);
|
||||
|
||||
openParams.window = nil;
|
||||
|
||||
ControlsManager.MakeControllerActionsBlank();
|
||||
ControlsManager.InitDefaultControlConfiguration();
|
||||
|
||||
@ -924,32 +902,18 @@ main(int argc, char *argv[])
|
||||
if( rsEVENTERROR == RsEventHandler(rsRWINITIALIZE, &openParams) )
|
||||
{
|
||||
RsEventHandler(rsTERMINATE, nil);
|
||||
WHBLogPrintf("Cannot initialize RenderWare\n");
|
||||
WHBLogPrintf("Cannot initialize RenderWare");
|
||||
WHBProcShutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
WHBLogPrintf("RenderWare Initialized");
|
||||
|
||||
psPostRWinit();
|
||||
|
||||
WHBLogPrintf("Renderware post init done");
|
||||
|
||||
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
|
||||
|
||||
WHBLogPrintf("mouse initialized");
|
||||
|
||||
// TODO Wii U
|
||||
// glfwSetWindowPos(PSGLOBAL(window), 0, 0);
|
||||
|
||||
// /*
|
||||
// * Parse command line parameters (except program name) one at
|
||||
// * a time AFTER RenderWare initialization...
|
||||
// */
|
||||
// for(i=1; i<argc; i++)
|
||||
// {
|
||||
// RsEventHandler(rsCOMMANDLINE, argv[i]);
|
||||
// }
|
||||
|
||||
/*
|
||||
* Force a camera resize event...
|
||||
@ -965,7 +929,6 @@ main(int argc, char *argv[])
|
||||
RsEventHandler(rsCAMERASIZE, &r);
|
||||
}
|
||||
|
||||
WHBLogPrintf("camera resized");
|
||||
|
||||
{
|
||||
CFileMgr::SetDirMyDocuments();
|
||||
@ -981,7 +944,6 @@ main(int argc, char *argv[])
|
||||
CFileMgr::SetDir("");
|
||||
}
|
||||
|
||||
WHBLogPrintf("set loaded");
|
||||
|
||||
#ifdef PS2_MENU
|
||||
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
|
||||
@ -999,21 +961,8 @@ main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
if (TurnOnAnimViewer)
|
||||
{
|
||||
#ifndef MASTER
|
||||
CAnimViewer::Initialise();
|
||||
#ifndef PS2_MENU
|
||||
FrontEndMenuManager.m_bGameNotLoaded = false;
|
||||
#endif
|
||||
gGameState = GS_ANIMVIEWER;
|
||||
TurnOnAnimViewer = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
WHBLogPrintf("animviewer initialized");
|
||||
|
||||
// main loop
|
||||
// main loop
|
||||
while ( TRUE )
|
||||
{
|
||||
RwInitialised = TRUE;
|
||||
@ -1030,6 +979,18 @@ main(int argc, char *argv[])
|
||||
* Enter the message processing loop...
|
||||
*/
|
||||
|
||||
#ifndef MASTER
|
||||
if (gbModelViewer) {
|
||||
// This is TheModelViewer in LCS, but not compiled on III Mobile.
|
||||
LoadingScreen("Loading the ModelViewer", NULL, GetRandomSplashScreen());
|
||||
CAnimViewer::Initialise();
|
||||
CTimer::Update();
|
||||
#ifndef PS2_MENU
|
||||
FrontEndMenuManager.m_bGameNotLoaded = false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PS2_MENU
|
||||
if (TheMemoryCard.m_bWantToLoad)
|
||||
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
|
||||
@ -1043,13 +1004,18 @@ main(int argc, char *argv[])
|
||||
while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart && WHBProcIsRunning())
|
||||
#endif
|
||||
{
|
||||
if( ForegroundApp )
|
||||
#ifndef MASTER
|
||||
if (gbModelViewer) {
|
||||
// This is TheModelViewerCore in LCS, but TheModelViewer on other state-machine III-VCs.
|
||||
TheModelViewer();
|
||||
} else
|
||||
#endif
|
||||
if ( ForegroundApp )
|
||||
{
|
||||
switch ( gGameState )
|
||||
{
|
||||
case GS_START_UP:
|
||||
{
|
||||
WHBLogPrintf("GS_START_UP");
|
||||
#ifdef NO_MOVIES
|
||||
gGameState = GS_INIT_ONCE;
|
||||
#else
|
||||
@ -1059,23 +1025,21 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
case GS_INIT_LOGO_MPEG:
|
||||
case GS_INIT_LOGO_MPEG:
|
||||
{
|
||||
WHBLogPrintf("GS_INIT_LOGO_MPEG");
|
||||
//if (!startupDeactivate)
|
||||
//if (!startupDeactivate)
|
||||
// PlayMovieInWindow(cmdShow, "movies\\Logo.mpg");
|
||||
gGameState = GS_LOGO_MPEG;
|
||||
TRACE("gGameState = GS_LOGO_MPEG;");
|
||||
break;
|
||||
}
|
||||
gGameState = GS_LOGO_MPEG;
|
||||
TRACE("gGameState = GS_LOGO_MPEG;");
|
||||
break;
|
||||
}
|
||||
|
||||
case GS_LOGO_MPEG:
|
||||
case GS_LOGO_MPEG:
|
||||
{
|
||||
WHBLogPrintf("GS_LOGO_MPEG");
|
||||
// CPad::UpdatePads();
|
||||
|
||||
// if (startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0)
|
||||
++gGameState;
|
||||
++gGameState;
|
||||
// else if (CPad::GetPad(0)->GetLeftMouseJustDown())
|
||||
// ++gGameState;
|
||||
// else if (CPad::GetPad(0)->GetEnterJustDown())
|
||||
@ -1087,12 +1051,11 @@ main(int argc, char *argv[])
|
||||
// else if (CPad::GetPad(0)->GetTabJustDown())
|
||||
// ++gGameState;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GS_INIT_INTRO_MPEG:
|
||||
case GS_INIT_INTRO_MPEG:
|
||||
{
|
||||
WHBLogPrintf("GS_INIT_INTRO_MPEG");
|
||||
//#ifndef NO_MOVIES
|
||||
// CloseClip();
|
||||
// CoUninitialize();
|
||||
@ -1103,18 +1066,17 @@ main(int argc, char *argv[])
|
||||
// else
|
||||
// PlayMovieInWindow(cmdShow, "movies\\GTAtitles.mpg");
|
||||
|
||||
gGameState = GS_INTRO_MPEG;
|
||||
TRACE("gGameState = GS_INTRO_MPEG;");
|
||||
break;
|
||||
}
|
||||
gGameState = GS_INTRO_MPEG;
|
||||
TRACE("gGameState = GS_INTRO_MPEG;");
|
||||
break;
|
||||
}
|
||||
|
||||
case GS_INTRO_MPEG:
|
||||
case GS_INTRO_MPEG:
|
||||
{
|
||||
WHBLogPrintf("GS_INTRO_MPEG");
|
||||
// CPad::UpdatePads();
|
||||
//
|
||||
// if (startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0)
|
||||
++gGameState;
|
||||
++gGameState;
|
||||
// else if (CPad::GetPad(0)->GetLeftMouseJustDown())
|
||||
// ++gGameState;
|
||||
// else if (CPad::GetPad(0)->GetEnterJustDown())
|
||||
@ -1126,12 +1088,11 @@ main(int argc, char *argv[])
|
||||
// else if (CPad::GetPad(0)->GetTabJustDown())
|
||||
// ++gGameState;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GS_INIT_ONCE:
|
||||
{
|
||||
WHBLogPrintf("GS_INIT_ONCE");
|
||||
//CoUninitialize();
|
||||
|
||||
#ifdef PS2_MENU
|
||||
@ -1143,10 +1104,8 @@ main(int argc, char *argv[])
|
||||
|
||||
printf("Into TheGame!!!\n");
|
||||
#else
|
||||
WHBLogPrintf("loadsc0");
|
||||
LoadingScreen(nil, nil, "loadsc0");
|
||||
#endif
|
||||
WHBLogPrintf("InitialiseOnceAfterRW");
|
||||
if ( !CGame::InitialiseOnceAfterRW() )
|
||||
RsGlobal.quit = TRUE;
|
||||
|
||||
@ -1162,20 +1121,12 @@ main(int argc, char *argv[])
|
||||
#ifndef PS2_MENU
|
||||
case GS_INIT_FRONTEND:
|
||||
{
|
||||
WHBLogPrintf("GS_INIT_FRONTEND");
|
||||
LoadingScreen(nil, nil, "loadsc0");
|
||||
|
||||
FrontEndMenuManager.m_bGameNotLoaded = true;
|
||||
|
||||
CMenuManager::m_bStartUpFrontEndRequested = true;
|
||||
|
||||
// TODO: wiiu
|
||||
// if ( defaultFullscreenRes )
|
||||
// {
|
||||
// defaultFullscreenRes = FALSE;
|
||||
// FrontEndMenuManager.m_nPrefsVideoMode = GcurSelVM;
|
||||
// FrontEndMenuManager.m_nDisplayVideoMode = GcurSelVM;
|
||||
// }
|
||||
|
||||
gGameState = GS_FRONTEND;
|
||||
TRACE("gGameState = GS_FRONTEND;");
|
||||
@ -1213,7 +1164,6 @@ main(int argc, char *argv[])
|
||||
|
||||
case GS_INIT_PLAYING_GAME:
|
||||
{
|
||||
WHBLogPrintf("GS_INIT_PLAYING_GAME");
|
||||
#ifdef PS2_MENU
|
||||
CGame::Initialise("DATA\\GTA3.DAT");
|
||||
|
||||
@ -1248,7 +1198,6 @@ main(int argc, char *argv[])
|
||||
|
||||
case GS_PLAYING_GAME:
|
||||
{
|
||||
WHBLogPrintf("GS_PLAYING_GAME");
|
||||
float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
|
||||
if ( RwInitialised )
|
||||
{
|
||||
@ -1257,19 +1206,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifndef MASTER
|
||||
case GS_ANIMVIEWER:
|
||||
{
|
||||
WHBLogPrintf("GS_ANIMVIEWER");
|
||||
float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
|
||||
if (RwInitialised)
|
||||
{
|
||||
if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms)
|
||||
RsEventHandler(rsANIMVIEWER, (void*)TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1344,9 +1280,12 @@ main(int argc, char *argv[])
|
||||
if ( gGameState == GS_PLAYING_GAME )
|
||||
CGame::ShutDown();
|
||||
#ifndef MASTER
|
||||
else if ( gGameState == GS_ANIMVIEWER )
|
||||
if ( gbModelViewer )
|
||||
CAnimViewer::Shutdown();
|
||||
else
|
||||
#endif
|
||||
if ( gGameState == GS_PLAYING_GAME )
|
||||
CGame::ShutDown();
|
||||
|
||||
CTimer::Stop();
|
||||
|
||||
@ -1371,9 +1310,12 @@ main(int argc, char *argv[])
|
||||
if ( gGameState == GS_PLAYING_GAME )
|
||||
CGame::ShutDown();
|
||||
#ifndef MASTER
|
||||
else if ( gGameState == GS_ANIMVIEWER )
|
||||
if ( gbModelViewer )
|
||||
CAnimViewer::Shutdown();
|
||||
else
|
||||
#endif
|
||||
if ( gGameState == GS_PLAYING_GAME )
|
||||
CGame::ShutDown();
|
||||
|
||||
DMAudio.Terminate();
|
||||
|
||||
@ -1390,8 +1332,8 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
RsEventHandler(rsTERMINATE, nil);
|
||||
|
||||
WHBUnmountSdCard();
|
||||
WHBProcShutdown();
|
||||
WHBUnmountSdCard();
|
||||
WHBProcShutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user