diff options
Diffstat (limited to 'pcr/reicast-multilib-git/multiplayer-unstable.patch')
-rw-r--r-- | pcr/reicast-multilib-git/multiplayer-unstable.patch | 450 |
1 files changed, 450 insertions, 0 deletions
diff --git a/pcr/reicast-multilib-git/multiplayer-unstable.patch b/pcr/reicast-multilib-git/multiplayer-unstable.patch new file mode 100644 index 000000000..cc4e11906 --- /dev/null +++ b/pcr/reicast-multilib-git/multiplayer-unstable.patch @@ -0,0 +1,450 @@ +diff -Nur a/core/hw/maple/maple_cfg.cpp b/core/hw/maple/maple_cfg.cpp +--- a/core/hw/maple/maple_cfg.cpp 2015-10-06 21:43:53.027336293 -0300 ++++ b/core/hw/maple/maple_cfg.cpp 2015-10-06 22:08:18.378992677 -0300 +@@ -3,6 +3,7 @@ + #include "maple_helper.h" + #include "maple_devs.h" + #include "maple_cfg.h" ++#include "maple_controller.h" + + #define HAS_VMU + /* +@@ -22,11 +23,6 @@ + */ + void UpdateInputState(u32 port); + +-extern u16 kcode[4]; +-extern u32 vks[4]; +-extern s8 joyx[4],joyy[4]; +-extern u8 rt[4],lt[4]; +- + u8 GetBtFromSgn(s8 val) + { + return val+128; +@@ -45,11 +41,11 @@ + { + UpdateInputState(dev->bus_id); + +- pjs->kcode=kcode[dev->bus_id] | 0xF901; +- pjs->joy[PJAI_X1]=GetBtFromSgn(joyx[dev->bus_id]); +- pjs->joy[PJAI_Y1]=GetBtFromSgn(joyy[dev->bus_id]); +- pjs->trigger[PJTI_R]=rt[dev->bus_id]; +- pjs->trigger[PJTI_L]=lt[dev->bus_id]; ++ pjs->kcode = maple_controller[dev->bus_id].buttons | 0xF901; ++ pjs->joy[PJAI_X1] = GetBtFromSgn(maple_controller[dev->bus_id].stick_x); ++ pjs->joy[PJAI_Y1] = GetBtFromSgn(maple_controller[dev->bus_id].stick_y); ++ pjs->trigger[PJTI_R] = maple_controller[dev->bus_id].trigger_right; ++ pjs->trigger[PJTI_L] = maple_controller[dev->bus_id].trigger_left; + } + void SetImage(void* img) + { +@@ -68,14 +64,19 @@ + + void mcfg_CreateDevices() + { +-#if DC_PLATFORM == DC_PLATFORM_DREAMCAST +- mcfg_Create(MDT_SegaController,0,5); +- +- mcfg_Create(MDT_SegaVMU,0,0); +- mcfg_Create(MDT_SegaVMU,0,1); +-#else +- mcfg_Create(MDT_NaomiJamma, 0, 5); +-#endif ++ for(int port = 0; port < MAPLE_NUM_PORTS; port++) ++ { ++ if(maple_controller[port].enabled) ++ { ++ #if DC_PLATFORM == DC_PLATFORM_DREAMCAST ++ mcfg_Create(MDT_SegaController, port, 5); ++ mcfg_Create(MDT_SegaVMU, port, 0); ++ mcfg_Create(MDT_SegaVMU, port, 1); ++ #else ++ mcfg_Create(MDT_NaomiJamma, port, 5); ++ #endif ++ } ++ } + } + + void mcfg_DestroyDevices() +diff -Nur a/core/hw/maple/maple_controller.cpp b/core/hw/maple/maple_controller.cpp +--- a/core/hw/maple/maple_controller.cpp 1969-12-31 21:00:00.000000000 -0300 ++++ b/core/hw/maple/maple_controller.cpp 2015-10-06 22:08:18.378992677 -0300 +@@ -0,0 +1,8 @@ ++#include "hw/maple/maple_controller.h" ++ ++MapleController maple_controller[MAPLE_NUM_PORTS] = { ++ { 1 , 0xFFFF, 0, 0, 0, 0 }, ++ { 0 , 0xFFFF, 0, 0, 0, 0 }, ++ { 0 , 0xFFFF, 0, 0, 0, 0 }, ++ { 0 , 0xFFFF, 0, 0, 0, 0 } ++}; +diff -Nur a/core/hw/maple/maple_controller.h b/core/hw/maple/maple_controller.h +--- a/core/hw/maple/maple_controller.h 1969-12-31 21:00:00.000000000 -0300 ++++ b/core/hw/maple/maple_controller.h 2015-10-06 22:08:18.378992677 -0300 +@@ -0,0 +1,42 @@ ++#pragma once ++#include "types.h" ++ ++// If you change the value of MAPLE_NUM_PORTS, please note that you need to change the initializers in maple_controller.cpp as well ++#define MAPLE_NUM_PORTS 4 ++ ++struct MapleController ++{ ++ bool enabled; ++ u16 buttons; ++ u8 trigger_left; ++ u8 trigger_right; ++ s8 stick_x; ++ s8 stick_y; ++}; ++ ++extern MapleController maple_controller[MAPLE_NUM_PORTS]; ++ ++enum DreamcastControllerCodes ++{ ++ DC_BTN_C = 1, ++ DC_BTN_B = 1<<1, ++ DC_BTN_A = 1<<2, ++ DC_BTN_START = 1<<3, ++ DC_BTN_DPAD_UP = 1<<4, ++ DC_BTN_DPAD_DOWN = 1<<5, ++ DC_BTN_DPAD_LEFT = 1<<6, ++ DC_BTN_DPAD_RIGHT = 1<<7, ++ DC_BTN_Z = 1<<8, ++ DC_BTN_Y = 1<<9, ++ DC_BTN_X = 1<<10, ++ DC_BTN_D = 1<<11, ++ DC_BTN_DPAD2_UP = 1<<12, ++ DC_BTN_DPAD2_DOWN = 1<<13, ++ DC_BTN_DPAD2_LEFT = 1<<14, ++ DC_BTN_DPAD2_RIGHT = 1<<15, ++ ++ DC_AXIS_LT = 0X10000, ++ DC_AXIS_RT = 0X10001, ++ DC_AXIS_X = 0X20000, ++ DC_AXIS_Y = 0X20001 ++}; +diff -Nur a/core/linux-dist/x11.cpp b/core/linux-dist/x11.cpp +--- a/core/linux-dist/x11.cpp 2015-10-06 22:04:14.520204440 -0300 ++++ b/core/linux-dist/x11.cpp 2015-10-06 22:08:18.381992699 -0300 +@@ -82,11 +82,11 @@ + int dc_key = x11_keymap[e.xkey.keycode]; + if (e.type == KeyPress) + { +- kcode[0] &= ~dc_key; ++ maple_controller[0].buttons &= ~dc_key; + } + else + { +- kcode[0] |= dc_key; ++ maple_controller[0].buttons |= dc_key; + } + } + //printf("KEY: %d -> %d: %d\n",e.xkey.keycode, dc_key, x11_dc_buttons ); +diff -Nur a/core/nacl/nacl.cpp b/core/nacl/nacl.cpp +--- a/core/nacl/nacl.cpp 2015-10-06 22:07:39.028703879 -0300 ++++ b/core/nacl/nacl.cpp 2015-10-06 22:08:18.381992699 -0300 +@@ -15,6 +15,7 @@ + #include "ppapi/utility/completion_callback_factory.h" + + #include "types.h" ++#include "hw/maple/maple_controller.h" + + #include <GLES2/gl2.h> + +@@ -234,12 +235,6 @@ + } + } // namespace pp + +- +-u16 kcode[4]; +-u32 vks[4]; +-s8 joyx[4],joyy[4]; +-u8 rt[4],lt[4]; +- + int get_mic_data(u8* buffer) { return 0; } + int push_vmu_screen(u8* buffer) { return 0; } + +diff -Nur a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp +--- a/core/rend/gles/gles.cpp 2015-10-06 22:07:39.029703886 -0300 ++++ b/core/rend/gles/gles.cpp 2015-10-06 22:08:18.382992707 -0300 +@@ -1833,7 +1810,7 @@ + } + + bool do_swp=false; +- //if (kcode[0]&(1<<9)) ++ //if (maple_controller[0].buttons&(1<<9)) + { + + +diff -Nur a/core/windows/winmain.cpp b/core/windows/winmain.cpp +--- a/core/windows/winmain.cpp 2015-10-06 22:07:39.030703893 -0300 ++++ b/core/windows/winmain.cpp 2015-10-06 22:08:18.383992714 -0300 +@@ -1,5 +1,6 @@ + #include "oslib\oslib.h" + #include "oslib\audiostream.h" ++#include "hw\maple\maple_controller.h" + #include "imgread\common.h" + + #define _WIN32_WINNT 0x0500 +@@ -173,66 +174,46 @@ + return MessageBox(NULL,temp,VER_SHORTNAME,type | MB_TASKMODAL); + } + +-u16 kcode[4]; +-u32 vks[4]; +-s8 joyx[4],joyy[4]; +-u8 rt[4],lt[4]; +-#define key_CONT_C (1 << 0) +-#define key_CONT_B (1 << 1) +-#define key_CONT_A (1 << 2) +-#define key_CONT_START (1 << 3) +-#define key_CONT_DPAD_UP (1 << 4) +-#define key_CONT_DPAD_DOWN (1 << 5) +-#define key_CONT_DPAD_LEFT (1 << 6) +-#define key_CONT_DPAD_RIGHT (1 << 7) +-#define key_CONT_Z (1 << 8) +-#define key_CONT_Y (1 << 9) +-#define key_CONT_X (1 << 10) +-#define key_CONT_D (1 << 11) +-#define key_CONT_DPAD2_UP (1 << 12) +-#define key_CONT_DPAD2_DOWN (1 << 13) +-#define key_CONT_DPAD2_LEFT (1 << 14) +-#define key_CONT_DPAD2_RIGHT (1 << 15) + void UpdateInputState(u32 port) + { +- //joyx[port]=pad.Lx; +- //joyy[port]=pad.Ly; +- lt[port]=GetAsyncKeyState('A')?255:0; +- rt[port]=GetAsyncKeyState('S')?255:0; ++ //maple_controller[port].stick_x = pad.Lx; ++ //maple_controller[port].stick_y = pad.Ly; ++ maple_controller[port].trigger_left = GetAsyncKeyState('A') ? 255 : 0; ++ maple_controller[port].trigger_right = GetAsyncKeyState('S') ? 255 : 0; + +- joyx[port]=joyy[port]=0; ++ maple_controller[port].stick_x = maple_controller[port].stick_y = 0; + + if (GetAsyncKeyState('J')) +- joyx[port]-=126; ++ maple_controller[port].stick_x -= 126; + if (GetAsyncKeyState('L')) +- joyx[port]+=126; ++ maple_controller[port].stick_x += 126; + + if (GetAsyncKeyState('I')) +- joyy[port]-=126; ++ maple_controller[port].stick_y -= 126; + if (GetAsyncKeyState('K')) +- joyy[port]+=126; ++ maple_controller[port].stick_y += 126; + +- kcode[port]=0xFFFF; ++ maple_controller[port].buttons = 0xFFFF; + if (GetAsyncKeyState('V')) +- kcode[port]&=~key_CONT_A; ++ maple_controller[port].buttons &= ~DC_BTN_A; + if (GetAsyncKeyState('C')) +- kcode[port]&=~key_CONT_B; ++ maple_controller[port].buttons &= ~DC_BTN_B; + if (GetAsyncKeyState('X')) +- kcode[port]&=~key_CONT_Y; ++ maple_controller[port].buttons &= ~DC_BTN_Y; + if (GetAsyncKeyState('Z')) +- kcode[port]&=~key_CONT_X; ++ maple_controller[port].buttons &= ~DC_BTN_X; + + if (GetAsyncKeyState(VK_SHIFT)) +- kcode[port]&=~key_CONT_START; ++ maple_controller[port].buttons &= ~DC_BTN_START; + + if (GetAsyncKeyState(VK_UP)) +- kcode[port]&=~key_CONT_DPAD_UP; ++ maple_controller[port].buttons &= ~DC_BTN_DPAD_UP; + if (GetAsyncKeyState(VK_DOWN)) +- kcode[port]&=~key_CONT_DPAD_DOWN; ++ maple_controller[port].buttons &= ~DC_BTN_DPAD_DOWN; + if (GetAsyncKeyState(VK_LEFT)) +- kcode[port]&=~key_CONT_DPAD_LEFT; ++ maple_controller[port].buttons &= ~DC_BTN_DPAD_LEFT; + if (GetAsyncKeyState(VK_RIGHT)) +- kcode[port]&=~key_CONT_DPAD_RIGHT; ++ maple_controller[port].buttons &= ~DC_BTN_DPAD_RIGHT; + + if (GetAsyncKeyState(VK_F1)) + settings.pvr.ta_skip = 100; +diff -Nur a/shell/android/jni/src/Android.cpp b/shell/android/jni/src/Android.cpp +--- a/shell/android/jni/src/Android.cpp 2015-10-06 22:07:39.030703893 -0300 ++++ b/shell/android/jni/src/Android.cpp 2015-10-06 22:08:18.383992714 -0300 +@@ -16,6 +16,7 @@ + #include "rend/TexCache.h" + #include "hw/maple/maple_devs.h" + #include "hw/maple/maple_if.h" ++#include "hw/maple/maple_controller.h" + #include "oslib/audiobackend_android.h" + + #include "util.h" +@@ -175,10 +176,6 @@ + // Additonal controllers 2, 3 and 4 connected ? + static bool add_controllers[3] = { false, false, false }; + +-u16 kcode[4]; +-u32 vks[4]; +-s8 joyx[4],joyy[4]; +-u8 rt[4],lt[4]; + float vjoy_pos[14][8]; + + extern bool print_stats; +@@ -211,7 +208,7 @@ + } + + // Add additonal controllers +- for (int i = 0; i < 3; i++) ++ for (int i = 0; i < (MAPLE_NUM_PORTS - 1); i++) + { + if (add_controllers[i]) + mcfg_Create(MDT_SegaController,i+1,5); +@@ -443,13 +440,13 @@ + jint *jx_body = env->GetIntArrayElements(jx, 0); + jint *jy_body = env->GetIntArrayElements(jy, 0); + +- for(int i = 0; i < 4; i++) ++ for(int i = 0; i < MAPLE_NUM_PORTS; i++) + { +- kcode[i] = k_code_body[i]; +- lt[i] = l_t_body[i]; +- rt[i] = r_t_body[i]; +- joyx[i] = jx_body[i]; +- joyy[i] = jy_body[i]; ++ maple_controller[i].buttons = k_code_body[i]; ++ maple_controller[i].trigger_left = l_t_body[i]; ++ maple_controller[i].trigger_right = r_t_body[i]; ++ maple_controller[i].stick_x = jx_body[i]; ++ maple_controller[i].stick_y = jy_body[i]; + } + + env->ReleaseIntArrayElements(k_code, k_code_body, 0); +diff -Nur a/shell/apple/emulator-ios/emulator/ios_main.mm b/shell/apple/emulator-ios/emulator/ios_main.mm +--- a/shell/apple/emulator-ios/emulator/ios_main.mm 2015-10-06 22:07:39.030703893 -0300 ++++ b/shell/apple/emulator-ios/emulator/ios_main.mm 2015-10-06 22:08:18.383992714 -0300 +@@ -20,6 +20,7 @@ + #include <sys/mman.h> + #include <sys/time.h> + #include "hw/sh4/dyna/blockmanager.h" ++#include "hw/maple/maple_controller.h" + #include <unistd.h> + + +@@ -55,11 +56,6 @@ + int dc_init(int argc,wchar* argv[]); + void dc_run(); + +-u16 kcode[4]; +-u32 vks[4]; +-s8 joyx[4],joyy[4]; +-u8 rt[4],lt[4]; +- + extern "C" int reicast_main(int argc, wchar* argv[]) + { + //if (argc==2) +diff -Nur a/shell/apple/emulator-osx/emulator-osx/osx-main.mm b/shell/apple/emulator-osx/emulator-osx/osx-main.mm +--- a/shell/apple/emulator-osx/emulator-osx/osx-main.mm 2015-10-06 22:07:39.030703893 -0300 ++++ b/shell/apple/emulator-osx/emulator-osx/osx-main.mm 2015-10-06 22:08:18.383992714 -0300 +@@ -8,6 +8,7 @@ + #import <Carbon/Carbon.h> + + #include "types.h" ++#include "hw/maple/maple_controller.h" + #include <sys/stat.h> + + #include <OpenGL/gl3.h> +@@ -38,11 +39,6 @@ + return 0; + } + +-u16 kcode[4] = { 0xFFFF }; +-u32 vks[4]; +-s8 joyx[4],joyy[4]; +-u8 rt[4],lt[4]; +- + int get_mic_data(u8* buffer) { return 0; } + int push_vmu_screen(u8* buffer) { return 0; } + +@@ -131,35 +127,11 @@ + gles_init(); + } + +-enum DCPad { +- Btn_C = 1, +- Btn_B = 1<<1, +- Btn_A = 1<<2, +- Btn_Start = 1<<3, +- DPad_Up = 1<<4, +- DPad_Down = 1<<5, +- DPad_Left = 1<<6, +- DPad_Right = 1<<7, +- Btn_Z = 1<<8, +- Btn_Y = 1<<9, +- Btn_X = 1<<10, +- Btn_D = 1<<11, +- DPad2_Up = 1<<12, +- DPad2_Down = 1<<13, +- DPad2_Left = 1<<14, +- DPad2_Right = 1<<15, +- +- Axis_LT= 0x10000, +- Axis_RT= 0x10001, +- Axis_X= 0x20000, +- Axis_Y= 0x20001, +-}; +- + void handle_key(int dckey, int state) { + if (state) +- kcode[0] &= ~dckey; ++ maple_controller[0].buttons &= ~dckey; + else +- kcode[0] |= dckey; ++ maple_controller[0].buttons |= dckey; + } + + void handle_trig(u8* dckey, int state) { +@@ -172,18 +144,18 @@ + extern "C" void emu_key_input(char* keyt, int state) { + int key = keyt[0]; + switch(key) { +- case 'z': handle_key(Btn_X, state); break; +- case 'x': handle_key(Btn_Y, state); break; +- case 'c': handle_key(Btn_B, state); break; +- case 'v': handle_key(Btn_A, state); break; ++ case 'z': handle_key(DC_BTN_X, state); break; ++ case 'x': handle_key(DC_BTN_Y, state); break; ++ case 'c': handle_key(DC_BTN_B, state); break; ++ case 'v': handle_key(DC_BTN_A, state); break; + + case 'a': handle_trig(lt, state); break; + case 's': handle_trig(rt, state); break; + +- case 'j': handle_key(DPad_Left, state); break; +- case 'k': handle_key(DPad_Down, state); break; +- case 'l': handle_key(DPad_Right, state); break; +- case 'i': handle_key(DPad_Up, state); break; +- case 0xa: handle_key(Btn_Start, state); break; ++ case 'j': handle_key(DC_BTN_DPAD_LEFT, state); break; ++ case 'k': handle_key(DC_BTN_DPAD_DOWN, state); break; ++ case 'l': handle_key(DC_BTN_DPAD_RIGHT, state); break; ++ case 'i': handle_key(DC_BTN_DPAD_UP, state); break; ++ case 0xa: handle_key(DC_BTN_START, state); break; + } + } +\ No newline at end of file +diff -Nur a/shell/reicast.vcxproj b/shell/reicast.vcxproj +--- a/shell/reicast.vcxproj 2015-10-06 22:07:39.030703893 -0300 ++++ b/shell/reicast.vcxproj 2015-10-06 22:08:18.383992714 -0300 +@@ -92,6 +92,7 @@ + <ClCompile Include="..\core\hw\holly\sb_dma.cpp" /> + <ClCompile Include="..\core\hw\holly\sb_mem.cpp" /> + <ClCompile Include="..\core\hw\maple\maple_cfg.cpp" /> ++ <ClCompile Include="..\core\hw\maple\maple_controller.cpp" /> + <ClCompile Include="..\core\hw\maple\maple_devs.cpp" /> + <ClCompile Include="..\core\hw\maple\maple_helper.cpp" /> + <ClCompile Include="..\core\hw\maple\maple_if.cpp" /> |