Removed options that break mouse input. Allow Singe to run with no mouse connected.
This commit is contained in:
parent
ed24346bf8
commit
ea7d9d97cf
7 changed files with 82 additions and 175 deletions
|
@ -60,8 +60,9 @@ function doBuild() {
|
||||||
TARGET="${SOURCE_DIR}/../build/${TARGET}${EXT}"
|
TARGET="${SOURCE_DIR}/../build/${TARGET}${EXT}"
|
||||||
[[ -e "${TARGET}" ]] && rm "${TARGET}"
|
[[ -e "${TARGET}" ]] && rm "${TARGET}"
|
||||||
echo "Linking ${TARGET}..."
|
echo "Linking ${TARGET}..."
|
||||||
# The grep nonsense hides a warning we don't care about.
|
# The grep nonsense hides warnings we don't care about.
|
||||||
${CROSS}-${CPPCOMPILER} -o "${TARGET}" ${OFILES} ${EXTRA_OFILES} "-L${SOURCE_DIR}/../thirdparty-build/${OSNAME}/${OSARCH}/installed/lib" ${EXTRA_LD_FLAGS} 2>&1 | grep -v loslib || true
|
${CROSS}-${CPPCOMPILER} -o "${TARGET}" ${OFILES} ${EXTRA_OFILES} "-L${SOURCE_DIR}/../thirdparty-build/${OSNAME}/${OSARCH}/installed/lib" ${EXTRA_LD_FLAGS} 2>&1 | \
|
||||||
|
grep -v loslib | grep -v "ld: warning: building for macOS, but linking in object file" || true
|
||||||
|
|
||||||
echo "Compressing ${TARGET}..."
|
echo "Compressing ${TARGET}..."
|
||||||
${CROSS}-strip "${TARGET}"
|
${CROSS}-strip "${TARGET}"
|
||||||
|
@ -77,7 +78,6 @@ function doBuild() {
|
||||||
# Find Singe version
|
# Find Singe version
|
||||||
G_VERSION=$(grep VERSION_STRING singe.h | cut -d '"' -f 2)
|
G_VERSION=$(grep VERSION_STRING singe.h | cut -d '"' -f 2)
|
||||||
|
|
||||||
:<<'SKIP'
|
|
||||||
# 32 Bit Linux
|
# 32 Bit Linux
|
||||||
echo -e "${G_L}\nLinux i386\n${G_L}"
|
echo -e "${G_L}\nLinux i386\n${G_L}"
|
||||||
CROSS="x86_64-linux-gnu"
|
CROSS="x86_64-linux-gnu"
|
||||||
|
@ -140,7 +140,6 @@ EXTRA_CFLAGS="-O2 --sysroot ${SYSROOT}"
|
||||||
EXTRA_OFILES=""
|
EXTRA_OFILES=""
|
||||||
EXTRA_LD_FLAGS="--sysroot ${SYSROOT} -l:everything.a -Wl,-rpath-link,${SYSROOT}/opt/vc/lib -L${SYSROOT}/opt/vc/lib -lbcm_host -lasound -lpthread -lm -ldl -lsndio -lmmal_core -lmmal_util -lmmal_vc_client -lvdpau -ldrm -lgbm -lX11 -lsamplerate"
|
EXTRA_LD_FLAGS="--sysroot ${SYSROOT} -l:everything.a -Wl,-rpath-link,${SYSROOT}/opt/vc/lib -L${SYSROOT}/opt/vc/lib -lbcm_host -lasound -lpthread -lm -ldl -lsndio -lmmal_core -lmmal_util -lmmal_vc_client -lvdpau -ldrm -lgbm -lX11 -lsamplerate"
|
||||||
doBuild Singe-${G_VERSION}-Pi-armv6 pi 32
|
doBuild Singe-${G_VERSION}-Pi-armv6 pi 32
|
||||||
SKIP
|
|
||||||
|
|
||||||
# 32 Bit macOS
|
# 32 Bit macOS
|
||||||
echo -e "${G_L}\nmacOS i386\n${G_L}"
|
echo -e "${G_L}\nmacOS i386\n${G_L}"
|
||||||
|
@ -155,7 +154,6 @@ export MACOSX_DEPLOYMENT_TARGET=10.8
|
||||||
doBuild Singe-${G_VERSION}-macOS-i386 mac 32
|
doBuild Singe-${G_VERSION}-macOS-i386 mac 32
|
||||||
export MACOSX_DEPLOYMENT_TARGET=${O_MACOSX_DEPLOYMENT_TARGET}
|
export MACOSX_DEPLOYMENT_TARGET=${O_MACOSX_DEPLOYMENT_TARGET}
|
||||||
|
|
||||||
:<<'SKIP'
|
|
||||||
# 64 Bit macOS
|
# 64 Bit macOS
|
||||||
echo -e "${G_L}\nmacOS x86_64\n${G_L}"
|
echo -e "${G_L}\nmacOS x86_64\n${G_L}"
|
||||||
CROSS="x86_64-apple-darwin${MACOSX_DARWIN}"
|
CROSS="x86_64-apple-darwin${MACOSX_DARWIN}"
|
||||||
|
@ -168,4 +166,3 @@ O_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.8
|
export MACOSX_DEPLOYMENT_TARGET=10.8
|
||||||
doBuild Singe-${G_VERSION}-macOS-x86_64 mac 64
|
doBuild Singe-${G_VERSION}-macOS-x86_64 mac 64
|
||||||
export MACOSX_DEPLOYMENT_TARGET=${O_MACOSX_DEPLOYMENT_TARGET}
|
export MACOSX_DEPLOYMENT_TARGET=${O_MACOSX_DEPLOYMENT_TARGET}
|
||||||
SKIP
|
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
DEAD_ZONE = 8000
|
DEAD_ZONE = 8000
|
||||||
|
|
||||||
INPUT_UP = { SCANCODE.UP, SCANCODE.KP_8, GAMEPAD_0.AXIS_LEFT_Y_U, GAMEPAD_0.AXIS_RIGHT_Y_U, GAMEPAD_0.DPAD_UP }
|
INPUT_UP = { SCANCODE.UP, SCANCODE.KP_8, GAMEPAD_0.AXIS_LEFT_Y_U, GAMEPAD_0.AXIS_RIGHT_Y_U, GAMEPAD_0.DPAD_UP }
|
||||||
INPUT_LEFT = { SCANCODE.LEFT, SCANCODE.KP_4, GAMEPAD_0.AXIS_LEFT_X_L, GAMEPAD_0.AXIS_RIGHT_X_L, GAMEPAD_0.DPAD_LEFT }
|
INPUT_LEFT = { SCANCODE.LEFT, SCANCODE.KP_4, GAMEPAD_0.AXIS_LEFT_X_L, GAMEPAD_0.AXIS_RIGHT_X_L, GAMEPAD_0.DPAD_LEFT }
|
||||||
INPUT_DOWN = { SCANCODE.DOWN, SCANCODE.KP_2, GAMEPAD_0.AXIS_LEFT_Y_D, GAMEPAD_0.AXIS_RIGHT_Y_D, GAMEPAD_0.DPAD_DOWN }
|
INPUT_DOWN = { SCANCODE.DOWN, SCANCODE.KP_2, GAMEPAD_0.AXIS_LEFT_Y_D, GAMEPAD_0.AXIS_RIGHT_Y_D, GAMEPAD_0.DPAD_DOWN }
|
||||||
INPUT_RIGHT = { SCANCODE.RIGHT, SCANCODE.KP_6, GAMEPAD_0.AXIS_LEFT_X_R, GAMEPAD_0.AXIS_RIGHT_X_R, GAMEPAD_0.DPAD_RIGHT }
|
INPUT_RIGHT = { SCANCODE.RIGHT, SCANCODE.KP_6, GAMEPAD_0.AXIS_LEFT_X_R, GAMEPAD_0.AXIS_RIGHT_X_R, GAMEPAD_0.DPAD_RIGHT }
|
||||||
INPUT_1P_COIN = { SCANCODE.MAIN_5, SCANCODE.C, GAMEPAD_0.BUTTON_LEFT_BUMPER }
|
INPUT_1P_COIN = { SCANCODE.MAIN_5, SCANCODE.C, GAMEPAD_0.BUTTON_LEFT_BUMPER }
|
||||||
INPUT_2P_COIN = { SCANCODE.MAIN_6 }
|
INPUT_2P_COIN = { SCANCODE.MAIN_6 }
|
||||||
INPUT_1P_START = { SCANCODE.MAIN_1, GAMEPAD_0.BUTTON_RIGHT_BUMPER }
|
INPUT_1P_START = { SCANCODE.MAIN_1, GAMEPAD_0.BUTTON_RIGHT_BUMPER }
|
||||||
INPUT_2P_START = { SCANCODE.MAIN_2 }
|
INPUT_2P_START = { SCANCODE.MAIN_2 }
|
||||||
INPUT_ACTION_1 = { SCANCODE.SPACE, SCANCODE.LCTRL, GAMEPAD_0.BUTTON_A, MOUSE_0.BUTTON_RIGHT }
|
INPUT_ACTION_1 = { SCANCODE.SPACE, SCANCODE.LCTRL, GAMEPAD_0.BUTTON_A, MOUSE_0.BUTTON_RIGHT }
|
||||||
INPUT_ACTION_2 = { SCANCODE.LALT, GAMEPAD_0.BUTTON_B, MOUSE_0.BUTTON_MIDDLE }
|
INPUT_ACTION_2 = { SCANCODE.LALT, GAMEPAD_0.BUTTON_B, MOUSE_0.BUTTON_MIDDLE }
|
||||||
INPUT_ACTION_3 = { SCANCODE.LSHIFT, GAMEPAD_0.BUTTON_X, MOUSE_0.BUTTON_LEFT }
|
INPUT_ACTION_3 = { SCANCODE.LSHIFT, GAMEPAD_0.BUTTON_X, MOUSE_0.BUTTON_LEFT }
|
||||||
INPUT_ACTION_4 = { SCANCODE.RSHIFT, GAMEPAD_0.BUTTON_Y, MOUSE_0.BUTTON_X1 }
|
INPUT_ACTION_4 = { SCANCODE.RSHIFT, GAMEPAD_0.BUTTON_Y, MOUSE_0.BUTTON_X1 }
|
||||||
INPUT_SKILL_EASY = { SCANCODE.KP_DIVIDE }
|
INPUT_SKILL_EASY = { SCANCODE.KP_DIVIDE }
|
||||||
|
|
122
singe/games.dat
122
singe/games.dat
|
@ -1,122 +0,0 @@
|
||||||
GAMES = {
|
|
||||||
{
|
|
||||||
TITLE = ".38 Ambush Alley",
|
|
||||||
SCRIPT = "ActionMax/38AmbushAlley.singe",
|
|
||||||
VIDEO = "ActionMax/frame_38AmbushAlley.txt",
|
|
||||||
DATA = "ActionMax",
|
|
||||||
STRETCH = false,
|
|
||||||
NO_MOUSE = false,
|
|
||||||
RESOLUTION_X = 720,
|
|
||||||
RESOLUTION_Y = 480,
|
|
||||||
SINDEN_GUN = "",
|
|
||||||
CABINET = "ActionMax/cabinet_38AmbushAlley.png",
|
|
||||||
MARQUEE = "ActionMax/marquee_ActionMax.png",
|
|
||||||
ATTRACT = "ActionMax/video_38AmbushAlley.mkv",
|
|
||||||
ATTRACT_START = 3000,
|
|
||||||
ATTRACT_END = 3500,
|
|
||||||
YEAR = 1987,
|
|
||||||
PLATFORM = "ActionMax",
|
|
||||||
DEVELOPER = "Sourcing International, Ltd.",
|
|
||||||
PUBLISHER = "Worlds of Wonder, Inc.",
|
|
||||||
GENERE = "Shooter",
|
|
||||||
DESCRIPTION = "Get your target practice in with real police officers then hit the streets.",
|
|
||||||
CREATOR = "Scott Duensing",
|
|
||||||
SOURCE = "http://kangaroopunch.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TITLE = "Blue Thunder",
|
|
||||||
SCRIPT = "ActionMax/BlueThunder.singe",
|
|
||||||
VIDEO = "ActionMax/frame_BlueThunder.txt",
|
|
||||||
DATA = "ActionMax",
|
|
||||||
STRETCH = false,
|
|
||||||
NO_MOUSE = false,
|
|
||||||
RESOLUTION_X = 720,
|
|
||||||
RESOLUTION_Y = 480,
|
|
||||||
SINDEN_GUN = "",
|
|
||||||
CABINET = "ActionMax/cabinet_BlueThunder.png",
|
|
||||||
MARQUEE = "ActionMax/marquee_ActionMax.png",
|
|
||||||
ATTRACT = "ActionMax/video_BlueThunder.mkv",
|
|
||||||
ATTRACT_START = 3000,
|
|
||||||
ATTRACT_END = 3500,
|
|
||||||
YEAR = 1987,
|
|
||||||
PLATFORM = "ActionMax",
|
|
||||||
DEVELOPER = "Sourcing International, Ltd.",
|
|
||||||
PUBLISHER = "Worlds of Wonder, Inc.",
|
|
||||||
GENERE = "Shooter",
|
|
||||||
DESCRIPTION = "Get in your chopper and take out the bad guys in this action-packed game.",
|
|
||||||
CREATOR = "Scott Duensing",
|
|
||||||
SOURCE = "http://kangaroopunch.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TITLE = "Hydrosub: 2021",
|
|
||||||
SCRIPT = "ActionMax/Hydrosub2021.singe",
|
|
||||||
VIDEO = "ActionMax/frame_Hydrosub2021.txt",
|
|
||||||
DATA = "ActionMax",
|
|
||||||
STRETCH = false,
|
|
||||||
NO_MOUSE = false,
|
|
||||||
RESOLUTION_X = 720,
|
|
||||||
RESOLUTION_Y = 480,
|
|
||||||
SINDEN_GUN = "",
|
|
||||||
CABINET = "ActionMax/cabinet_Hydrosub2021.png",
|
|
||||||
MARQUEE = "ActionMax/marquee_ActionMax.png",
|
|
||||||
ATTRACT = "ActionMax/video_Hydrosub2021.mkv",
|
|
||||||
ATTRACT_START = 3000,
|
|
||||||
ATTRACT_END = 3500,
|
|
||||||
YEAR = 1987,
|
|
||||||
PLATFORM = "ActionMax",
|
|
||||||
DEVELOPER = "Sourcing International, Ltd.",
|
|
||||||
PUBLISHER = "Worlds of Wonder, Inc.",
|
|
||||||
GENERE = "Shooter",
|
|
||||||
DESCRIPTION = "Shootout beneath the ocean!",
|
|
||||||
CREATOR = "Scott Duensing",
|
|
||||||
SOURCE = "http://kangaroopunch.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TITLE = "Rescue of Pops Ghostly, The",
|
|
||||||
SCRIPT = "ActionMax/PopsGhostly.singe",
|
|
||||||
VIDEO = "ActionMax/frame_PopsGhostly.txt",
|
|
||||||
DATA = "ActionMax",
|
|
||||||
STRETCH = false,
|
|
||||||
NO_MOUSE = false,
|
|
||||||
RESOLUTION_X = 720,
|
|
||||||
RESOLUTION_Y = 480,
|
|
||||||
SINDEN_GUN = "",
|
|
||||||
CABINET = "ActionMax/cabinet_PopsGhostly.png",
|
|
||||||
MARQUEE = "ActionMax/marquee_ActionMax.png",
|
|
||||||
ATTRACT = "ActionMax/video_PopsGhostly.mkv",
|
|
||||||
ATTRACT_START = 3000,
|
|
||||||
ATTRACT_END = 3500,
|
|
||||||
YEAR = 1987,
|
|
||||||
PLATFORM = "ActionMax",
|
|
||||||
DEVELOPER = "Sourcing International, Ltd.",
|
|
||||||
PUBLISHER = "Worlds of Wonder, Inc.",
|
|
||||||
GENERE = "Shooter",
|
|
||||||
DESCRIPTION = "Help Pops Ghostly and his family get rid of the bad spirits who have taken over the house.",
|
|
||||||
CREATOR = "Scott Duensing",
|
|
||||||
SOURCE = "http://kangaroopunch.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TITLE = "Sonic Fury",
|
|
||||||
SCRIPT = "ActionMax/SonicFury.singe",
|
|
||||||
VIDEO = "ActionMax/frame_SonicFury.txt",
|
|
||||||
DATA = "ActionMax",
|
|
||||||
STRETCH = false,
|
|
||||||
NO_MOUSE = false,
|
|
||||||
RESOLUTION_X = 720,
|
|
||||||
RESOLUTION_Y = 480,
|
|
||||||
SINDEN_GUN = "",
|
|
||||||
CABINET = "ActionMax/cabinet_SonicFury.png",
|
|
||||||
MARQUEE = "ActionMax/marquee_ActionMax.png",
|
|
||||||
ATTRACT = "ActionMax/video_SonicFury.mkv",
|
|
||||||
ATTRACT_START = 3000,
|
|
||||||
ATTRACT_END = 3500,
|
|
||||||
YEAR = 1987,
|
|
||||||
PLATFORM = "ActionMax",
|
|
||||||
DEVELOPER = "Sourcing International, Ltd.",
|
|
||||||
PUBLISHER = "Worlds of Wonder, Inc.",
|
|
||||||
GENERE = "Shooter",
|
|
||||||
DESCRIPTION = "Shoot it out with the bad guys in your fighter jet!",
|
|
||||||
CREATOR = "Scott Duensing",
|
|
||||||
SOURCE = "http://kangaroopunch.com"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -717,13 +717,13 @@ void showUsage(char *name, char *message) {
|
||||||
utilSay(" -d, --datadir=PATHNAME alternate location for written files");
|
utilSay(" -d, --datadir=PATHNAME alternate location for written files");
|
||||||
utilSay(" -e, --volume_nonvldp=PERCENT specify sound effects volume in percent");
|
utilSay(" -e, --volume_nonvldp=PERCENT specify sound effects volume in percent");
|
||||||
utilSay(" -f, --fullscreen run in full screen mode");
|
utilSay(" -f, --fullscreen run in full screen mode");
|
||||||
utilSay(" -g, --sindengun=PARAMS enable Sinden Light Gun support");
|
// utilSay(" -g, --sindengun='PARAMS' enable Sinden Light Gun support");
|
||||||
utilSay(" -h, --help this display");
|
utilSay(" -h, --help this display");
|
||||||
utilSay(" -k, --nologos kill the splash screens");
|
utilSay(" -k, --nologos kill the splash screens");
|
||||||
utilSay(" -l, --volume_vldp=PERCENT specify laserdisc volume in percent");
|
utilSay(" -l, --volume_vldp=PERCENT specify laserdisc volume in percent");
|
||||||
utilSay(" -m, --nomouse disable mouse");
|
utilSay(" -m, --nomouse disable mouse");
|
||||||
utilSay(" -n, --nocrosshair request game not display gun crosshairs");
|
utilSay(" -n, --nocrosshair request game not display gun crosshairs");
|
||||||
utilSay(" -o, --scalefactor=PERCENT reduce screen size for overscan compensation");
|
// utilSay(" -o, --scalefactor=PERCENT reduce screen size for overscan compensation");
|
||||||
utilSay(" -s, --nosound, --mutesound mutes all sound");
|
utilSay(" -s, --nosound, --mutesound mutes all sound");
|
||||||
utilSay(" -t, --trace trace script execution to screen and file");
|
utilSay(" -t, --trace trace script execution to screen and file");
|
||||||
utilSay(" -u, --stretch use ugly stretched video");
|
utilSay(" -u, --stretch use ugly stretched video");
|
||||||
|
|
104
singe/singe.c
104
singe/singe.c
|
@ -58,7 +58,8 @@ LUASOCKET_API int luaopen_socket_serial(lua_State *L);
|
||||||
#define MAX_CONTROLLERS 4
|
#define MAX_CONTROLLERS 4
|
||||||
#define CONTROLLER_AXIS_COUNT 6
|
#define CONTROLLER_AXIS_COUNT 6
|
||||||
#define AXIS_COUNT (MAX_CONTROLLERS * CONTROLLER_AXIS_COUNT + MAX_MICE * MOUSE_AXIS_COUNT)
|
#define AXIS_COUNT (MAX_CONTROLLERS * CONTROLLER_AXIS_COUNT + MAX_MICE * MOUSE_AXIS_COUNT)
|
||||||
|
#define AXIS_KEY_DOWN 0
|
||||||
|
#define AXIS_KEY_UP 1
|
||||||
|
|
||||||
typedef struct MouseS {
|
typedef struct MouseS {
|
||||||
int32_t x;
|
int32_t x;
|
||||||
|
@ -239,7 +240,9 @@ int32_t apiDebugPrint(lua_State *L);
|
||||||
int32_t apiDiscAudio(lua_State *L);
|
int32_t apiDiscAudio(lua_State *L);
|
||||||
int32_t apiDiscChangeSpeed(lua_State *L);
|
int32_t apiDiscChangeSpeed(lua_State *L);
|
||||||
int32_t apiDiscGetFrame(lua_State *L);
|
int32_t apiDiscGetFrame(lua_State *L);
|
||||||
|
int32_t apiDiscGetHeight(lua_State *L);
|
||||||
int32_t apiDiscGetState(lua_State *L);
|
int32_t apiDiscGetState(lua_State *L);
|
||||||
|
int32_t apiDiscGetWidth(lua_State *L);
|
||||||
int32_t apiDiscPause(lua_State *L);
|
int32_t apiDiscPause(lua_State *L);
|
||||||
int32_t apiDiscPauseAtFrame(lua_State *L);
|
int32_t apiDiscPauseAtFrame(lua_State *L);
|
||||||
int32_t apiDiscPlay(lua_State *L);
|
int32_t apiDiscPlay(lua_State *L);
|
||||||
|
@ -2613,6 +2616,24 @@ int32_t apiMouseHowMany(lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t apiDiscGetHeight(lua_State *L) {
|
||||||
|
int32_t r = 0;
|
||||||
|
if (_global.videoHandle >= 0) r = videoGetHeight(_global.videoHandle);
|
||||||
|
luaTrace(L, "discGetHeight", "%d", r);
|
||||||
|
lua_pushinteger(L, r);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t apiDiscGetWidth(lua_State *L) {
|
||||||
|
int32_t r = 0;
|
||||||
|
if (_global.videoHandle >= 0) r = videoGetWidth(_global.videoHandle);
|
||||||
|
luaTrace(L, "discGetWidth", "%d", r);
|
||||||
|
lua_pushinteger(L, r);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t apiDiscGetState(lua_State *L) {
|
int32_t apiDiscGetState(lua_State *L) {
|
||||||
int32_t isPlaying = -1;
|
int32_t isPlaying = -1;
|
||||||
|
|
||||||
|
@ -3451,8 +3472,7 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
int32_t xr = 0;
|
int32_t xr = 0;
|
||||||
int32_t yr = 0;
|
int32_t yr = 0;
|
||||||
int32_t intReturn = 0;
|
int32_t intReturn = 0;
|
||||||
int32_t lastAnalogAxis = -1;
|
int32_t axisIndex = 0;
|
||||||
int32_t lastAnalogDirection = -1;
|
|
||||||
int64_t thisFrame = -1;
|
int64_t thisFrame = -1;
|
||||||
int64_t lastFrame = -1;
|
int64_t lastFrame = -1;
|
||||||
uint32_t frameClock = 0;
|
uint32_t frameClock = 0;
|
||||||
|
@ -3476,6 +3496,11 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
ManyMouseEvent mouseEvent;
|
ManyMouseEvent mouseEvent;
|
||||||
MouseT *mouse = NULL;
|
MouseT *mouse = NULL;
|
||||||
|
int32_t lastAnalogDirection[AXIS_COUNT];
|
||||||
|
//float val = 0;
|
||||||
|
//float maxval = 0;
|
||||||
|
int32_t lastMouseX = 0;
|
||||||
|
int32_t lastMouseY = 0;
|
||||||
|
|
||||||
// Set up globals
|
// Set up globals
|
||||||
memset(&_global, 0, sizeof(GlobalT));
|
memset(&_global, 0, sizeof(GlobalT));
|
||||||
|
@ -3626,7 +3651,9 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
lua_register(_global.luaContext, "discAudio", apiDiscAudio);
|
lua_register(_global.luaContext, "discAudio", apiDiscAudio);
|
||||||
lua_register(_global.luaContext, "discChangeSpeed", apiDiscChangeSpeed);
|
lua_register(_global.luaContext, "discChangeSpeed", apiDiscChangeSpeed);
|
||||||
lua_register(_global.luaContext, "discGetFrame", apiDiscGetFrame);
|
lua_register(_global.luaContext, "discGetFrame", apiDiscGetFrame);
|
||||||
|
lua_register(_global.luaContext, "discGetHeight", apiDiscGetHeight);
|
||||||
lua_register(_global.luaContext, "discGetState", apiDiscGetState);
|
lua_register(_global.luaContext, "discGetState", apiDiscGetState);
|
||||||
|
lua_register(_global.luaContext, "discGetWidth", apiDiscGetWidth);
|
||||||
lua_register(_global.luaContext, "discPause", apiDiscPause);
|
lua_register(_global.luaContext, "discPause", apiDiscPause);
|
||||||
lua_register(_global.luaContext, "discPauseAtFrame", apiDiscPauseAtFrame);
|
lua_register(_global.luaContext, "discPauseAtFrame", apiDiscPauseAtFrame);
|
||||||
lua_register(_global.luaContext, "discPlay", apiDiscPlay);
|
lua_register(_global.luaContext, "discPlay", apiDiscPlay);
|
||||||
|
@ -3854,15 +3881,15 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
SDL_SetSurfaceBlendMode(_global.overlay, SDL_BLENDMODE_BLEND);
|
SDL_SetSurfaceBlendMode(_global.overlay, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
// Mouse setup
|
// Mouse setup
|
||||||
|
_global.mouseEnabled = (bool)!_global.conf->noMouse;
|
||||||
_global.mouseCount = ManyMouse_Init();
|
_global.mouseCount = ManyMouse_Init();
|
||||||
//utilSay("***DEBUG*** Mouse Driver: %s", ManyMouse_DriverName());
|
//utilSay("***DEBUG*** Mouse Driver: %s", ManyMouse_DriverName());
|
||||||
//utilSay("***DEBUG*** Mice Found: %d", _global.mouseCount);
|
//utilSay("***DEBUG*** Mice Found: %d", _global.mouseCount);
|
||||||
if (_global.mouseCount < 1) utilDie("No mice detected.");
|
if ((_global.mouseCount < 1) || !_global.mouseEnabled) utilDie("No mice detected.");
|
||||||
if (_global.mouseCount > MAX_MICE) {
|
if (_global.mouseCount > MAX_MICE) {
|
||||||
_global.mouseCount = MAX_MICE;
|
_global.mouseCount = MAX_MICE;
|
||||||
}
|
}
|
||||||
memset(_global.mice, 0, sizeof(_global.mice));
|
memset(_global.mice, 0, sizeof(_global.mice));
|
||||||
_global.mouseEnabled = (bool)!_global.conf->noMouse;
|
|
||||||
for (x=0; x<_global.mouseCount; x++) {
|
for (x=0; x<_global.mouseCount; x++) {
|
||||||
strncpy(_global.mice[x].name, ManyMouse_DeviceName((unsigned)x), sizeof(_global.mice[x].name));
|
strncpy(_global.mice[x].name, ManyMouse_DeviceName((unsigned)x), sizeof(_global.mice[x].name));
|
||||||
_global.mice[x].name[sizeof(_global.mice[x].name) - 1] = 0;
|
_global.mice[x].name[sizeof(_global.mice[x].name) - 1] = 0;
|
||||||
|
@ -3876,9 +3903,10 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
SDL_SetWindowGrab(_global.window, SDL_TRUE);
|
SDL_SetWindowGrab(_global.window, SDL_TRUE);
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
||||||
// Clear axis cache
|
// Clear axis caches
|
||||||
for (x=0; x<AXIS_COUNT; x++) {
|
for (x=0; x<AXIS_COUNT; x++) {
|
||||||
_global.axisCache[x] = 0;
|
_global.axisCache[x] = 0;
|
||||||
|
lastAnalogDirection[x] = AXIS_KEY_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Controllers are started by the event loop
|
// Controllers are started by the event loop
|
||||||
|
@ -3911,6 +3939,7 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_CONTROLLERAXISMOTION:
|
case SDL_CONTROLLERAXISMOTION:
|
||||||
|
axisIndex = event.caxis.which * 2 + event.caxis.axis;
|
||||||
// Is this in a range we care about?
|
// Is this in a range we care about?
|
||||||
if (abs(event.caxis.value) > _global.controllerDeadZone) {
|
if (abs(event.caxis.value) > _global.controllerDeadZone) {
|
||||||
// Determine which "scancode" to process - see Framework.singe
|
// Determine which "scancode" to process - see Framework.singe
|
||||||
|
@ -3918,33 +3947,22 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
x = event.caxis.which * 100 + 500;
|
x = event.caxis.which * 100 + 500;
|
||||||
// The axis value lines up with the enumeration used by SDL * 3
|
// The axis value lines up with the enumeration used by SDL * 3
|
||||||
x += event.caxis.axis * 3;
|
x += event.caxis.axis * 3;
|
||||||
// Fire the down/up events for the entire axis
|
|
||||||
if ((lastAnalogAxis != -1) && (lastAnalogAxis != x)) {
|
|
||||||
processKey(false, 0, x);
|
|
||||||
}
|
|
||||||
processKey(true, 0, x);
|
|
||||||
lastAnalogAxis = x;
|
|
||||||
// Finally we add the particular direction we're interested in
|
// Finally we add the particular direction we're interested in
|
||||||
x += (event.caxis.value < 0) ? 1 : 2;
|
x += (event.caxis.value < 0) ? 1 : 2;
|
||||||
// Fire the down/up events for the axis direction
|
// Fire the down/up events for the axis direction
|
||||||
if ((lastAnalogDirection != -1) && (lastAnalogDirection != x)) {
|
if (lastAnalogDirection[axisIndex] != AXIS_KEY_DOWN) {
|
||||||
processKey(false, 0, x);
|
processKey(true, 0, x);
|
||||||
|
lastAnalogDirection[axisIndex] = AXIS_KEY_DOWN;
|
||||||
}
|
}
|
||||||
processKey(true, 0, x);
|
|
||||||
lastAnalogDirection = x;
|
|
||||||
} else {
|
} else {
|
||||||
// Handle "up" events for controller inside dead zone
|
// Handle "up" events for controller inside dead zone
|
||||||
if ((lastAnalogAxis != -1) && (lastAnalogAxis != x)) {
|
if (lastAnalogDirection[axisIndex] != AXIS_KEY_UP) {
|
||||||
processKey(false, 0, x);
|
processKey(false, 0, x);
|
||||||
lastAnalogAxis = -1;
|
lastAnalogDirection[axisIndex] = AXIS_KEY_UP;
|
||||||
}
|
|
||||||
if ((lastAnalogDirection != -1) && (lastAnalogDirection != x)) {
|
|
||||||
processKey(false, 0, x);
|
|
||||||
lastAnalogDirection = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remember this change
|
// Remember this change
|
||||||
_global.axisCache[event.caxis.which * 2 + event.caxis.axis] = event.caxis.value;
|
_global.axisCache[axisIndex] = event.caxis.value;
|
||||||
// Fire analog event
|
// Fire analog event
|
||||||
callLua("onControllerMoved", "iii", event.caxis.axis, event.caxis.value, event.caxis.which);
|
callLua("onControllerMoved", "iii", event.caxis.axis, event.caxis.value, event.caxis.which);
|
||||||
break;
|
break;
|
||||||
|
@ -4058,36 +4076,45 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
x = (int32_t)(mouse->x * _global.overlayScaleX);
|
x = (int32_t)(mouse->x * _global.overlayScaleX);
|
||||||
y = (int32_t)(mouse->y * _global.overlayScaleY);
|
y = (int32_t)(mouse->y * _global.overlayScaleY);
|
||||||
xr = (int32_t)(mouse->relx * _global.overlayScaleX);
|
xr = (int32_t)(mouse->relx * _global.overlayScaleX);
|
||||||
yr = (int32_t)(mouse->relx * _global.overlayScaleY);
|
yr = (int32_t)(mouse->rely * _global.overlayScaleY);
|
||||||
|
//utilSay("ManyMouse %d: Relative %dx%d r=%dx%d", mouseEvent.device, x, y, xr, yr);
|
||||||
// Remember this change
|
// Remember this change
|
||||||
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2] = x;
|
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2] = xr;
|
||||||
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2 + 1] = y;
|
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2 + 1] = yr;
|
||||||
// Fire event
|
// Fire event
|
||||||
callLua("onMouseMoved", "iiiii", x, y, xr, yr, mouseEvent.device);
|
//callLua("onMouseMoved", "iiiii", x, y, xr, yr, mouseEvent.device);
|
||||||
|
// We return relative coords for all parameters since we have no actual X & Y
|
||||||
|
callLua("onMouseMoved", "iiiii", xr, yr, xr, yr, mouseEvent.device);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//***TODO*** Doesn't ever seem used?
|
||||||
|
/*
|
||||||
case MANYMOUSE_EVENT_ABSMOTION:
|
case MANYMOUSE_EVENT_ABSMOTION:
|
||||||
|
val = (float)(mouseEvent.value - mouseEvent.minval);
|
||||||
|
maxval = (float)(mouseEvent.maxval - mouseEvent.minval);
|
||||||
switch (mouseEvent.item) {
|
switch (mouseEvent.item) {
|
||||||
case 0:
|
case 0:
|
||||||
mouse->x += mouseEvent.value;
|
mouse->x = (val / maxval) * videoGetWidth(_global.videoHandle);
|
||||||
|
//mouse->x += mouseEvent.value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
mouse->y += mouseEvent.value;
|
mouse->y = (val / maxval) * videoGetHeight(_global.videoHandle);
|
||||||
|
//mouse->y += mouseEvent.value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
x = (int32_t)(mouse->x * _global.overlayScaleX);
|
x = (int32_t)(mouse->x * _global.overlayScaleX);
|
||||||
y = (int32_t)(mouse->y * _global.overlayScaleY);
|
y = (int32_t)(mouse->y * _global.overlayScaleY);
|
||||||
xr = (int32_t)(mouse->relx * _global.overlayScaleX);
|
xr = (int32_t)(mouse->relx * _global.overlayScaleX);
|
||||||
yr = (int32_t)(mouse->relx * _global.overlayScaleY);
|
yr = (int32_t)(mouse->rely * _global.overlayScaleY);
|
||||||
//utilSay("Mouse %d: Absolute %d, %d", mouseEvent.device, x, y);
|
//utilSay("ManyMouse %d: Absolute %dx%d r=%dx%d", mouseEvent.device, x, y, xr, yr);
|
||||||
// Remember this change
|
// Remember this change
|
||||||
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2] = x;
|
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2] = x;
|
||||||
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2 + 1] = y;
|
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2 + 1] = y;
|
||||||
// Fire event
|
// Fire event
|
||||||
callLua("onMouseMoved", "iiiii", x, y, xr, yr, mouseEvent.device);
|
callLua("onMouseMoved", "iiiii", x, y, xr, yr, mouseEvent.device);
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case MANYMOUSE_EVENT_BUTTON:
|
case MANYMOUSE_EVENT_BUTTON:
|
||||||
if (mouseEvent.item < 5 /* 32 */) { // Limited to 5 buttons so it matches single-mouse mode
|
if (mouseEvent.item < 5 /* 32 */) { // Limited to 5 buttons so it matches single-mouse mode
|
||||||
//utilSay("ManyMouse %d Button: %d", mouseEvent.device, mouseEvent.item);
|
//utilSay("ManyMouse %d Button: %d", mouseEvent.device, mouseEvent.item);
|
||||||
|
@ -4153,6 +4180,9 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
if (_global.refreshDisplay || _global.discStopped) {
|
if (_global.refreshDisplay || _global.discStopped) {
|
||||||
|
// Clear entire display to black
|
||||||
|
SDL_SetRenderDrawColor(_global.renderer, 0, 0, 0, 255);
|
||||||
|
SDL_RenderClear(_global.renderer);
|
||||||
// Sinden Gun Border
|
// Sinden Gun Border
|
||||||
if (sindenWhite.x >= 0) {
|
if (sindenWhite.x >= 0) {
|
||||||
if (sindenBlack.x >= 0) {
|
if (sindenBlack.x >= 0) {
|
||||||
|
@ -4164,18 +4194,20 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
} else {
|
} else {
|
||||||
// Only white
|
// Only white
|
||||||
SDL_SetRenderDrawColor(_global.renderer, sindenWhiteColor.r, sindenWhiteColor.g, sindenWhiteColor.b, sindenWhiteColor.a);
|
SDL_SetRenderDrawColor(_global.renderer, sindenWhiteColor.r, sindenWhiteColor.g, sindenWhiteColor.b, sindenWhiteColor.a);
|
||||||
SDL_RenderClear(_global.renderer);
|
SDL_RenderFillRect(_global.renderer, &sindenBlack);
|
||||||
|
//SDL_RenderClear(_global.renderer);
|
||||||
}
|
}
|
||||||
SDL_RenderFillRect(_global.renderer, &windowTarget);
|
//SDL_RenderFillRect(_global.renderer, &windowTarget);
|
||||||
}
|
}
|
||||||
// Laserdisc Video
|
// Laserdisc Video
|
||||||
if (_global.discStopped) {
|
if (_global.discStopped) {
|
||||||
// Stopped discs display blue like the good old days
|
// Stopped discs display blue like the good old days
|
||||||
SDL_SetRenderTarget(_global.renderer, _global.videoTexture);
|
SDL_SetRenderTarget(_global.renderer, _global.videoTexture);
|
||||||
SDL_SetRenderDrawColor(_global.renderer, 0, 0, 255, 255);
|
SDL_SetRenderDrawColor(_global.renderer, 0, 0, 255, 255);
|
||||||
SDL_RenderClear(_global.renderer);
|
SDL_RenderFillRect(_global.renderer, &windowTarget);
|
||||||
SDL_SetRenderTarget(_global.renderer, NULL);
|
SDL_SetRenderTarget(_global.renderer, NULL);
|
||||||
}
|
}
|
||||||
|
// Copy current video frame into display
|
||||||
SDL_RenderCopy(_global.renderer, _global.videoTexture, NULL, &windowTarget);
|
SDL_RenderCopy(_global.renderer, _global.videoTexture, NULL, &windowTarget);
|
||||||
// Overlay
|
// Overlay
|
||||||
overlayTexture = SDL_CreateTextureFromSurface(_global.renderer, _global.overlay);
|
overlayTexture = SDL_CreateTextureFromSurface(_global.renderer, _global.overlay);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
// Don't forget to update singe.rc!
|
// Don't forget to update singe.rc!
|
||||||
#define SINGE_VERSION 2.00
|
#define SINGE_VERSION 2.00
|
||||||
#define VERSION_STRING "v2.00b18"
|
#define VERSION_STRING "v2.00b19"
|
||||||
#define COPYRIGHT_END_YEAR "2020"
|
#define COPYRIGHT_END_YEAR "2020"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
101 ICON "/tmp/icon.ico"
|
101 ICON "/tmp/icon.ico"
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION 2,0,0,18
|
FILEVERSION 2,0,0,19
|
||||||
PRODUCTVERSION 2,0,0,18
|
PRODUCTVERSION 2,0,0,19
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -9,12 +9,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Kangaroo Punch Studios"
|
VALUE "CompanyName", "Kangaroo Punch Studios"
|
||||||
VALUE "FileDescription", "Somewhat Interactive Nostalgic Game Engine"
|
VALUE "FileDescription", "Somewhat Interactive Nostalgic Game Engine"
|
||||||
VALUE "FileVersion", "2.00b18"
|
VALUE "FileVersion", "2.00b19"
|
||||||
VALUE "InternalName", "Singe"
|
VALUE "InternalName", "Singe"
|
||||||
VALUE "LegalCopyright", "Copyright 2006-2020 Scott C. Duensing"
|
VALUE "LegalCopyright", "Copyright 2006-2020 Scott C. Duensing"
|
||||||
VALUE "OriginalFilename", "singe.exe"
|
VALUE "OriginalFilename", "singe.exe"
|
||||||
VALUE "ProductName", "Singe"
|
VALUE "ProductName", "Singe"
|
||||||
VALUE "ProductVersion", "2.00b18"
|
VALUE "ProductVersion", "2.00b19"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Add table
Reference in a new issue