Skip to content

Commit

Permalink
- Disable game settings not supported by current device.
Browse files Browse the repository at this point in the history
- Show total disc number and found status.
  • Loading branch information
Extrems committed Sep 18, 2020
1 parent c0df4ec commit 4715a64
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
3 changes: 2 additions & 1 deletion cube/swiss/source/devices/deviceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ typedef device_info* (* _fn_deviceInfo)(void);
// Device emulated features
#define EMU_NONE 0x0
#define EMU_READ 0x1
#define EMU_AUDIO_STREAMING 0x2
#define EMU_READ_SPEED 0x2
#define EMU_AUDIO_STREAMING 0x4

// Device locations
#define LOC_MEMCARD_SLOT_A 0x1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ DEVICEHANDLER_INTERFACE __device_gcloader = {
"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,
EMU_NONE,
EMU_READ_SPEED,
LOC_DVD_CONNECTOR,
&initial_GCLOADER,
(_fn_test)&deviceHandler_GCLOADER_test,
Expand Down
48 changes: 26 additions & 22 deletions cube/swiss/source/gui/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,35 +235,37 @@ uiDrawObj_t* settings_draw_page(int page_num, int option, file_handle *file, Con
}
else if(page_num == PAGE_GAME_DEFAULTS) {
DrawAddChild(page, DrawLabel(page_x_ofs_key, 65, "Default Game Settings (4/5):"));
bool enableGameVideoPatches = !swissSettings.disableVideoPatches;
drawSettingEntryString(page, &page_y_ofs, "Force Video Mode:", gameVModeStr[swissSettings.gameVMode], option == SET_DEFAULT_FORCE_VIDEOMODE, enableGameVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Horizontal Scale:", forceHScaleStr[swissSettings.forceHScale], option == SET_DEFAULT_HORIZ_SCALE, enableGameVideoPatches);
bool enabledVideoPatches = !swissSettings.disableVideoPatches;
bool emulatedReadSpeed = devices[DEVICE_CUR] == NULL || (devices[DEVICE_CUR]->emulate & EMU_READ_SPEED);
drawSettingEntryString(page, &page_y_ofs, "Force Video Mode:", gameVModeStr[swissSettings.gameVMode], option == SET_DEFAULT_FORCE_VIDEOMODE, enabledVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Horizontal Scale:", forceHScaleStr[swissSettings.forceHScale], option == SET_DEFAULT_HORIZ_SCALE, enabledVideoPatches);
sprintf(forceVOffsetStr, "%+hi", swissSettings.forceVOffset);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Offset:", forceVOffsetStr, option == SET_DEFAULT_VERT_OFFSET, enableGameVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Filter:", forceVFilterStr[swissSettings.forceVFilter], option == SET_DEFAULT_VERT_FILTER, enableGameVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Disable Alpha Dithering:", swissSettings.disableDithering, option == SET_DEFAULT_ALPHA_DITHER, enableGameVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Offset:", forceVOffsetStr, option == SET_DEFAULT_VERT_OFFSET, enabledVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Filter:", forceVFilterStr[swissSettings.forceVFilter], option == SET_DEFAULT_VERT_FILTER, enabledVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Disable Alpha Dithering:", swissSettings.disableDithering, option == SET_DEFAULT_ALPHA_DITHER, enabledVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Force Anisotropic Filter:", swissSettings.forceAnisotropy, option == SET_DEFAULT_ANISO_FILTER, true);
drawSettingEntryString(page, &page_y_ofs, "Force Widescreen:", forceWidescreenStr[swissSettings.forceWidescreen], option == SET_DEFAULT_WIDESCREEN, true);
drawSettingEntryString(page, &page_y_ofs, "Force Text Encoding:", forceEncodingStr[swissSettings.forceEncoding], option == SET_DEFAULT_TEXT_ENCODING, true);
drawSettingEntryString(page, &page_y_ofs, "Invert Camera Stick:", invertCStickStr[swissSettings.invertCStick], option == SET_DEFAULT_INVERT_CAMERA, true);
drawSettingEntryBoolean(page, &page_y_ofs, "Emulate Read Speed:", swissSettings.emulateReadSpeed, option == SET_DEFAULT_READ_SPEED, true);
drawSettingEntryBoolean(page, &page_y_ofs, "Emulate Read Speed:", swissSettings.emulateReadSpeed, option == SET_DEFAULT_READ_SPEED, emulatedReadSpeed);
}
else if(page_num == PAGE_GAME) {
DrawAddChild(page, DrawLabel(page_x_ofs_key, 65, "Current Game Settings (5/5):"));
bool enableGamePatches = file != NULL && gameConfig != NULL;
if(enableGamePatches) {
bool enableGameVideoPatches = enableGamePatches && !swissSettings.disableVideoPatches;
drawSettingEntryString(page, &page_y_ofs, "Force Video Mode:", gameVModeStr[gameConfig->gameVMode], option == SET_FORCE_VIDEOMODE, enableGameVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Horizontal Scale:", forceHScaleStr[gameConfig->forceHScale], option == SET_HORIZ_SCALE, enableGameVideoPatches);
bool enabledGamePatches = file != NULL && gameConfig != NULL;
if(enabledGamePatches) {
bool enabledVideoPatches = !swissSettings.disableVideoPatches;
bool emulatedReadSpeed = devices[DEVICE_CUR] == NULL || (devices[DEVICE_CUR]->emulate & EMU_READ_SPEED);
drawSettingEntryString(page, &page_y_ofs, "Force Video Mode:", gameVModeStr[gameConfig->gameVMode], option == SET_FORCE_VIDEOMODE, enabledVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Horizontal Scale:", forceHScaleStr[gameConfig->forceHScale], option == SET_HORIZ_SCALE, enabledVideoPatches);
sprintf(forceVOffsetStr, "%+hi", gameConfig->forceVOffset);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Offset:", forceVOffsetStr, option == SET_VERT_OFFSET, enableGameVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Filter:", forceVFilterStr[gameConfig->forceVFilter], option == SET_VERT_FILTER, enableGameVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Disable Alpha Dithering:", gameConfig->disableDithering, option == SET_ALPHA_DITHER, enableGameVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Force Anisotropic Filter:", gameConfig->forceAnisotropy, option == SET_ANISO_FILTER, enableGamePatches);
drawSettingEntryString(page, &page_y_ofs, "Force Widescreen:", forceWidescreenStr[gameConfig->forceWidescreen], option == SET_WIDESCREEN, enableGamePatches);
drawSettingEntryString(page, &page_y_ofs, "Force Text Encoding:", forceEncodingStr[gameConfig->forceEncoding], option == SET_TEXT_ENCODING, enableGamePatches);
drawSettingEntryString(page, &page_y_ofs, "Invert Camera Stick:", invertCStickStr[gameConfig->invertCStick], option == SET_INVERT_CAMERA, enableGamePatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Emulate Read Speed:", gameConfig->emulateReadSpeed, option == SET_READ_SPEED, enableGamePatches);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Offset:", forceVOffsetStr, option == SET_VERT_OFFSET, enabledVideoPatches);
drawSettingEntryString(page, &page_y_ofs, "Force Vertical Filter:", forceVFilterStr[gameConfig->forceVFilter], option == SET_VERT_FILTER, enabledVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Disable Alpha Dithering:", gameConfig->disableDithering, option == SET_ALPHA_DITHER, enabledVideoPatches);
drawSettingEntryBoolean(page, &page_y_ofs, "Force Anisotropic Filter:", gameConfig->forceAnisotropy, option == SET_ANISO_FILTER, true);
drawSettingEntryString(page, &page_y_ofs, "Force Widescreen:", forceWidescreenStr[gameConfig->forceWidescreen], option == SET_WIDESCREEN, true);
drawSettingEntryString(page, &page_y_ofs, "Force Text Encoding:", forceEncodingStr[gameConfig->forceEncoding], option == SET_TEXT_ENCODING, true);
drawSettingEntryString(page, &page_y_ofs, "Invert Camera Stick:", invertCStickStr[gameConfig->invertCStick], option == SET_INVERT_CAMERA, true);
drawSettingEntryBoolean(page, &page_y_ofs, "Emulate Read Speed:", gameConfig->emulateReadSpeed, option == SET_READ_SPEED, emulatedReadSpeed);
}
else {
// Just draw the defaults again
Expand Down Expand Up @@ -521,7 +523,8 @@ void settings_toggle(int page, int option, int direction, file_handle *file, Con
swissSettings.invertCStick = 3;
break;
case SET_DEFAULT_READ_SPEED:
swissSettings.emulateReadSpeed ^= 1;
if(devices[DEVICE_CUR] == NULL || (devices[DEVICE_CUR]->emulate & EMU_READ_SPEED))
swissSettings.emulateReadSpeed ^= 1;
break;
}
}
Expand Down Expand Up @@ -603,7 +606,8 @@ void settings_toggle(int page, int option, int direction, file_handle *file, Con
gameConfig->invertCStick = 3;
break;
case SET_READ_SPEED:
gameConfig->emulateReadSpeed ^= 1;
if(devices[DEVICE_CUR] == NULL || (devices[DEVICE_CUR]->emulate & EMU_READ_SPEED))
gameConfig->emulateReadSpeed ^= 1;
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions cube/swiss/source/swiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1738,9 +1738,9 @@ uiDrawObj_t* draw_game_info() {
sprintf(txtbuffer, "Game ID: [%.6s] Audio Streaming: [%s]", (char*)&GCMDisk, (GCMDisk.AudioStreaming ? "Yes":"No"));
DrawAddChild(container, DrawStyledLabel(640/2, 200, txtbuffer, 0.8f, true, defaultColor));

if(meta_find_disk2(&curFile)) {
sprintf(txtbuffer, "Disc %i", GCMDisk.DiscID+1);
DrawAddChild(container, DrawStyledLabel(640/2, 220, txtbuffer, 0.8f, true, defaultColor));
if(GCMDisk.TotalDisc > 1) {
sprintf(txtbuffer, "Disc %i/%i [Found: %s]", GCMDisk.DiscID+1, GCMDisk.TotalDisc, meta_find_disk2(&curFile) ? "Yes":"No");
DrawAddChild(container, DrawStyledLabel(640/2, 220, txtbuffer, 0.6f, true, defaultColor));
}
}
if(devices[DEVICE_CUR] == &__device_wode) {
Expand Down

0 comments on commit 4715a64

Please sign in to comment.