wiiu: channel support

This commit is contained in:
GaryOderNichts 2020-12-30 00:03:37 +01:00
parent 6f6443e503
commit 8db34dc415
5 changed files with 67 additions and 41 deletions

View File

@ -259,8 +259,11 @@ release_existing()
alcSuspendContext(ALContext); alcSuspendContext(ALContext);
alcDestroyContext(ALContext); alcDestroyContext(ALContext);
} }
#ifndef WIIU_CHANNEL
// Quitting AX seems to softlock as a channel
if ( ALDevice ) if ( ALDevice )
alcCloseDevice(ALDevice); alcCloseDevice(ALDevice);
#endif
ALDevice = NULL; ALDevice = NULL;
ALContext = NULL; ALContext = NULL;

View File

@ -256,21 +256,27 @@ CStreaming::Init2(void)
} }
} }
#ifdef WIIU_CHANNEL
#define TXD_PATH "/vol/external01/wiiu/apps/re3/MODELS/TXD.IMG"
#else
#define TXD_PATH "MODELS\\TXD.IMG"
#endif
void void
CStreaming::Init(void) CStreaming::Init(void)
{ {
#ifdef USE_TXD_CDIMAGE #ifdef USE_TXD_CDIMAGE
int txdHandle = CFileMgr::OpenFile("MODELS\\TXD.IMG", "r"); int txdHandle = CFileMgr::OpenFile(TXD_PATH, "r");
if (txdHandle) if (txdHandle)
CFileMgr::CloseFile(txdHandle); CFileMgr::CloseFile(txdHandle);
if (!CheckVideoCardCaps() && txdHandle) { if (!CheckVideoCardCaps() && txdHandle) {
CdStreamAddImage("MODELS\\TXD.IMG"); CdStreamAddImage(TXD_PATH);
CStreaming::Init2(); CStreaming::Init2();
} else { } else {
CStreaming::Init2(); CStreaming::Init2();
if (CreateTxdImageForVideoCard()) { if (CreateTxdImageForVideoCard()) {
CStreaming::Shutdown(); CStreaming::Shutdown();
CdStreamAddImage("MODELS\\TXD.IMG"); CdStreamAddImage(TXD_PATH);
CStreaming::Init2(); CStreaming::Init2();
} }
} }

View File

@ -194,7 +194,11 @@ ReadVideoCardCapsFile(GPUcaps *caps)
{ {
memset(caps, 0, sizeof(GPUcaps)); memset(caps, 0, sizeof(GPUcaps));
#ifdef WIIU_CHANNEL
int32 file = CFileMgr::OpenFile("/vol/external01/wiiu/apps/re3/DATA/CAPS.DAT", "rb");
#else
int32 file = CFileMgr::OpenFile("DATA\\CAPS.DAT", "rb"); int32 file = CFileMgr::OpenFile("DATA\\CAPS.DAT", "rb");
#endif
if (file != 0) { if (file != 0) {
CFileMgr::Read(file, (char*)&caps->version, 4); CFileMgr::Read(file, (char*)&caps->version, 4);
CFileMgr::Read(file, (char*)&caps->platform, 4); CFileMgr::Read(file, (char*)&caps->platform, 4);
@ -221,7 +225,11 @@ WriteVideoCardCapsFile(void)
{ {
GPUcaps caps; GPUcaps caps;
GetGPUcaps(&caps); GetGPUcaps(&caps);
#ifdef WIIU_CHANNEL
int32 file = CFileMgr::OpenFile("/vol/external01/wiiu/apps/re3/DATA/CAPS.DAT", "wb");
#else
int32 file = CFileMgr::OpenFile("DATA\\CAPS.DAT", "wb"); int32 file = CFileMgr::OpenFile("DATA\\CAPS.DAT", "wb");
#endif
if (file != 0) { if (file != 0) {
CFileMgr::Write(file, (char*)&caps.version, 4); CFileMgr::Write(file, (char*)&caps.version, 4);
CFileMgr::Write(file, (char*)&caps.platform, 4); CFileMgr::Write(file, (char*)&caps.platform, 4);
@ -349,7 +357,11 @@ CreateTxdImageForVideoCard()
RwFileFunctions *filesys = RwOsGetFileInterface(); RwFileFunctions *filesys = RwOsGetFileInterface();
#endif #endif
#ifdef WIIU_CHANNEL
RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "/vol/external01/wiiu/apps/re3/models/txd.img");
#else
RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "models\\txd.img"); RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "models\\txd.img");
#endif
if (img == nil) { if (img == nil) {
// original code does otherwise and it leaks // original code does otherwise and it leaks
delete []buf; delete []buf;
@ -449,7 +461,11 @@ CreateTxdImageForVideoCard()
rw::gl3::needToReadBackTextures = false; rw::gl3::needToReadBackTextures = false;
#endif #endif
#ifdef WIIU_CHANNEL
if (!pDir->WriteDirFile("/vol/external01/wiiu/apps/re3/models/txd.dir")) {
#else
if (!pDir->WriteDirFile("models\\txd.dir")) { if (!pDir->WriteDirFile("models\\txd.dir")) {
#endif
DealWithTxdWriteError(i, TXDSTORESIZE, "CVT_ERR"); DealWithTxdWriteError(i, TXDSTORESIZE, "CVT_ERR");
delete pDir; delete pDir;
return false; return false;

View File

@ -201,11 +201,19 @@ char* casepath(char const* path, bool checkPathFirst)
if (p[0] == '/' || p[0] == '\\') if (p[0] == '/' || p[0] == '\\')
{ {
#ifdef __WIIU__ #ifdef __WIIU__
// skip the /vol/external01/ as we can't open the root // skip the /vol/*/ as we can't open it
d = opendir("/vol/external01/"); if (strncmp(path, "/vol/content", strlen("/vol/content")) == 0) {
p += 16; d = opendir("/vol/content/");
strcpy(out, "/vol/external01"); p += 13;
rl += 15; strcpy(out, "/vol/content");
rl += 12;
}
else if (strncmp(path, "/vol/external01", strlen("/vol/external01")) == 0) {
d = opendir("/vol/external01/");
p += 16;
strcpy(out, "/vol/external01");
rl += 15;
}
#else #else
d = opendir("/"); d = opendir("/");
#endif #endif

View File

@ -16,6 +16,8 @@
#include <coreinit/memheap.h> #include <coreinit/memheap.h>
#include <coreinit/memexpheap.h> #include <coreinit/memexpheap.h>
#include <sysapp/launch.h>
#include <stdio.h> #include <stdio.h>
#include "rwcore.h" #include "rwcore.h"
#include "skeleton.h" #include "skeleton.h"
@ -90,7 +92,11 @@ void _psCreateFolder(const char *path)
const char *_psGetUserFilesFolder() const char *_psGetUserFilesFolder()
{ {
static char szUserFiles[256]; static char szUserFiles[256];
#ifdef WIIU_CHANNEL
strcpy(szUserFiles, "/vol/external01/wiiu/apps/re3/userfiles");
#else
strcpy(szUserFiles, "userfiles"); strcpy(szUserFiles, "userfiles");
#endif
_psCreateFolder(szUserFiles); _psCreateFolder(szUserFiles);
return szUserFiles; return szUserFiles;
} }
@ -822,37 +828,6 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
RsKeyboardEventHandler(rshiftStatus ? rsKEYDOWN : rsKEYUP, &(*rs = rsRSHIFT)); RsKeyboardEventHandler(rshiftStatus ? rsKEYDOWN : rsKEYUP, &(*rs = rsRSHIFT));
} }
#include <coreinit/memory.h>
#include <coreinit/memheap.h>
#include <coreinit/memexpheap.h>
#include <coreinit/memdefaultheap.h>
void memInfo()
{
for(int32_t i = 0; i<2; i++) {
MEMHeapHandle defaultHeap = MEMGetBaseHeapHandle((MEMBaseHeapType) i);
if(defaultHeap != 0) {
uint32_t start = 0;
uint32_t size_bytes = 0;
OSGetMemBound((OSMemoryType) (i+1),&start,&size_bytes);
WHBLogPrintf("Memory Bound MEM%d: startAddress 0x%08X size 0x%08X\n",i+1,start,size_bytes);
int32_t size = MEMGetAllocatableSizeForExpHeapEx(defaultHeap, 4);
int32_t totalSize = MEMGetTotalFreeSizeForExpHeap(defaultHeap);
WHBLogPrintf("BaseHandle address 0x%08X: MEM%d with %07d kb memory free in one block, %07d kb in total.\n",defaultHeap,i+1,size/1024,totalSize/1024);
MEMHeapHandle parent = MEMFindParentHeap(defaultHeap);
if(parent != 0) {
size = MEMGetAllocatableSizeForExpHeapEx(parent, 4);
int32_t totalSize = MEMGetTotalFreeSizeForExpHeap(parent);
WHBLogPrintf("It's parent heap is 0x%08X: With %07d kb memory free in one block, %07d kb in total.\n",parent,size/1024,totalSize/1024);
} else {
WHBLogPrintf("No parent found =(\n");
}
}
}
}
/* /*
***************************************************************************** *****************************************************************************
*/ */
@ -873,10 +848,20 @@ main(int argc, char *argv[])
WHBLogPrintf("RE3 Wii U started"); WHBLogPrintf("RE3 Wii U started");
memInfo(); #ifdef WIIU_CHANNEL
// make sure the required folders exist on our SD
_psCreateFolder("/vol/external01/wiiu");
_psCreateFolder("/vol/external01/wiiu/apps");
_psCreateFolder("/vol/external01/wiiu/apps/re3");
_psCreateFolder("/vol/external01/wiiu/apps/re3/models");
_psCreateFolder("/vol/external01/wiiu/apps/re3/data");
// Set out working dir to the path where the assets are // read from content
chdir("/vol/content");
#else
// Set working dir to the path where the assets are
chdir("/vol/external01/wiiu/apps/re3"); chdir("/vol/external01/wiiu/apps/re3");
#endif
/* /*
* Initialize the platform independent data. * Initialize the platform independent data.
@ -1332,6 +1317,14 @@ main(int argc, char *argv[])
_psFreeVideoModeList(); _psFreeVideoModeList();
#ifdef WIIU_CHANNEL
// make sure the menu launches when we quit
if (RsGlobal.quit) {
SYSLaunchMenu();
// process messages until we exit
while (WHBProcIsRunning());
}
#endif
/* /*
* Tidy up the 3D (RenderWare) components of the application... * Tidy up the 3D (RenderWare) components of the application...