Skip to content

Commit

Permalink
- Apply appropriate graphics before network init.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Aug 16, 2024
1 parent 94d827d commit 94fcee5
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 50 deletions.
1 change: 1 addition & 0 deletions cube/swiss/include/bba.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern int net_initialized;
extern struct in_addr bba_localip;
extern struct in_addr bba_netmask;
extern struct in_addr bba_gateway;
extern const char *bba_device_str;
extern u32 bba_location;

void wait_network();
Expand Down
5 changes: 5 additions & 0 deletions cube/swiss/source/bba.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ int net_initialized = 0;
struct in_addr bba_localip;
struct in_addr bba_netmask;
struct in_addr bba_gateway;
const char *bba_device_str = "Broadband Adapter";
u32 bba_location = LOC_UNK;

static lwp_t net_thread = LWP_THREAD_NULL;
Expand All @@ -36,6 +37,10 @@ static void *net_thread_func(void *arg)

char ifname[4];
if (if_indextoname(1, ifname)) {
switch (ifname[0]) {
case 'e': bba_device_str = "Broadband Adapter"; break;
case 'E': bba_device_str = "ENC28J60"; break;
}
if (ifname[0] == 'E') {
switch (ifname[1]) {
case 'A': bba_location = LOC_MEMCARD_SLOT_A; break;
Expand Down
37 changes: 19 additions & 18 deletions cube/swiss/source/devices/fsp/deviceHandler-FSP.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,26 @@ s32 deviceHandler_FSP_makeDir(file_handle* dir) {
}

bool deviceHandler_FSP_test() {
char ifname[4];
if (if_indextoname(1, ifname)) {
if (ifname[0] == 'E') {
__device_fsp.hwName = "ENC28J60";
__device_fsp.features = FEAT_READ|FEAT_WRITE|FEAT_THREAD_SAFE;
__device_fsp.emulable = EMU_NONE;
}
switch (bba_location) {
case LOC_MEMCARD_SLOT_A:
case LOC_MEMCARD_SLOT_B:
__device_fsp.deviceTexture = (textureImage){TEX_GCNET, 65, 84, 72, 88};
break;
case LOC_SERIAL_PORT_2:
__device_fsp.deviceTexture = (textureImage){TEX_ETH2GC, 64, 80, 64, 80};
break;
}
__device_fsp.location = bba_location;
__device_fsp.hwName = bba_device_str;
__device_fsp.location = bba_location;

if (strcmp(bba_device_str, "Broadband Adapter")) {
__device_fsp.features = FEAT_READ | FEAT_WRITE | FEAT_THREAD_SAFE;
__device_fsp.emulable = EMU_NONE;
}
switch (bba_exists(LOC_ANY)) {
case LOC_MEMCARD_SLOT_A:
case LOC_MEMCARD_SLOT_B:
__device_fsp.deviceTexture = (textureImage){TEX_GCNET, 65, 84, 72, 88};
return true;
case LOC_SERIAL_PORT_1:
__device_fsp.deviceTexture = (textureImage){TEX_BBA, 140, 64, 140, 64};
return true;
case LOC_SERIAL_PORT_2:
__device_fsp.deviceTexture = (textureImage){TEX_ETH2GC, 64, 80, 64, 80};
return true;
}
return net_initialized || bba_exists(LOC_ANY);
return net_initialized;
}

u32 deviceHandler_FSP_emulated() {
Expand Down
31 changes: 15 additions & 16 deletions cube/swiss/source/devices/ftp/deviceHandler-FTP.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,22 @@ s32 deviceHandler_FTP_makeDir(file_handle* dir) {
}

bool deviceHandler_FTP_test() {
char ifname[4];
if (if_indextoname(1, ifname)) {
if (ifname[0] == 'E')
__device_ftp.hwName = "ENC28J60";

switch (bba_location) {
case LOC_MEMCARD_SLOT_A:
case LOC_MEMCARD_SLOT_B:
__device_ftp.deviceTexture = (textureImage){TEX_GCNET, 65, 84, 72, 88};
break;
case LOC_SERIAL_PORT_2:
__device_ftp.deviceTexture = (textureImage){TEX_ETH2GC, 64, 80, 64, 80};
break;
}
__device_ftp.location = bba_location;
__device_ftp.hwName = bba_device_str;
__device_ftp.location = bba_location;

switch (bba_exists(LOC_ANY)) {
case LOC_MEMCARD_SLOT_A:
case LOC_MEMCARD_SLOT_B:
__device_ftp.deviceTexture = (textureImage){TEX_GCNET, 65, 84, 72, 88};
return true;
case LOC_SERIAL_PORT_1:
__device_ftp.deviceTexture = (textureImage){TEX_BBA, 140, 64, 140, 64};
return true;
case LOC_SERIAL_PORT_2:
__device_ftp.deviceTexture = (textureImage){TEX_ETH2GC, 64, 80, 64, 80};
return true;
}
return net_initialized || bba_exists(LOC_ANY);
return net_initialized;
}

char* deviceHandler_FTP_status(file_handle* file) {
Expand Down
31 changes: 15 additions & 16 deletions cube/swiss/source/devices/smb/deviceHandler-SMB.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,22 @@ s32 deviceHandler_SMB_makeDir(file_handle* dir) {
}

bool deviceHandler_SMB_test() {
char ifname[4];
if (if_indextoname(1, ifname)) {
if (ifname[0] == 'E')
__device_smb.hwName = "ENC28J60";

switch (bba_location) {
case LOC_MEMCARD_SLOT_A:
case LOC_MEMCARD_SLOT_B:
__device_smb.deviceTexture = (textureImage){TEX_GCNET, 65, 84, 72, 88};
break;
case LOC_SERIAL_PORT_2:
__device_smb.deviceTexture = (textureImage){TEX_ETH2GC, 64, 80, 64, 80};
break;
}
__device_smb.location = bba_location;
__device_smb.hwName = bba_device_str;
__device_smb.location = bba_location;

switch (bba_exists(LOC_ANY)) {
case LOC_MEMCARD_SLOT_A:
case LOC_MEMCARD_SLOT_B:
__device_smb.deviceTexture = (textureImage){TEX_GCNET, 65, 84, 72, 88};
return true;
case LOC_SERIAL_PORT_1:
__device_smb.deviceTexture = (textureImage){TEX_BBA, 140, 64, 140, 64};
return true;
case LOC_SERIAL_PORT_2:
__device_smb.deviceTexture = (textureImage){TEX_ETH2GC, 64, 80, 64, 80};
return true;
}
return net_initialized || bba_exists(LOC_ANY);
return net_initialized;
}

char* deviceHandler_SMB_status(file_handle* file) {
Expand Down

0 comments on commit 94fcee5

Please sign in to comment.