Skip to content

Commit

Permalink
- Show GC Loader firmware version.
Browse files Browse the repository at this point in the history
- Add space to GCLoader.
  • Loading branch information
Extrems committed Feb 4, 2021
1 parent 61eece4 commit 6eb8392
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ u32 deviceHandler_GCLOADER_emulated() {

DEVICEHANDLER_INTERFACE __device_gcloader = {
DEVICE_ID_G,
"GCLoader",
"GCLoader",
"GC Loader",
"GC Loader",
"Supported File System(s): FAT16, FAT32, exFAT",
{TEX_GCLOADER, 116, 72},
FEAT_READ|FEAT_BOOT_GCM|FEAT_BOOT_DEVICE|FEAT_AUTOLOAD_DOL|FEAT_FAT_FUNCS|FEAT_HYPERVISOR|FEAT_AUDIO_STREAMING,
Expand Down
24 changes: 24 additions & 0 deletions cube/swiss/source/devices/gcloader/gcloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <debug.h>
#include <ogc/exi.h>
#include <gcloader.h>
#include <malloc.h>
#include "main.h"
#include "swiss.h"
#include "gui/FrameBufferMagic.h"
Expand All @@ -38,6 +39,29 @@ u32 gcloaderReadId() {
return __gcloaderCmdImm(0xB0000000, 0x00000000, 0x00000000);
}

char *gcloaderGetVersion() {
int len = (__gcloaderCmdImm(0xB1000001, 0x00000000, 0x00000000)+31)&~31;
if(len <= 0) {
return NULL;
}
char *buffer = memalign(32, len);
if(!buffer) {
return NULL;
}
gcloader[2] = 0xB1000000;
gcloader[3] = 0;
gcloader[4] = 0;
gcloader[5] = (u32)buffer;
gcloader[6] = len;
gcloader[7] = 3; // DMA | START
DCInvalidateRange(buffer, len);

while(gcloader[7] & 1);

buffer[len-1] = '\0';
return buffer;
}

void gcloaderWriteFrags(u32 discNum, vu32 *fragList, u32 totFrags) {
int i;

Expand Down
1 change: 1 addition & 0 deletions cube/swiss/source/devices/gcloader/gcloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define MAX_GCLOADER_FRAGS_PER_DISC (40)

u32 gcloaderReadId();
char *gcloaderGetVersion();
void gcloaderWriteFrags(u32 discNum, vu32 *fragList, u32 totFrags);
void gcloaderWriteDiscNum(u32 discNum);

Expand Down
6 changes: 6 additions & 0 deletions cube/swiss/source/gui/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "ata.h"
#include "exi.h"
#include "bba.h"
#include "gcloader.h"
#include "wkf.h"

char topStr[256];
Expand Down Expand Up @@ -98,6 +99,11 @@ uiDrawObj_t * info_draw_page(int page_num) {
if(dev == &__device_dvd) {
sprintf(topStr, "%s %02X %02X%02X/%02X (%02X)",dev->hwName,driveVersion[2],driveVersion[0],driveVersion[1],driveVersion[3],driveVersion[4]);
}
else if(dev == &__device_gcloader) {
char* gcloaderVersionStr = gcloaderGetVersion();
sprintf(topStr, "%s %s",dev->hwName,gcloaderVersionStr);
free(gcloaderVersionStr);
}
else if(dev == &__device_wkf) {
sprintf(topStr, "%s (%s)",dev->hwName,wkfGetSerial());
}
Expand Down

0 comments on commit 6eb8392

Please sign in to comment.