Skip to content

Commit

Permalink
Added Wii Remote +Control Pad as analog source.
Browse files Browse the repository at this point in the history
Added AutoLoadSave option.
Fixed regression from 03b282c.
  • Loading branch information
Extrems committed Aug 29, 2021
1 parent e2dda13 commit 75c0d1a
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 69 deletions.
14 changes: 12 additions & 2 deletions gc_input/controller-WiimoteNunchuk.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static float getStickValue(joystick_t* j, int axis, float maxAbsValue){
enum {
NUNCHUK_AS_ANALOG, IR_AS_ANALOG,
TILT_AS_ANALOG, WHEEL_AS_ANALOG,
NO_ANALOG,
BUTTON_AS_ANALOG, NO_ANALOG,
};

enum {
Expand Down Expand Up @@ -84,7 +84,8 @@ static button_t analog_sources_wm[] = {
{ 0, TILT_AS_ANALOG, "Tilt" },
{ 1, WHEEL_AS_ANALOG, "Wheel" },
{ 2, IR_AS_ANALOG, "IR" },
{ 3, NO_ANALOG, "None" },
{ 3, BUTTON_AS_ANALOG, "D-Pad" },
{ 4, NO_ANALOG, "None" },
};

static button_t menu_combos[] = {
Expand Down Expand Up @@ -147,6 +148,15 @@ static int _GetKeys(int Control, BUTTONS * Keys, controller_config_t* config,
} else if(config->analog->mask == WHEEL_AS_ANALOG){
c->X_AXIS = 512 - wpad->accel.y;
c->Y_AXIS = wpad->accel.z - 512;
} else if(config->analog->mask == BUTTON_AS_ANALOG){
if(b & WPAD_BUTTON_DOWN)
c->X_AXIS = +80;
else if(b & WPAD_BUTTON_UP)
c->X_AXIS = -80;
if(b & WPAD_BUTTON_RIGHT)
c->Y_AXIS = +80;
else if(b & WPAD_BUTTON_LEFT)
c->Y_AXIS = -80;
}
if(config->invertedY) c->Y_AXIS = -c->Y_AXIS;

Expand Down
74 changes: 37 additions & 37 deletions glN64_GX/Textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,23 +383,23 @@ const struct
{ // 4-bit
{ GXGetI4_IA4, GX_TF_IA4, 1, 4, 8192 }, // RGBA as I
{ GetNone, GX_TF_I4, 0, 4, 8192 }, // YUV
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // CI without palette
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // CI as I (FIXME)
{ GXGetIA31_IA4, GX_TF_IA4, 1, 4, 8192 }, // IA
{ GXGetI4_IA4, GX_TF_IA4, 1, 4, 8192 }, // I
},
{ // 8-bit
{ GXGetI8_IA8, GX_TF_IA8, 2, 3, 4096 }, // RGBA as I
{ GetNone, GX_TF_I4, 0, 3, 4096 }, // YUV
{ GXGetI8_IA8, GX_TF_IA8, 2, 3, 4096 }, // CI without palette
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // CI as I (FIXME)
{ GXGetIA44_IA4, GX_TF_IA4, 1, 3, 4096 }, // IA
{ GXGetI8_IA8, GX_TF_IA8, 2, 3, 4096 }, // I
},
{ // 16-bit
{ GXGetRGBA5551_RGB5A3, GX_TF_RGB5A3, 2, 2, 2048 }, // RGBA
{ GXGetUYVY8888_RGBA8, GX_TF_RGBA8, 4, 2, 2048 }, // YUV
{ GXGetIA88_IA8, GX_TF_IA8, 2, 2, 2048 }, // CI as IA
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // CI as I (FIXME)
{ GXGetIA88_IA8, GX_TF_IA8, 2, 2, 2048 }, // IA
{ GetNone, GX_TF_I4, 0, 2, 2048 }, // I
{ GXGetIA88_IA8, GX_TF_RGBA8, 4, 2, 2048 }, // I
},
{ // 32-bit
{ GXGetRGBA8888_RGBA8, GX_TF_RGBA8, 4, 2, 1024 }, // RGBA
Expand All @@ -411,28 +411,28 @@ const struct
},
{ // DUMMY
{ // 4-bit
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // CI (Banjo-Kazooie uses this, doesn't make sense, but it works...)
{ GetNone, GX_TF_I4, 0, 4, 4096 }, // YUV
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 4, 4096 }, // YUV as CI
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // CI
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // IA as CI
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // I as CI
},
{ // 8-bit
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // RGBA
{ GetNone, GX_TF_I4, 0, 3, 2048 }, // YUV
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 3, 2048 }, // YUV as CI
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // CI
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // IA as CI
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // I as CI
},
{ // 16-bit
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // RGBA
{ GXGetUYVY8888_RGBA8, GX_TF_RGBA8, 4, 2, 2048 }, // YUV
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // CI
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // YUV as CI
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // CI
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // IA as CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // I
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // I as CI
},
{ // 32-bit
{ GXGetRGBA8888_RGBA8, GX_TF_RGBA8, 4, 2, 1024 }, // RGBA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // RGBA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // YUV
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // IA
Expand All @@ -441,28 +441,28 @@ const struct
},
{ // G_TT_RGBA16
{ // 4-bit
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // CI (Banjo-Kazooie uses this, doesn't make sense, but it works...)
{ GetNone, GX_TF_I4, 0, 4, 4096 }, // YUV
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 4, 4096 }, // YUV as CI
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // CI
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // IA as CI
{ GXGetCI4RGBA_RGB5A3, GX_TF_RGB5A3, 2, 4, 4096 }, // I as CI
},
{ // 8-bit
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // RGBA
{ GetNone, GX_TF_I4, 0, 3, 2048 }, // YUV
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 3, 2048 }, // YUV as CI
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // CI
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // IA as CI
{ GXGetCI8RGBA_RGB5A3, GX_TF_RGB5A3, 2, 3, 2048 }, // I as CI
},
{ // 16-bit
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // RGBA
{ GXGetUYVY8888_RGBA8, GX_TF_RGBA8, 4, 2, 2048 }, // YUV
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // CI
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // YUV as CI
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // CI
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // IA as CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // I
{ GXGetCI16RGBA_RGB5A3, GX_TF_RGB5A3, 2, 2, 1024 }, // I as CI
},
{ // 32-bit
{ GXGetRGBA8888_RGBA8, GX_TF_RGBA8, 4, 2, 1024 }, // RGBA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // RGBA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // YUV
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // IA
Expand All @@ -471,28 +471,28 @@ const struct
},
{ // G_TT_IA16
{ // 4-bit
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // IA
{ GetNone, GX_TF_I4, 0, 4, 4096 }, // YUV
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 4, 4096 }, // YUV as CI
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // CI
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // IA
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // I
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // IA as CI
{ GXGetCI4IA_IA8, GX_TF_IA8, 2, 4, 4096 }, // I as CI
},
{ // 8-bit
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // RGBA
{ GetNone, GX_TF_I4, 0, 3, 2048 }, // YUV
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 3, 2048 }, // YUV as CI
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // CI
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // IA
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // I
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // IA as CI
{ GXGetCI8IA_IA8, GX_TF_IA8, 2, 3, 2048 }, // I as CI
},
{ // 16-bit
{ GXGetCI16IA_IA8, GX_TF_IA8, 2, 2, 1024 }, // RGBA
{ GXGetUYVY8888_RGBA8, GX_TF_RGBA8, 4, 2, 2048 }, // YUV
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // CI
{ GXGetCI16IA_IA8, GX_TF_IA8, 2, 2, 1024 }, // IA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // I
{ GXGetCI16IA_IA8, GX_TF_IA8, 2, 2, 1024 }, // RGBA as CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // YUV as CI
{ GXGetCI16IA_IA8, GX_TF_IA8, 2, 2, 1024 }, // CI
{ GXGetCI16IA_IA8, GX_TF_IA8, 2, 2, 1024 }, // IA as CI
{ GXGetCI16IA_IA8, GX_TF_IA8, 2, 2, 1024 }, // I as CI
},
{ // 32-bit
{ GXGetRGBA8888_RGBA8, GX_TF_RGBA8, 4, 2, 1024 }, // RGBA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // RGBA
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // YUV
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // CI
{ GetNone, GX_TF_I4, 0, 2, 1024 }, // IA
Expand Down Expand Up @@ -1520,7 +1520,7 @@ u32 TextureCache_CalculateCRC( u32 t, u32 width, u32 height )
crc = Hash_Calculate( crc, src, bpl );
}

if (gDP.otherMode.textureLUT != G_TT_NONE)
if ((gDP.otherMode.textureLUT != G_TT_NONE) || (gSP.textureTile[t]->format == G_IM_FMT_CI))
{
if (gSP.textureTile[t]->size == G_IM_SIZ_4b)
crc = Hash_Calculate( crc, &TMEM[0x100 + (gSP.textureTile[t]->palette << 4)], 128 );
Expand Down
16 changes: 9 additions & 7 deletions main/main_gc-menu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ char renderCpuFramebuffer;
extern timers Timers;
char menuActive;
char skipMenu;
char saveEnabled;
char creditsScrolling;
char shutdown = 0;
char nativeSaveDevice;
char saveStateDevice;
char autoLoadSave;
char autoSave;
char screenMode = 0;
char videoFormat;
Expand Down Expand Up @@ -164,6 +164,7 @@ static struct {
{ "CountPerOp", ((char*)&count_per_op)+3, COUNT_PER_OP_1, COUNT_PER_OP_3 },
{ "NativeDevice", &nativeSaveDevice, NATIVESAVEDEVICE_SD, NATIVESAVEDEVICE_CARDB },
{ "StatesDevice", &saveStateDevice, SAVESTATEDEVICE_SD, SAVESTATEDEVICE_FAT },
{ "AutoLoadSave", &autoLoadSave, AUTOLOADSAVE_DISABLE, AUTOLOADSAVE_ENABLE },
{ "AutoSave", &autoSave, AUTOSAVE_DISABLE, AUTOSAVE_ENABLE },
{ "LimitVIs", &Timers.limitVIs, LIMITVIS_NONE, LIMITVIS_WAIT_FOR_FRAME },
{ "PollRate", &pollRate, POLLRATE_VSYNC, POLLRATE_11MS },
Expand Down Expand Up @@ -251,6 +252,7 @@ int main(int argc, char* argv[]){
printToScreen = 1; // Show DEBUG text on screen
printToSD = 0; // Disable SD logging
Timers.limitVIs = 1;
autoLoadSave = 1; // Auto Load Save File
autoSave = 1; // Auto Save Game
dynacore = 1; // Dynarec
#ifndef HW_RVL
Expand Down Expand Up @@ -438,7 +440,7 @@ extern BOOL mempakWritten;
extern BOOL sramWritten;
extern BOOL flashramWritten;
BOOL hasLoadedROM = FALSE;
int autoSaveLoaded = NATIVESAVEDEVICE_NONE;
int autoLoadedSave = NATIVESAVEDEVICE_NONE;

int loadROM(fileBrowser_file* rom){
int ret = 0;
Expand Down Expand Up @@ -506,7 +508,7 @@ int loadROM(fileBrowser_file* rom){

cpu_init();

if(autoSave==AUTOSAVE_ENABLE) {
if(autoLoadSave==AUTOLOADSAVE_ENABLE) {
switch (nativeSaveDevice)
{
case NATIVESAVEDEVICE_SD:
Expand Down Expand Up @@ -541,19 +543,19 @@ int loadROM(fileBrowser_file* rom){
{
case NATIVESAVEDEVICE_SD:
// if (result) menu::MessageBox::getInstance().setMessage("Found & loaded save from SD card");
if (result) autoSaveLoaded = NATIVESAVEDEVICE_SD;
if (result) autoLoadedSave = NATIVESAVEDEVICE_SD;
break;
case NATIVESAVEDEVICE_FAT:
// if (result) menu::MessageBox::getInstance().setMessage("Found & loaded save from FAT device");
if (result) autoSaveLoaded = NATIVESAVEDEVICE_FAT;
if (result) autoLoadedSave = NATIVESAVEDEVICE_FAT;
break;
case NATIVESAVEDEVICE_CARDA:
// if (result) menu::MessageBox::getInstance().setMessage("Found & loaded save from Memory Card A");
if (result) autoSaveLoaded = NATIVESAVEDEVICE_CARDA;
if (result) autoLoadedSave = NATIVESAVEDEVICE_CARDA;
break;
case NATIVESAVEDEVICE_CARDB:
// if (result) menu::MessageBox::getInstance().setMessage("Found & loaded save from Memory Card B");
if (result) autoSaveLoaded = NATIVESAVEDEVICE_CARDB;
if (result) autoLoadedSave = NATIVESAVEDEVICE_CARDB;
break;
}
}
Expand Down
11 changes: 8 additions & 3 deletions main/wii64config.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ enum limitVIs
LIMITVIS_WAIT_FOR_FRAME
};

extern char saveEnabled; //???

extern char nativeSaveDevice;
enum nativeSaveDevice
{
Expand All @@ -96,7 +94,14 @@ enum saveStateDevice
SAVESTATEDEVICE_FAT
};

extern char autoSave; //TODO: Use me
extern char autoLoadSave;
enum autoLoadSave
{
AUTOLOADSAVE_DISABLE=0,
AUTOLOADSAVE_ENABLE
};

extern char autoSave;
enum autoSave
{
AUTOSAVE_DISABLE=0,
Expand Down
6 changes: 3 additions & 3 deletions menu/FileBrowserFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ void fileBrowserFrame_FillPage()

extern BOOL hasLoadedROM;
extern int rom_length;
extern int autoSaveLoaded;
extern int autoLoadedSave;
void Func_PlayGame();
void Func_SetPlayGame();

Expand Down Expand Up @@ -493,7 +493,7 @@ void fileBrowserFrame_LoadFile(int i)
countrycodestring(ROM_HEADER.Country_code&0xFF, buffer2);
sprintf(buffer,"Country: %s\n",buffer2);
strcat(RomInfo,buffer);
switch (autoSaveLoaded)
switch (autoLoadedSave)
{
case NATIVESAVEDEVICE_NONE:
break;
Expand All @@ -510,7 +510,7 @@ void fileBrowserFrame_LoadFile(int i)
strcat(RomInfo,"\nFound & loaded save from Memory Card B\n");
break;
}
autoSaveLoaded = NATIVESAVEDEVICE_NONE;
autoLoadedSave = NATIVESAVEDEVICE_NONE;

menu::MessageBox::getInstance().setMessage(RomInfo);
pMenuContext->setActiveFrame(MenuContext::FRAME_MAIN);
Expand Down
Loading

0 comments on commit 75c0d1a

Please sign in to comment.