- fixed devolution for usb only users

This commit is contained in:
Fledge68 2020-06-05 18:58:33 -05:00
parent bca9764f4b
commit 0f8a3e30d8
5 changed files with 11 additions and 35 deletions

View File

@ -53,7 +53,7 @@ ios := 249
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -ggdb -O2 -Wall -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H
CFLAGS = -g -ggdb -O2 -Wall -Wno-multichar -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@ -45,7 +45,6 @@ void DeviceHandler::Init()
/* PartitionHandle inits */
sd.Init();
usb.Init();
OGC_Device.Init();// used for Devolution gamecube iso launcher
}
void DeviceHandler::SetMountUSB(bool using_usb)
@ -275,24 +274,6 @@ bool DeviceHandler::WaitForDevice(const DISC_INTERFACE *Handle)
return false;
}
bool DeviceHandler::MountDevolution()
{
int NewPartition = (currentPartition == SD ? currentPartition : currentPartition - 1);
const DISC_INTERFACE *handle = (currentPartition == SD) ? &__io_wiisd_ogc : &__io_usbstorage_ogc;
/* We need to wait for the device to get ready for a remount */
WaitForDevice(handle);
/* Only mount the partition we need */
OGC_Device.SetDevice(handle);
return OGC_Device.Mount(NewPartition, DeviceName[currentPartition], true);
}
void DeviceHandler::UnMountDevolution()
{
int NewPartition = (currentPartition == SD ? currentPartition : currentPartition - 1);
OGC_Device.UnMount(NewPartition);
OGC_Device.Cleanup();
}
bool DeviceHandler::UsablePartitionMounted()
{
for(u8 i = SD; i < MAXDEVICES; i++)

View File

@ -99,17 +99,12 @@ public:
wbfs_t *GetWbfsHandle(int dev);
s32 OpenWBFS(int dev);
/* Special Devolution Stuff */
bool MountDevolution();
void UnMountDevolution();
private:
bool MountUSB(int part);
bool mount_usb;
PartitionHandle sd;
PartitionHandle usb;
/* Special Devolution Stuff */
PartitionHandle OGC_Device;
};
extern DeviceHandler DeviceHandle;

View File

@ -272,14 +272,7 @@ void DEVO_GetLoader(const char *path)
void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 lang,
bool memcard_emu, bool widescreen, bool activity_led, bool wifi)
{
// re-mount device we need
//DeviceHandle.MountDevolution();
//start writing cfg to mem
struct stat st;
int data_fd;
char iso2path[256];
memset(iso2path, 0, sizeof(iso2path));
stat(isopath, &st);
FILE *f = fopen(isopath, "rb");
@ -292,7 +285,12 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
memset(DEVO_CONFIG, 0, sizeof(gconfig));
DEVO_CONFIG->signature = DEVO_CONFIG_SIG;
DEVO_CONFIG->version = DEVO_CONFIG_VERSION;
DEVO_CONFIG->device_signature = st.st_dev;
// if wiiflow is using a cIOS the custom disc interface device usbstorage.c will cause st.st_dev to return 'WUMS' instead of 'WUSB'.
// if wiiflow is using IOS58 usbstorage_libogc interface and st.st_dev will return the proper result 'WUSB'.
// for sd it always return 'WISD'.
// only last two letters are returned by DevkitPro 'SD', 'SB' or 'MS'.
// so we use this little trick to make sure device signature is always set to the proper 2 letter ID.
DEVO_CONFIG->device_signature = st.st_dev == 'SD' ? 'SD' : 'SB';
DEVO_CONFIG->disc1_cluster = st.st_ino;
// Pergame options
@ -304,6 +302,8 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
DEVO_CONFIG->options |= DEVO_CONFIG_NOLED;
// If 2nd iso file tell Devo about it
char iso2path[256];
memset(iso2path, 0, sizeof(iso2path));
strncpy(iso2path, isopath, 255);
char *ptz = strstr(iso2path, "game.iso");
if(ptz != NULL)
@ -333,6 +333,8 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
fsop_MakeFolder(fmt("%s:/apps", DeviceName[currentPartition]));
fsop_MakeFolder(fmt("%s:/apps/gc_devo", DeviceName[currentPartition]));
// setup memcard
int data_fd;
if(memcard_emu)
{
const char *memcard_dir = NULL;
@ -379,8 +381,6 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
// flush disc ID and Devolution config out to memory
DCFlushRange((void*)Disc_ID, 64);
//DeviceHandle.UnMountDevolution();
// GX Render Mode (rmode) and register (rmode_reg)
GXRModeObj *rmode = VIDEO_GetPreferredMode(0);
int rmode_reg = 0;// VI_NTSC