mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
- Superscope support for wiimote and GC controller
- Fixed Multitap
This commit is contained in:
parent
66b4f278f6
commit
1478cee2a3
@ -336,7 +336,8 @@ static char emulatorOptions[][20] = { "Reverse Stereo OFF",
|
|||||||
"Interp. Sound ON", "Transparency ON", "FPS Display OFF",
|
"Interp. Sound ON", "Transparency ON", "FPS Display OFF",
|
||||||
"MultiTap 5 OFF", "C-Stick Zoom OFF",
|
"MultiTap 5 OFF", "C-Stick Zoom OFF",
|
||||||
"Auto Load OFF", "Auto Save OFF", "Verify MC Saves OFF",
|
"Auto Load OFF", "Auto Save OFF", "Verify MC Saves OFF",
|
||||||
"Video Filtering OFF", "Save Prefs Now", "Return to previous"
|
"Video Filtering OFF", "Superscope OFF",
|
||||||
|
"Save Prefs Now", "Return to previous"
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -381,8 +382,11 @@ EmulatorOptions ()
|
|||||||
|
|
||||||
sprintf (emulatorOptions[9], "Video Filtering %s",
|
sprintf (emulatorOptions[9], "Video Filtering %s",
|
||||||
GCSettings.render == true ? " ON" : "OFF");
|
GCSettings.render == true ? " ON" : "OFF");
|
||||||
|
|
||||||
|
if (GCSettings.Superscope > 0) sprintf (emulatorOptions[10], "Superscope: Pad %d", GCSettings.Superscope);
|
||||||
|
else sprintf (emulatorOptions[10], "Superscope OFF");
|
||||||
|
|
||||||
ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options");
|
ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options", 18);
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
@ -440,11 +444,17 @@ EmulatorOptions ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
|
GCSettings.Superscope ++;
|
||||||
|
if (GCSettings.Superscope > 4)
|
||||||
|
GCSettings.Superscope = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
quickSavePrefs(NOTSILENT);
|
quickSavePrefs(NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
case 11:
|
case 12:
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -875,4 +885,7 @@ mainmenu ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReInitGCVideo(); // update video after reading settings
|
ReInitGCVideo(); // update video after reading settings
|
||||||
|
Settings.SuperScopeMaster = (GCSettings.Superscope > 0 ? true : false); // update superscope settings
|
||||||
|
// update mouse/justifier info?
|
||||||
|
SetControllers();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ extern unsigned int wmpadmap[];
|
|||||||
extern unsigned int ccpadmap[];
|
extern unsigned int ccpadmap[];
|
||||||
extern unsigned int ncpadmap[];
|
extern unsigned int ncpadmap[];
|
||||||
|
|
||||||
#define PREFSVERSTRING "Snes9x GX 004 Prefs"
|
#define PREFSVERSTRING "Snes9x GX 004a Prefs"
|
||||||
|
|
||||||
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ DefaultSettings ()
|
|||||||
memset (&Settings, 0, sizeof (Settings));
|
memset (&Settings, 0, sizeof (Settings));
|
||||||
|
|
||||||
/*** General ***/
|
/*** General ***/
|
||||||
Settings.MouseMaster = true;
|
Settings.MouseMaster = false;
|
||||||
Settings.SuperScopeMaster = true;
|
Settings.SuperScopeMaster = false;
|
||||||
Settings.MultiPlayer5Master = false;
|
Settings.MultiPlayer5Master = false;
|
||||||
Settings.JustifierMaster = true;
|
Settings.JustifierMaster = true;
|
||||||
Settings.ShutdownMaster = false;
|
Settings.ShutdownMaster = false;
|
||||||
@ -219,6 +219,8 @@ DefaultSettings ()
|
|||||||
GCSettings.NGCZoom = 0;
|
GCSettings.NGCZoom = 0;
|
||||||
GCSettings.VerifySaves = 0;
|
GCSettings.VerifySaves = 0;
|
||||||
GCSettings.render = 0;
|
GCSettings.render = 0;
|
||||||
|
GCSettings.Superscope = 0;
|
||||||
|
GCSettings.Mouse = 0;
|
||||||
|
|
||||||
Settings.ForceNTSC = 0;
|
Settings.ForceNTSC = 0;
|
||||||
Settings.ForcePAL = 0;
|
Settings.ForcePAL = 0;
|
||||||
|
@ -252,28 +252,50 @@ unsigned int gcscopemap[] = { PAD_TRIGGER_Z, PAD_BUTTON_B,
|
|||||||
PAD_BUTTON_A, PAD_BUTTON_Y,
|
PAD_BUTTON_A, PAD_BUTTON_Y,
|
||||||
PAD_BUTTON_START
|
PAD_BUTTON_START
|
||||||
};
|
};
|
||||||
|
/*** Superscope : wiimote button mapping ***/
|
||||||
|
unsigned int wmscopemap[] = { WPAD_BUTTON_MINUS, WPAD_BUTTON_B,
|
||||||
|
WPAD_BUTTON_A, WPAD_BUTTON_DOWN,
|
||||||
|
WPAD_BUTTON_PLUS
|
||||||
|
};
|
||||||
|
|
||||||
void UpdateCursorPosition (int input_x, int input_y, int &pos_x, int &pos_y)
|
void UpdateCursorPosition (int pad, int &pos_x, int &pos_y)
|
||||||
{
|
{
|
||||||
|
// gc left joystick
|
||||||
|
signed char pad_x = PAD_StickX (pad);
|
||||||
|
signed char pad_y = PAD_StickY (pad);
|
||||||
int SCOPEPADCAL = 30;
|
int SCOPEPADCAL = 30;
|
||||||
|
#ifdef HW_RVL
|
||||||
|
// wiimote ir
|
||||||
|
struct ir_t ir;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (input_x > SCOPEPADCAL){
|
if (pad_x > SCOPEPADCAL){
|
||||||
pos_x +=4;
|
pos_x +=4;
|
||||||
if (pos_x > 256) pos_x = 256;
|
if (pos_x > 256) pos_x = 256;
|
||||||
}
|
}
|
||||||
if (input_x < -SCOPEPADCAL){
|
if (pad_x < -SCOPEPADCAL){
|
||||||
pos_x -=4;
|
pos_x -=4;
|
||||||
if (pos_x < 0) pos_x = 0;
|
if (pos_x < 0) pos_x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_y < -SCOPEPADCAL){
|
if (pad_y < -SCOPEPADCAL){
|
||||||
pos_y +=4;
|
pos_y +=4;
|
||||||
if (pos_y > 224) pos_y = 224;
|
if (pos_y > 224) pos_y = 224;
|
||||||
}
|
}
|
||||||
if (input_y > SCOPEPADCAL){
|
if (pad_y > SCOPEPADCAL){
|
||||||
pos_y -=4;
|
pos_y -=4;
|
||||||
if (pos_y < 0) pos_y = 0;
|
if (pos_y < 0) pos_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
// read wiimote IR
|
||||||
|
WPAD_IR(pad, &ir);
|
||||||
|
if (ir.valid)
|
||||||
|
{
|
||||||
|
scope_x = (ir.x * 256) / 640;
|
||||||
|
scope_y = (ir.y * 224) / 480;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,20 +414,24 @@ decodepad (int pad)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*** Superscope ***/
|
/*** Superscope ***/
|
||||||
if (pad == 0 && Settings.SuperScopeMaster) // report only once
|
if (pad == GCSettings.Superscope-1) // report only once
|
||||||
{
|
{
|
||||||
// buttons
|
// buttons
|
||||||
offset = 0x50;
|
offset = 0x50;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if ( jp & gcscopemap[i] )
|
if ( jp & gcscopemap[i]
|
||||||
|
#ifdef HW_RVL
|
||||||
|
|| wp & wmscopemap[i]
|
||||||
|
#endif
|
||||||
|
)
|
||||||
S9xReportButton (offset + i, true);
|
S9xReportButton (offset + i, true);
|
||||||
else
|
else
|
||||||
S9xReportButton (offset + i, false);
|
S9xReportButton (offset + i, false);
|
||||||
}
|
}
|
||||||
// pointer
|
// pointer
|
||||||
offset = 0x60;
|
offset = 0x60;
|
||||||
UpdateCursorPosition (pad_x, pad_y, scope_x, scope_y);
|
UpdateCursorPosition (pad, scope_x, scope_y);
|
||||||
S9xReportPointer(offset, (u16)scope_x, (u16)scope_y);
|
S9xReportPointer(offset, (u16)scope_x, (u16)scope_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,6 +592,26 @@ u32 wpad_get_analogues(int pad, float* mag1, u16* ang1, float* mag2, u16* ang2)
|
|||||||
return exp_type; // return expansion type
|
return exp_type; // return expansion type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetControllers ()
|
||||||
|
{
|
||||||
|
if (Settings.MultiPlayer5Master == true)
|
||||||
|
{
|
||||||
|
|
||||||
|
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||||
|
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
||||||
|
}
|
||||||
|
else if (Settings.SuperScopeMaster == true)
|
||||||
|
{
|
||||||
|
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||||
|
S9xSetController (1, CTL_SUPERSCOPE, 1, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*** Plugin 2 Joypads by default ***/
|
||||||
|
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||||
|
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Set the default mapping for NGC
|
* Set the default mapping for NGC
|
||||||
@ -647,23 +693,7 @@ SetDefaultButtonMap ()
|
|||||||
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Superscope"), false);
|
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Superscope"), false);
|
||||||
// add mouses here
|
// add mouses here
|
||||||
|
|
||||||
if (Settings.MultiPlayer5Master == true)
|
SetControllers ();
|
||||||
{
|
|
||||||
|
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
|
||||||
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
|
||||||
}
|
|
||||||
else if (Settings.SuperScopeMaster == true)
|
|
||||||
{
|
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
|
||||||
S9xSetController (1, CTL_SUPERSCOPE, 1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*** Plugin 2 Joypads by default ***/
|
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
|
||||||
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,6 +772,9 @@ main ()
|
|||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
WPAD_Init();
|
WPAD_Init();
|
||||||
|
// read wiimote accelerometer and IR data
|
||||||
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
|
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,6 +182,8 @@ struct SGCSettings{
|
|||||||
uint8 VerifySaves;
|
uint8 VerifySaves;
|
||||||
u16 render; // 0 - original, 1 - no AA
|
u16 render; // 0 - original, 1 - no AA
|
||||||
u32 QuickSaveSlot; // -1 Disabled - no prefs are loaded, 0 Memory card in slot A, 1 Memory card in slot B, 2 SD card in slot A, 3 SD card in slot B, 4 SMB share, 5 USB
|
u32 QuickSaveSlot; // -1 Disabled - no prefs are loaded, 0 Memory card in slot A, 1 Memory card in slot B, 2 SD card in slot A, 3 SD card in slot B, 4 SMB share, 5 USB
|
||||||
|
u16 Superscope;
|
||||||
|
u16 Mouse;
|
||||||
};
|
};
|
||||||
|
|
||||||
START_EXTERN_C
|
START_EXTERN_C
|
||||||
@ -190,6 +192,7 @@ extern unsigned short saveicon[1024];
|
|||||||
extern bool8 isWii;
|
extern bool8 isWii;
|
||||||
|
|
||||||
extern u32 wpad_get_analogues(int pad, float* mag1, u16* ang1, float* mag2, u16* ang2);
|
extern u32 wpad_get_analogues(int pad, float* mag1, u16* ang1, float* mag2, u16* ang2);
|
||||||
|
extern void SetControllers ();
|
||||||
END_EXTERN_C
|
END_EXTERN_C
|
||||||
|
|
||||||
#define JOY_THRESHOLD 0.70 // for wii (expansion) analogues
|
#define JOY_THRESHOLD 0.70 // for wii (expansion) analogues
|
||||||
|
Loading…
Reference in New Issue
Block a user