Skip to content

Commit

Permalink
Singe v1.14 update
Browse files Browse the repository at this point in the history
git-svn-id: https://www.daphne-emu.com:9443/daphnesvn/branches/v_1_0@3263 c98d566b-fa28-4d4c-8a7b-932307ef5c1a
  • Loading branch information
rdg committed Dec 23, 2010
1 parent b84fd32 commit 550e8ff
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 71 deletions.
14 changes: 7 additions & 7 deletions src/HOW_TO_COMPILE_WIN32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ H. Troubleshooting Compiler and Linking Errors:

+ .\daphne.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'

Happens when converting project solutions to newer
Visual Studio versions. Open up daphne.rc and change the
Happens when converting the VS2003 project solution to a newer
Visual Studio version. Open up daphne.rc and change the
following line:

#include "afxres.h"
Expand All @@ -298,15 +298,15 @@ H. Troubleshooting Compiler and Linking Errors:

#include "windows.h"

+ LINK : fatal error LNK1181: cannot open input file '*******.lib'
+ LINK : fatal error LNK????: cannot open input file '*******.lib'

Visual Studio can't find the specified library.
Probably the file is missing or misspelled.
Probably the file is misspelled in the linker properties.
Usually happens with zlib, libogg or libvorbis libraries.

Check that your project linker "INPUT" properties
are correctly spelled and
that your library directories are pointing to the right places.
Check that the library files declared in the project linker
"INPUT" properties are correctly spelled and that your library
directories are pointing to the right places.

+ error PRJ0019: A tool returned an error code from
"Performing Custom Build Step"
Expand Down
36 changes: 21 additions & 15 deletions src/game/singe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,32 @@ bool singe::init()

// by RDG2010
g_SingeIn.get_status = get_status;
g_SingeIn.get_singe_version = get_singe_version;
g_SingeIn.set_ldp_verbose = set_ldp_verbose;

// These functions allow the DLL side of SINGE
// call the functions set_keyboard_mode and get_keyboard_mode inside this very class.

// Explaining the two lines below:
//
// Writing this down to hopefully remind myself in the future.
// The function on the left side is called from the DLL side.
// It's the one that asks Daphne for something.
// Have a look at the "singe_in_info" struct in singe_interface.h
// The DLL refers to this function from within. In this case singeproxy.cpp
// Have a look at the "singe_in_info" struct in singe_interface.h for declaration examples.
//
// The function on the right side is the wrapper function.
// It's the one that redirects the call to the appropriate
// function on the Daphne side.
// It's the function that does something on the Daphne side.
//
// Have a look at the class declaration in singe.h for details.
// I am using these prefixes in an attempt to make things easier to read:
//
// CFM == Call For Me
// GFM == Get For Me
// The two lines below basically link these functions together
// So when the DLL needs something from Daphne
// then the DLL knows which function to call.
g_SingeIn.cfm_set_keyboard_mode = gfm_set_keyboard_mode;
g_SingeIn.cfm_get_keyboard_mode = gfm_get_keyboard_mode;

/*
Why a wrapper?
Special case. We can't hook up the CFMs
directly to the functions inside the class
Special case. We can't hook up the function on the Daphne side (CFMs)
directly to the functions inside the singe class
because their pointer types don't match.
To do function callbacks you need to provide a static function.
The wrapper function (GFMs) solve this problem.
Expand Down Expand Up @@ -201,7 +201,6 @@ bool singe::init()
printerror("You must use VLDP when using Singe.");
bSuccess = false;
}

if (!bSuccess)
{
#ifndef STATIC_SINGE
Expand All @@ -215,8 +214,9 @@ bool singe::init()
void singe::start()
{
int intReturn = 0;

printline("Starting Singe.");
char s1[100];
sprintf(s1,"Starting Singe version %.2f",get_singe_version());
printline(s1);
g_pSingeOut->sep_set_surface(m_video_overlay_width, m_video_overlay_height);
g_pSingeOut->sep_set_static_pointers(&m_disc_fps, &m_uDiscFPKS);
g_pSingeOut->sep_startup(m_strGameScript.c_str());
Expand Down Expand Up @@ -404,6 +404,12 @@ int singe::get_keyboard_mode()
return i_keyboard_mode;
}

double singe::get_singe_version()
{
double thisVersion = SINGE_VERSION;
return thisVersion;
}

// Have SINGE deal directly with SDL input
// This handles when a key is pressed down
void singe::process_keydown(SDLKey key, int keydefs[][2])
Expand Down
5 changes: 4 additions & 1 deletion src/game/singe.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
using namespace std;

// by rdg2010

#define SINGE_VERSION 1.14 // Update this number whenever you issue a major change
enum { KEYBD_NORMAL, KEYBD_FULL };

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -87,6 +87,9 @@ class singe : public game
// Sometimes it's useful to know the status of the vldp.
// Lets give Singe the ability to query for this.
static int get_status() { return g_ldp->get_status(); }
static double get_singe_version(); // Returns version of the Singe engine
// Controls VLDP message displays on daphne_log.txt
static void set_ldp_verbose(bool thisBol) { g_ldp->setVerbose(thisBol); }

// These wrapper functions makes the function set_keyboard_mode and get_keyboard_mode
// available for the DLL/so library side of SINGE.
Expand Down
5 changes: 3 additions & 2 deletions src/game/singe/singe_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define SINGE_INTERFACE_H

// increase this number every time you change something in this file!!!
#define SINGE_INTERFACE_API_VERSION 4
#define SINGE_INTERFACE_API_VERSION 5

// info provided to Singe from Daphne
struct singe_in_info
Expand Down Expand Up @@ -54,7 +54,8 @@ struct singe_in_info
void (*cfm_set_keyboard_mode)(void *, int);
int (*cfm_get_keyboard_mode)(void *);
int (*get_status)();

double (*get_singe_version)(void);
void (*set_ldp_verbose)(bool);

// VARIABLES:

Expand Down
38 changes: 38 additions & 0 deletions src/game/singe/singeproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ void sep_startup(const char *script)
lua_register(g_se_lua_context, "vldpGetHeight", sep_mpeg_get_height);
lua_register(g_se_lua_context, "vldpGetPixel", sep_mpeg_get_pixel);
lua_register(g_se_lua_context, "vldpGetWidth", sep_mpeg_get_width);
lua_register(g_se_lua_context, "vldpSetVerbose", sep_ldp_verbose);

// by RDG2010
lua_register(g_se_lua_context, "keyboardGetMode", sep_keyboard_get_mode);
Expand All @@ -541,6 +542,8 @@ void sep_startup(const char *script)
lua_register(g_se_lua_context, "singeGetPauseFlag", sep_get_pause_flag);
lua_register(g_se_lua_context, "singeSetPauseFlag", sep_set_pause_flag);
lua_register(g_se_lua_context, "singeQuit", sep_singe_quit);
lua_register(g_se_lua_context, "singeVersion", sep_singe_version);

//////////////////

if (TTF_Init() < 0)
Expand Down Expand Up @@ -1406,3 +1409,38 @@ static int sep_set_pause_flag(lua_State *L)
}
return 0;
}

static int sep_singe_version(lua_State *L)
{
/*
* Returns Singe engine version to the lua script.
* For validation purposes.
*
*/

lua_pushnumber(L, g_pSingeIn->get_singe_version());
return 1;

}
static int sep_ldp_verbose(lua_State *L)
{
/*
* Enables/Disables writing of VLDP playback activity to daphne_log.txt
* Enabled by default.
*/

int n = lua_gettop(L);
bool b1 = false;

if (n == 1)
{
if (lua_isboolean(L, 1))
{
b1 = lua_toboolean(L, 1);
g_pSingeIn->set_ldp_verbose(b1);

}
}

return 0;
}
2 changes: 2 additions & 0 deletions src/game/singe/singeproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,5 @@ static int sep_singe_quit(lua_State *L);
static int sep_get_vldp_state(lua_State *L);
static int sep_get_pause_flag(lua_State *L);
static int sep_set_pause_flag(lua_State *L);
static int sep_singe_version(lua_State *L);
static int sep_ldp_verbose(lua_State *L);
4 changes: 2 additions & 2 deletions src/io/cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ bool parse_cmd_line(int argc, char **argv)
}

// to disable any existing joysticks that may be plugged in that may interfere with input
else if (strcasecmp(s, "-nojoystick")==0)
else if ((strcasecmp(s, "-nojoystick")==0) || (strcasecmp(s, "-nojoy")==0))
{
set_use_joystick(false);
}
Expand All @@ -772,7 +772,7 @@ bool parse_cmd_line(int argc, char **argv)
{
net_no_server_send();
}
else if (strcasecmp(s, "-nosound")==0)
else if ((strcasecmp(s, "-nosound")==0) || (strcasecmp(s, "-mutesound")==0))
{
set_sound_enabled_status(false);
printline("Disabling sound...");
Expand Down
Loading

0 comments on commit 550e8ff

Please sign in to comment.