Skip to content

Commit

Permalink
gui: swap out device icon and text as new block device detected
Browse files Browse the repository at this point in the history
Change all references of FireWire to iLink/ILK
  • Loading branch information
KrahJohlito committed Sep 2, 2021
1 parent 69ba293 commit d664c1d
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue-report.yml
Expand Up @@ -63,7 +63,7 @@ body:
- USB
- SMB
- HDD
- Firewire
- iLink
- MX4SIO

- type: textarea
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Expand Up @@ -68,6 +68,7 @@ FRONTEND_OBJS = pad.o fntsys.o renderman.o menusys.o OSDHistory.o system.o lang.
appsupport.o gui.o guigame.o textures.o opl.o atlas.o nbns.o httpclient.o gsm.o cheatman.o sound.o ps2cnf.o

GFX_OBJS = usb_icon.o hdd_icon.o eth_icon.o app_icon.o \
usb_bd_icon.o ilk_bd_icon.o m4s_bd_icon.o \
cross_icon.o triangle_icon.o circle_icon.o square_icon.o select_icon.o start_icon.o \
left_icon.o right_icon.o up_icon.o down_icon.o \
load0.o load1.o load2.o load3.o load4.o load5.o load6.o load7.o \
Expand Down Expand Up @@ -704,6 +705,15 @@ $(EE_ASM_DIR)load7.s: gfx/load7.png | $(EE_ASM_DIR)
$(EE_ASM_DIR)usb_icon.s: gfx/usb.png | $(EE_ASM_DIR)
$(BIN2S) $< $@ usb_png

$(EE_ASM_DIR)usb_bd_icon.s: gfx/usb_bd.png | $(EE_ASM_DIR)
$(BIN2S) $< $@ usb_bd_png

$(EE_ASM_DIR)ilk_bd_icon.s: gfx/ilk_bd.png | $(EE_ASM_DIR)
$(BIN2S) $< $@ ilk_bd_png

$(EE_ASM_DIR)m4s_bd_icon.s: gfx/m4s_bd.png | $(EE_ASM_DIR)
$(BIN2S) $< $@ m4s_bd_png

$(EE_ASM_DIR)hdd_icon.s: gfx/hdd.png | $(EE_ASM_DIR)
$(BIN2S) $< $@ hdd_png

Expand Down
2 changes: 1 addition & 1 deletion include/config.h
Expand Up @@ -87,7 +87,7 @@ enum CONFIG_INDEX {
#define CONFIG_OPL_HDD_MODE "hdd_mode"
#define CONFIG_OPL_ETH_MODE "eth_mode"
#define CONFIG_OPL_APP_MODE "app_mode"
#define CONFIG_OPL_ENABLE_FW "enable_firewire"
#define CONFIG_OPL_ENABLE_ILINK "enable_ilink"
#define CONFIG_OPL_ENABLE_MX4SIO "enable_mx4sio"
#define CONFIG_OPL_SWAP_SEL_BUTTON "swap_select_btn"
#define CONFIG_OPL_PARENTAL_LOCK_PWD "parental_lock_password"
Expand Down
2 changes: 1 addition & 1 deletion include/dialogs.h
Expand Up @@ -34,7 +34,7 @@ enum UI_ITEMS {
CFG_HDDMODE,
CFG_ETHMODE,
CFG_APPMODE,
CFG_ENABLEFW,
CFG_ENABLEILK,
CFG_ENABLEMX4SIO,
CFG_LASTPLAYED,
CFG_LBL_AUTOSTARTLAST,
Expand Down
4 changes: 2 additions & 2 deletions include/iosupport.h
Expand Up @@ -97,7 +97,7 @@ typedef struct
char *text;

/// item description in localised form (used if value is not negative)
int textId;
int (*itemTextId)(void);

/// @return path to applications storage on the device (set callback to NULL if not applicable).
void (*itemGetAppsPath)(char *path, int max);
Expand Down Expand Up @@ -140,7 +140,7 @@ typedef struct

int (*itemCheckVMC)(char *name, int createSize);

int iconId;
int (*itemIconId)(void);
} item_list_t;

#endif
3 changes: 3 additions & 0 deletions include/lang.h
Expand Up @@ -282,6 +282,9 @@ enum _STR_IDS {
_STR_CONTROLLER_SETTINGS,
_STR_HINT_BDM_START,
_STR_HINT_BLOCK_DEVICES,
_STR_USB_GAMES,
_STR_ILINK_GAMES,
_STR_MX4SIO_GAMES,

LANG_STR_COUNT
};
Expand Down
2 changes: 1 addition & 1 deletion include/opl.h
Expand Up @@ -116,7 +116,7 @@ extern int gHDDStartMode;
extern int gETHStartMode;
extern int gAPPStartMode;

extern int gEnableFW;
extern int gEnableILK;
extern int gEnableMX4SIO;

extern int gAutosort;
Expand Down
3 changes: 3 additions & 0 deletions include/textures.h
Expand Up @@ -10,7 +10,10 @@ enum INTERNAL_TEXTURE {
LOAD5_ICON,
LOAD6_ICON,
LOAD7_ICON,
BDM_ICON,
USB_ICON,
ILINK_ICON,
MX4SIO_ICON,
HDD_ICON,
ETH_ICON,
APP_ICON,
Expand Down
3 changes: 3 additions & 0 deletions lng/lang_English.lng
Expand Up @@ -299,3 +299,6 @@ Block Devices
Controller Settings
Turn on/off Block Device Manager.
Turn on/off Block Devices (e.g. USB).
USB Games
iLink Games
MX4SIO Games
2 changes: 1 addition & 1 deletion lng/lang_Spanish.lng
Expand Up @@ -278,4 +278,4 @@ Descripción
Dispositivos de bloque
Configuración del mando
Activa/Desactiva el Gestor de Dispositivos de Bloque (Block Device Manager)
Selecciona dispositivos de bloque (Ejemplo: USB, Firewire, MX4SIO)
Selecciona dispositivos de bloque (Ejemplo: USB, iLink, MX4SIO)
14 changes: 12 additions & 2 deletions src/appsupport.c
Expand Up @@ -415,6 +415,16 @@ static int appGetImage(char *folder, int isRelative, char *value, char *suffix,
return oplGetAppImage(device, folder, isRelative, startup, suffix, resultTex, psm);
}

static int appGetTextId(void)
{
return _STR_APPS;
}

static int appGetIconId(void)
{
return APP_ICON;
}

// This may be called, even if appInit() was not.
static void appCleanUp(int exception)
{
Expand All @@ -436,6 +446,6 @@ static void appShutdown(void)
}

static item_list_t appItemList = {
APP_MODE, -1, 0, MODE_FLAG_NO_COMPAT | MODE_FLAG_NO_UPDATE, MENU_MIN_INACTIVE_FRAMES, APP_MODE_UPDATE_DELAY, "Applications", _STR_APPS, NULL, NULL, NULL, &appInit, &appNeedsUpdate, &appUpdateItemList,
APP_MODE, -1, 0, MODE_FLAG_NO_COMPAT | MODE_FLAG_NO_UPDATE, MENU_MIN_INACTIVE_FRAMES, APP_MODE_UPDATE_DELAY, "Applications", &appGetTextId, NULL, NULL, NULL, &appInit, &appNeedsUpdate, &appUpdateItemList,
&appGetItemCount, NULL, &appGetItemName, &appGetItemNameLength, &appGetItemStartup, &appDeleteItem, &appRenameItem, &appLaunchItem,
&appGetConfig, &appGetImage, &appCleanUp, &appShutdown, NULL, APP_ICON};
&appGetConfig, &appGetImage, &appCleanUp, &appShutdown, NULL, &appGetIconId};
45 changes: 40 additions & 5 deletions src/bdmsupport.c
Expand Up @@ -23,7 +23,7 @@ static int bdmGameCount = 0;
static base_game_info_t *bdmGames;
static char bdmDriver[5];

static int fireWireModLoaded = 0;
static int iLinkModLoaded = 0;
static int mx4sioModLoaded = 0;

// forward declaration
Expand Down Expand Up @@ -72,12 +72,12 @@ static void bdmEventHandler(void *packet, void *opt)

static void bdmLoadBlockDeviceModules(void)
{
if (gEnableFW && !fireWireModLoaded) {
if (gEnableILK && !iLinkModLoaded) {
// Load iLink Block Device drivers
sysLoadModuleBuffer(&iLinkman_irx, size_iLinkman_irx, 0, NULL);
sysLoadModuleBuffer(&IEEE1394_bd_irx, size_IEEE1394_bd_irx, 0, NULL);

fireWireModLoaded = 1;
iLinkModLoaded = 1;
}

if (gEnableMX4SIO && !mx4sioModLoaded) {
Expand Down Expand Up @@ -147,6 +147,13 @@ static int bdmNeedsUpdate(void)

bdmFindPartition(bdmPrefix, "ul.cfg", 0);

DIR *dir = opendir("mass0:/");
if (dir != NULL) {
int *pBDMDriver = (int *)bdmDriver;
*pBDMDriver = fileXioIoctl(dir->dd_fd, USBMASS_IOCTL_GET_DRIVERNAME, "");
closedir(dir);
}

sprintf(path, "%sCD", bdmPrefix);
if (stat(path, &st) != 0)
st.st_mtime = 0;
Expand Down Expand Up @@ -405,6 +412,34 @@ static int bdmGetImage(char *folder, int isRelative, char *value, char *suffix,
return texDiscoverLoad(resultTex, path, -1);
}

static int bdmGetTextId(void)
{
int mode = _STR_BDM_GAMES;

if (!strcmp(bdmDriver, "usb"))
mode = _STR_USB_GAMES;
else if (!strcmp(bdmDriver, "sd") && strlen(bdmDriver) == 2)
mode = _STR_ILINK_GAMES;
else if (!strcmp(bdmDriver, "sdc") && strlen(bdmDriver) == 3)
mode = _STR_MX4SIO_GAMES;

return mode;
}

static int bdmGetIconId(void)
{
int mode = BDM_ICON;

if (!strcmp(bdmDriver, "usb"))
mode = USB_ICON;
else if (!strcmp(bdmDriver, "sd") && strlen(bdmDriver) == 2)
mode = ILINK_ICON;
else if (!strcmp(bdmDriver, "sdc") && strlen(bdmDriver) == 3)
mode = MX4SIO_ICON;

return mode;
}

// This may be called, even if bdmInit() was not.
static void bdmCleanUp(int exception)
{
Expand Down Expand Up @@ -452,6 +487,6 @@ static void bdmGetLegacyAppsInfo(char *path, int max, char *name)
}

static item_list_t bdmGameList = {
BDM_MODE, 2, 0, 0, MENU_MIN_INACTIVE_FRAMES, BDM_MODE_UPDATE_DELAY, "BDM Games", _STR_BDM_GAMES, &bdmGetAppsPath, &bdmGetLegacyAppsPath, &bdmGetLegacyAppsInfo, &bdmInit, &bdmNeedsUpdate,
BDM_MODE, 2, 0, 0, MENU_MIN_INACTIVE_FRAMES, BDM_MODE_UPDATE_DELAY, "BDM Games", &bdmGetTextId, &bdmGetAppsPath, &bdmGetLegacyAppsPath, &bdmGetLegacyAppsInfo, &bdmInit, &bdmNeedsUpdate,
&bdmUpdateGameList, &bdmGetGameCount, &bdmGetGame, &bdmGetGameName, &bdmGetGameNameLength, &bdmGetGameStartup, &bdmDeleteGame, &bdmRenameGame,
&bdmLaunchGame, &bdmGetConfig, &bdmGetImage, &bdmCleanUp, &bdmShutdown, &bdmCheckVMC, USB_ICON};
&bdmLaunchGame, &bdmGetConfig, &bdmGetImage, &bdmCleanUp, &bdmShutdown, &bdmCheckVMC, &bdmGetIconId};
4 changes: 2 additions & 2 deletions src/dialogs.c
Expand Up @@ -145,9 +145,9 @@ struct UIItem diaBlockDevicesConfig[] = {
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_ON}}},
{UI_BREAK},

{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"FireWire", -1}}},
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"iLink", -1}}},
{UI_SPACER},
{UI_BOOL, CFG_ENABLEFW, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
{UI_BOOL, CFG_ENABLEILK, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
{UI_BREAK},

{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"MX4SIO", -1}}},
Expand Down
14 changes: 12 additions & 2 deletions src/ethsupport.c
Expand Up @@ -719,6 +719,16 @@ static int ethGetImage(char *folder, int isRelative, char *value, char *suffix,
return texDiscoverLoad(resultTex, path, -1);
}

static int ethGetTextId(void)
{
return _STR_NET_GAMES;
}

static int ethGetIconId(void)
{
return ETH_ICON;
}

// This may be called, even if ethInit() was not.
static void ethCleanUp(int exception)
{
Expand Down Expand Up @@ -777,9 +787,9 @@ static void ethGetLegacyAppsInfo(char *path, int max, char *name)
}

static item_list_t ethGameList = {
ETH_MODE, 1, 0, 0, MENU_MIN_INACTIVE_FRAMES, ETH_MODE_UPDATE_DELAY, "ETH Games", _STR_NET_GAMES, &ethGetAppsPath, &ethGetLegacyAppsPath, &ethGetLegacyAppsInfo, &ethInit, &ethNeedsUpdate,
ETH_MODE, 1, 0, 0, MENU_MIN_INACTIVE_FRAMES, ETH_MODE_UPDATE_DELAY, "ETH Games", &ethGetTextId, &ethGetAppsPath, &ethGetLegacyAppsPath, &ethGetLegacyAppsInfo, &ethInit, &ethNeedsUpdate,
&ethUpdateGameList, &ethGetGameCount, &ethGetGame, &ethGetGameName, &ethGetGameNameLength, &ethGetGameStartup, &ethDeleteGame, &ethRenameGame,
&ethLaunchGame, &ethGetConfig, &ethGetImage, &ethCleanUp, &ethShutdown, &ethCheckVMC, ETH_ICON};
&ethLaunchGame, &ethGetConfig, &ethGetImage, &ethCleanUp, &ethShutdown, &ethCheckVMC, &ethGetIconId};

static int ethReadNetConfig(void)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui.c
Expand Up @@ -439,12 +439,12 @@ static void guiShowBlockDeviceConfig(void)
{
int ret;

diaSetInt(diaBlockDevicesConfig, CFG_ENABLEFW, gEnableFW);
diaSetInt(diaBlockDevicesConfig, CFG_ENABLEILK, gEnableILK);
diaSetInt(diaBlockDevicesConfig, CFG_ENABLEMX4SIO, gEnableMX4SIO);

ret = diaExecuteDialog(diaBlockDevicesConfig, -1, 1, NULL);
if (ret) {
diaGetInt(diaBlockDevicesConfig, CFG_ENABLEFW, &gEnableFW);
diaGetInt(diaBlockDevicesConfig, CFG_ENABLEILK, &gEnableILK);
diaGetInt(diaBlockDevicesConfig, CFG_ENABLEMX4SIO, &gEnableMX4SIO);
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/hddsupport.c
Expand Up @@ -537,6 +537,16 @@ static int hddGetImage(char *folder, int isRelative, char *value, char *suffix,
return texDiscoverLoad(resultTex, path, -1);
}

static int hddGetTextId(void)
{
return _STR_HDD_GAMES;
}

static int hddGetIconId(void)
{
return HDD_ICON;
}

// This may be called, even if hddInit() was not.
static void hddCleanUp(int exception)
{
Expand Down Expand Up @@ -707,6 +717,6 @@ static void hddGetLegacyAppsInfo(char *path, int max, char *name)
}

static item_list_t hddGameList = {
HDD_MODE, 0, 0, MODE_FLAG_COMPAT_DMA, MENU_MIN_INACTIVE_FRAMES, HDD_MODE_UPDATE_DELAY, "HDD Games", _STR_HDD_GAMES, &hddGetAppsPath, &hddGetLegacyAppsPath, &hddGetLegacyAppsInfo, &hddInit, &hddNeedsUpdate, &hddUpdateGameList,
HDD_MODE, 0, 0, MODE_FLAG_COMPAT_DMA, MENU_MIN_INACTIVE_FRAMES, HDD_MODE_UPDATE_DELAY, "HDD Games", &hddGetTextId, &hddGetAppsPath, &hddGetLegacyAppsPath, &hddGetLegacyAppsInfo, &hddInit, &hddNeedsUpdate, &hddUpdateGameList,
&hddGetGameCount, &hddGetGame, &hddGetGameName, &hddGetGameNameLength, &hddGetGameStartup, &hddDeleteGame, &hddRenameGame,
&hddLaunchGame, &hddGetConfig, &hddGetImage, &hddCleanUp, &hddShutdown, &hddCheckVMC, HDD_ICON};
&hddLaunchGame, &hddGetConfig, &hddGetImage, &hddCleanUp, &hddShutdown, &hddCheckVMC, &hddGetIconId};
3 changes: 3 additions & 0 deletions src/lang.c
Expand Up @@ -286,6 +286,9 @@ static char *internalEnglish[LANG_STR_COUNT] = {
"Controller Settings",
"Turn on/off Block Device Manager.",
"Turn on/off Block Devices (e.g. USB).",
"USB Games",
"iLink Games",
"MX4SIO Games",
};

static int guiLangID = 0;
Expand Down
16 changes: 10 additions & 6 deletions src/opl.c
Expand Up @@ -144,7 +144,7 @@ int gBDMStartMode;
int gHDDStartMode;
int gETHStartMode;
int gAPPStartMode;
int gEnableFW;
int gEnableILK;
int gEnableMX4SIO;
int gAutosort;
int gAutoRefresh;
Expand Down Expand Up @@ -309,9 +309,9 @@ static void itemExecTriangle(struct menu_item *curMenu)
static void initMenuForListSupport(int mode)
{
opl_io_module_t *mod = &list_support[mode];
mod->menuItem.icon_id = mod->support->iconId;
mod->menuItem.icon_id = mod->support->itemIconId();
mod->menuItem.text = NULL;
mod->menuItem.text_id = mod->support->textId;
mod->menuItem.text_id = mod->support->itemTextId();

mod->menuItem.userdata = mod->support;

Expand Down Expand Up @@ -596,6 +596,10 @@ static void updateMenuFromGameList(opl_io_module_t *mdl)
if (gRememberLastPlayed)
configGetStr(configGetByType(CONFIG_LAST), "last_played", &temp);

// refresh device icon and text (for bdm)
mdl->menuItem.icon_id = mdl->support->itemIconId();
mdl->menuItem.text_id = mdl->support->itemTextId();

// read the new game list
struct gui_update_t *gup = NULL;
int count = mdl->support->itemUpdate();
Expand Down Expand Up @@ -854,7 +858,7 @@ static void _loadConfig()
configGetInt(configOPL, CONFIG_OPL_HDD_MODE, &gHDDStartMode);
configGetInt(configOPL, CONFIG_OPL_ETH_MODE, &gETHStartMode);
configGetInt(configOPL, CONFIG_OPL_APP_MODE, &gAPPStartMode);
configGetInt(configOPL, CONFIG_OPL_ENABLE_FW, &gEnableFW);
configGetInt(configOPL, CONFIG_OPL_ENABLE_ILINK, &gEnableILK);
configGetInt(configOPL, CONFIG_OPL_ENABLE_MX4SIO, &gEnableMX4SIO);
configGetInt(configOPL, CONFIG_OPL_SFX, &gEnableSFX);
configGetInt(configOPL, CONFIG_OPL_BOOT_SND, &gEnableBootSND);
Expand Down Expand Up @@ -1005,7 +1009,7 @@ static void _saveConfig()
configSetInt(configOPL, CONFIG_OPL_HDD_MODE, gHDDStartMode);
configSetInt(configOPL, CONFIG_OPL_ETH_MODE, gETHStartMode);
configSetInt(configOPL, CONFIG_OPL_APP_MODE, gAPPStartMode);
configSetInt(configOPL, CONFIG_OPL_ENABLE_FW, gEnableFW);
configSetInt(configOPL, CONFIG_OPL_ENABLE_ILINK, gEnableILK);
configSetInt(configOPL, CONFIG_OPL_ENABLE_MX4SIO, gEnableMX4SIO);
configSetInt(configOPL, CONFIG_OPL_SFX, gEnableSFX);
configSetInt(configOPL, CONFIG_OPL_BOOT_SND, gEnableBootSND);
Expand Down Expand Up @@ -1598,7 +1602,7 @@ static void setDefaults(void)
gETHStartMode = START_MODE_DISABLED;
gAPPStartMode = START_MODE_DISABLED;

gEnableFW = 0;
gEnableILK = 0;
gEnableMX4SIO = 0;

frameCounter = 0;
Expand Down
10 changes: 8 additions & 2 deletions src/textures.c
Expand Up @@ -13,7 +13,10 @@ extern void *load4_png;
extern void *load5_png;
extern void *load6_png;
extern void *load7_png;
extern void *usb_png;
extern void *usb_png; // Leave BDM Icon as usb.png to maintain theme compat
extern void *usb_bd_png;
extern void *ilk_bd_png;
extern void *m4s_bd_png;
extern void *hdd_png;
extern void *eth_png;
extern void *app_png;
Expand Down Expand Up @@ -111,7 +114,10 @@ static texture_t internalDefault[TEXTURES_COUNT] = {
{LOAD5_ICON, "load5", &load5_png},
{LOAD6_ICON, "load6", &load6_png},
{LOAD7_ICON, "load7", &load7_png},
{USB_ICON, "usb", &usb_png},
{BDM_ICON, "usb", &usb_png},
{USB_ICON, "usb_bd", &usb_bd_png},
{ILINK_ICON, "ilk_bd", &ilk_bd_png},
{MX4SIO_ICON, "m4s_bd", &m4s_bd_png},
{HDD_ICON, "hdd", &hdd_png},
{ETH_ICON, "eth", &eth_png},
{APP_ICON, "app", &app_png},
Expand Down

0 comments on commit d664c1d

Please sign in to comment.