Finish committing the remaining gtk3 patch (wip)

This commit is contained in:
Zach Bacon 2015-12-12 23:23:34 -05:00
parent c8343267fc
commit 7ed85a8c6f
34 changed files with 338 additions and 166 deletions

View File

@ -46,6 +46,7 @@ extern "C" {
#include <getopt.h> #include <getopt.h>
#endif // ! __GNUC__ #endif // ! __GNUC__
#include <string> #include <string>
#include <sstream>
enum named_opts enum named_opts
{ {
@ -120,22 +121,22 @@ bool mirroringEnable = true;
bool parseDebug = true; bool parseDebug = true;
bool speedHack = false; bool speedHack = false;
bool speedup = false; bool speedup = false;
char* aviRecordDir; const char* aviRecordDir;
char* batteryDir; const char* batteryDir;
char* biosFileNameGB; const char* biosFileNameGB;
char* biosFileNameGBA; const char* biosFileNameGBA;
char* biosFileNameGBC; const char* biosFileNameGBC;
char* loadDotCodeFile; const char* loadDotCodeFile;
char* saveDotCodeFile; const char* saveDotCodeFile;
char* linkHostAddr; const char* linkHostAddr;
char* movieRecordDir; const char* movieRecordDir;
char* rewindMemory = NULL; char* rewindMemory = NULL;
char* romDirGB; const char* romDirGB;
char* romDirGBA; const char* romDirGBA;
char* romDirGBC; const char* romDirGBC;
char* saveDir; const char* saveDir;
char* screenShotDir; const char* screenShotDir;
char* soundRecordDir; const char* soundRecordDir;
int active = 1; int active = 1;
int agbPrint; int agbPrint;
int autoFire; int autoFire;
@ -387,7 +388,7 @@ struct option argOptions[] = {
}; };
u32 fromHex(char *s) u32 fromHex(const char *s)
{ {
if (!s) if (!s)
return 0; return 0;
@ -396,7 +397,7 @@ u32 fromHex(char *s)
return value; return value;
} }
u32 fromDec(char *s) u32 fromDec(const char *s)
{ {
if (!s) if (!s)
return 0; return 0;
@ -554,7 +555,7 @@ void LoadConfig()
volume_percent = 1.0; volume_percent = 1.0;
soundSetVolume(volume_percent); soundSetVolume(volume_percent);
soundSetEnable((ReadPrefHex("soundEnable")) & 0x30f); soundSetEnable((ReadPrefHex("soundEnable", 0x30f)) & 0x30f);
if ((ReadPrefHex("soundStereo"))) { if ((ReadPrefHex("soundStereo"))) {
gb_effects_config.enabled = true; gb_effects_config.enabled = true;
} }
@ -613,7 +614,7 @@ void CloseConfig()
iniparser_freedict(preferences); iniparser_freedict(preferences);
} }
char* FindConfigFile(char *name) const char* FindConfigFile(const char *name)
{ {
char buffer[4096]; char buffer[4096];
@ -721,13 +722,13 @@ void LoadConfigFile()
if (preferences == NULL) if (preferences == NULL)
{ {
char* configFile = FindConfigFile("vbam.ini"); const char* configFile = FindConfigFile("vbam.ini");
OpenPreferences(configFile); OpenPreferences(configFile);
} }
if (preferences == NULL) if (preferences == NULL)
{ {
char* configFile = FindConfigFile("vbam.cfg"); const char* configFile = FindConfigFile("vbam.cfg");
OpenPreferences(configFile); OpenPreferences(configFile);
} }
} }
@ -747,7 +748,7 @@ void SaveConfigFile()
homeDir = 0; homeDir = 0;
#endif #endif
char* configFile = FindConfigFile("vbam.ini"); const char* configFile = FindConfigFile("vbam.ini");
if (configFile == NULL) if (configFile == NULL)
{ {
@ -772,7 +773,20 @@ void SaveConfigFile()
} }
} }
u32 ReadPrefHex(char* pref_key) u32 ReadPrefHex(const char* pref_key, int default_value)
{
std::stringstream ss;
std::string default_string;
ss.setf(std::ios::hex|std::ios::showbase, std::ios::basefield);
ss << default_value;
ss >> default_string;
LoadConfigFile();
std::string pref = "preferences:";
pref.append(pref_key);
return fromHex(iniparser_getstring(preferences, pref.c_str(), default_string.c_str()));
}
u32 ReadPrefHex(const char* pref_key)
{ {
LoadConfigFile(); LoadConfigFile();
std::string pref = "preferences:"; std::string pref = "preferences:";
@ -780,7 +794,7 @@ u32 ReadPrefHex(char* pref_key)
return fromHex(iniparser_getstring(preferences, pref.c_str(), 0)); return fromHex(iniparser_getstring(preferences, pref.c_str(), 0));
} }
u32 ReadPref(char* pref_key, int default_value) u32 ReadPref(const char* pref_key, int default_value)
{ {
LoadConfigFile(); LoadConfigFile();
std::string pref = "preferences:"; std::string pref = "preferences:";
@ -788,12 +802,12 @@ u32 ReadPref(char* pref_key, int default_value)
return iniparser_getint(preferences, pref.c_str(), default_value); return iniparser_getint(preferences, pref.c_str(), default_value);
} }
u32 ReadPref(char* pref_key) u32 ReadPref(const char* pref_key)
{ {
return ReadPref(pref_key, 0); return ReadPref(pref_key, 0);
} }
char* ReadPrefString(char* pref_key, char* default_value) const char* ReadPrefString(const char* pref_key, const char* default_value)
{ {
LoadConfigFile(); LoadConfigFile();
std::string pref = "preferences:"; std::string pref = "preferences:";
@ -801,7 +815,7 @@ char* ReadPrefString(char* pref_key, char* default_value)
return iniparser_getstring(preferences, pref.c_str(), default_value); return iniparser_getstring(preferences, pref.c_str(), default_value);
} }
char* ReadPrefString(char* pref_key) const char* ReadPrefString(const char* pref_key)
{ {
return ReadPrefString(pref_key, ""); return ReadPrefString(pref_key, "");
} }
@ -845,7 +859,7 @@ int ReadOpts(int argc, char ** argv)
log("Missing BIOS file name\n"); log("Missing BIOS file name\n");
break; break;
} }
strcpy(biosFileNameGBA, optarg); biosFileNameGBA = strdup(optarg);
break; break;
case 'c': case 'c':
{ {

View File

@ -22,18 +22,18 @@ extern bool parseDebug;
extern bool speedHack; extern bool speedHack;
extern bool speedup; extern bool speedup;
extern char* rewindMemory; extern char* rewindMemory;
extern char* aviRecordDir; extern const char* aviRecordDir;
extern char* biosFileNameGB; extern const char* biosFileNameGB;
extern char* biosFileNameGBA; extern const char* biosFileNameGBA;
extern char* biosFileNameGBC; extern const char* biosFileNameGBC;
extern char* loadDotCodeFile; extern const char* loadDotCodeFile;
extern char* saveDotCodeFile; extern const char* saveDotCodeFile;
extern char* linkHostAddr; extern const char* linkHostAddr;
extern char* movieRecordDir; extern const char* movieRecordDir;
extern char* romDirGB; extern const char* romDirGB;
extern char* romDirGBA; extern const char* romDirGBA;
extern char* romDirGBC; extern const char* romDirGBC;
extern char* soundRecordDir; extern const char* soundRecordDir;
extern int* rewindSerials; extern int* rewindSerials;
extern int active; extern int active;
extern int agbPrint; extern int agbPrint;
@ -155,9 +155,9 @@ extern IFBFilterFunc ifbFunction;
extern char* homeDir; extern char* homeDir;
extern char* screenShotDir; extern const char* screenShotDir;
extern char* saveDir; extern const char* saveDir;
extern char* batteryDir; extern const char* batteryDir;
// Directory within homedir to use for default save location. // Directory within homedir to use for default save location.
#define DOT_DIR ".vbam" #define DOT_DIR ".vbam"
@ -165,12 +165,13 @@ extern char* batteryDir;
void SetHome(char *_arg0); void SetHome(char *_arg0);
void SaveConfigFile(); void SaveConfigFile();
void CloseConfig(); void CloseConfig();
u32 ReadPrefHex(char* pref_key); u32 ReadPrefHex(const char* pref_key, int default_value);
u32 ReadPref(char* pref_key, int default_value); u32 ReadPrefHex(const char* pref_key);
u32 ReadPref(char* pref_key); u32 ReadPref(const char* pref_key, int default_value);
char* ReadPrefString(char* pref_key, char* default_value); u32 ReadPref(const char* pref_key);
char* ReadPrefString(char* pref_key); const char* ReadPrefString(const char* pref_key, const char* default_value);
const char* ReadPrefString(const char* pref_key);
void LoadConfigFile(int argc, char ** argv); void LoadConfigFile(int argc, char ** argv);
void LoadConfig(); void LoadConfig();
int ReadOpts(int argc, char ** argv); int ReadOpts(int argc, char ** argv);
#endif #endif

View File

@ -172,7 +172,7 @@ void dictionary_del(dictionary * d)
dictionary object, you should not try to free it or modify it. dictionary object, you should not try to free it or modify it.
*/ */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
char * dictionary_get(dictionary * d, const char * key, char * def) const char * dictionary_get(dictionary * d, const char * key, const char * def)
{ {
unsigned hash ; unsigned hash ;
int i ; int i ;

View File

@ -103,7 +103,7 @@ void dictionary_del(dictionary * vd);
dictionary object, you should not try to free it or modify it. dictionary object, you should not try to free it or modify it.
*/ */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
char * dictionary_get(dictionary * d, const char * key, char * def); const char * dictionary_get(dictionary * d, const char * key, const char * def);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/

View File

@ -215,13 +215,21 @@ void iniparser_dump_ini(dictionary * d, FILE * f)
nsec = iniparser_getnsec(d); nsec = iniparser_getnsec(d);
if (nsec<1) { if (nsec<1) {
/* No section in file: dump all keys as they are */ /* No section in file: dump all keys as they are */
fprintf(f, "[preferences]\n");
for (i=0 ; i<d->size ; i++) { for (i=0 ; i<d->size ; i++) {
if (d->key[i]==NULL) if (d->key[i]==NULL)
continue ; continue ;
fprintf(f, "%s=%s\n", d->key[i], d->val[i]); if (!strncmp(d->key[i], "preferences:", strlen("preferences:"))) {
fprintf(f,
"%s=%s\n",
d->key[i]+strlen("preferences:"),
d->val[i] ? d->val[i] : "");
}
} }
fprintf(f, "\n");
return ; return ;
} }
for (i=0 ; i<nsec ; i++) { for (i=0 ; i<nsec ; i++) {
secname = iniparser_getsecname(d, i) ; secname = iniparser_getsecname(d, i) ;
iniparser_dumpsection_ini(d, secname, f) ; iniparser_dumpsection_ini(d, secname, f) ;
@ -365,10 +373,10 @@ char ** iniparser_getseckeys(dictionary * d, char * s)
the dictionary, do not free or modify it. the dictionary, do not free or modify it.
*/ */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
char * iniparser_getstring(dictionary * d, const char * key, char * def) const char * iniparser_getstring(dictionary * d, const char * key, const char * def)
{ {
char * lc_key ; char * lc_key ;
char * sval ; const char * sval ;
if (d==NULL || key==NULL) if (d==NULL || key==NULL)
return def ; return def ;
@ -407,7 +415,7 @@ char * iniparser_getstring(dictionary * d, const char * key, char * def)
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int iniparser_getint(dictionary * d, const char * key, int notfound) int iniparser_getint(dictionary * d, const char * key, int notfound)
{ {
char * str ; const char *str;
str = iniparser_getstring(d, key, INI_INVALID_KEY); str = iniparser_getstring(d, key, INI_INVALID_KEY);
if (str==INI_INVALID_KEY) return notfound ; if (str==INI_INVALID_KEY) return notfound ;
@ -429,7 +437,7 @@ int iniparser_getint(dictionary * d, const char * key, int notfound)
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
double iniparser_getdouble(dictionary * d, const char * key, double notfound) double iniparser_getdouble(dictionary * d, const char * key, double notfound)
{ {
char * str ; const char *str;
str = iniparser_getstring(d, key, INI_INVALID_KEY); str = iniparser_getstring(d, key, INI_INVALID_KEY);
if (str==INI_INVALID_KEY) return notfound ; if (str==INI_INVALID_KEY) return notfound ;
@ -470,7 +478,7 @@ double iniparser_getdouble(dictionary * d, const char * key, double notfound)
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int iniparser_getboolean(dictionary * d, const char * key, int notfound) int iniparser_getboolean(dictionary * d, const char * key, int notfound)
{ {
char * c ; const char * c;
int ret ; int ret ;
c = iniparser_getstring(d, key, INI_INVALID_KEY); c = iniparser_getstring(d, key, INI_INVALID_KEY);
@ -699,7 +707,10 @@ dictionary * iniparser_load(const char * ininame)
break ; break ;
case LINE_VALUE: case LINE_VALUE:
sprintf(tmp, "%s:%s", section, key); if (strlen(section))
sprintf(tmp, "%s:%s", section, key);
else
sprintf(tmp, "preferences:%s", key);
errs = dictionary_set(dict, tmp, val) ; errs = dictionary_set(dict, tmp, val) ;
break ; break ;

View File

@ -152,7 +152,7 @@ char ** iniparser_getseckeys(dictionary * d, char * s);
the dictionary, do not free or modify it. the dictionary, do not free or modify it.
*/ */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
char * iniparser_getstring(dictionary * d, const char * key, char * def); const char * iniparser_getstring(dictionary * d, const char * key, const char * def);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/** /**

View File

@ -86,23 +86,23 @@ int debuggerRadix = 0;
#define NUMBEROFDB 1000 #define NUMBEROFDB 1000
u32 debuggerNoBreakpointList[NUMBEROFDB]; u32 debuggerNoBreakpointList[NUMBEROFDB];
char* cmdAliasTable[] = { "help", "?", "h", "?", "continue", "c", "next", "n", const char* cmdAliasTable[] = { "help", "?", "h", "?", "continue", "c", "next", "n",
"cpyb", "copyb", "cpyh", "copyh", "cpyw", "copyw", "cpyb", "copyb", "cpyh", "copyh", "cpyw", "copyw",
"exe", "execute", "exec", "execute", "exe", "execute", "exec", "execute",
NULL, NULL }; NULL, NULL };
struct DebuggerCommand { struct DebuggerCommand {
char *name; const char *name;
void(*function)(int, char **); void(*function)(int, char **);
char *help; const char *help;
char *syntax; const char *syntax;
}; };
char monbuf[1000]; char monbuf[1000];
void monprintf(std::string line); void monprintf(std::string line);
std::string StringToHex(std::string &cmd); std::string StringToHex(std::string &cmd);
std::string HexToString(char * p); std::string HexToString(char * p);
void debuggerUsage(char *cmd); void debuggerUsage(const char *cmd);
void debuggerHelp(int n, char **args); void debuggerHelp(int n, char **args);
void printFlagHelp(); void printFlagHelp();
void dbgExecute(std::string &cmd); void dbgExecute(std::string &cmd);
@ -230,7 +230,7 @@ void addBreakRegToList(u8 regnum, u8 flags, u32 value){
} }
void printBreakRegList(bool verbose){ void printBreakRegList(bool verbose){
char* flagsToOP[] = { "never", "==", ">", ">=", "<", "<=", "!=", "always" }; const char* flagsToOP[] = { "never", "==", ">", ">=", "<", "<=", "!=", "always" };
bool anyPrint = false; bool anyPrint = false;
for (int i = 0; i<4; i++){ for (int i = 0; i<4; i++){
for (int k = 0; k<4; k++){ for (int k = 0; k<4; k++){
@ -416,7 +416,7 @@ void debuggerEditByte(int n, char **args)
{ sprintf(monbuf, "Invalid expression in address.\n"); monprintf(monbuf); } { sprintf(monbuf, "Invalid expression in address.\n"); monprintf(monbuf); }
return; return;
} }
for (u32 i = 2; i < n; i++){ for (int i = 2; i < n; i++){
if (!dexp_eval(args[i], &value)) { if (!dexp_eval(args[i], &value)) {
{ sprintf(monbuf, "Invalid expression in %d value.Ignored.\n", (i - 1)); monprintf(monbuf); } { sprintf(monbuf, "Invalid expression in %d value.Ignored.\n", (i - 1)); monprintf(monbuf); }
} }
@ -441,7 +441,7 @@ void debuggerEditHalfWord(int n, char **args)
{ sprintf(monbuf, "Error: address must be half-word aligned\n"); monprintf(monbuf); } { sprintf(monbuf, "Error: address must be half-word aligned\n"); monprintf(monbuf); }
return; return;
} }
for (u32 i = 2; i < n; i++){ for (int i = 2; i < n; i++){
if (!dexp_eval(args[i], &value)) { if (!dexp_eval(args[i], &value)) {
{ sprintf(monbuf, "Invalid expression in %d value.Ignored.\n", (i - 1)); monprintf(monbuf); } { sprintf(monbuf, "Invalid expression in %d value.Ignored.\n", (i - 1)); monprintf(monbuf); }
} }
@ -466,7 +466,7 @@ void debuggerEditWord(int n, char **args)
{ sprintf(monbuf, "Error: address must be word aligned\n"); monprintf(monbuf); } { sprintf(monbuf, "Error: address must be word aligned\n"); monprintf(monbuf); }
return; return;
} }
for (u32 i = 2; i < n; i++){ for (int i = 2; i < n; i++){
if (!dexp_eval(args[i], &value)) { if (!dexp_eval(args[i], &value)) {
{ sprintf(monbuf, "Invalid expression in %d value.Ignored.\n", (i - 1)); monprintf(monbuf); } { sprintf(monbuf, "Invalid expression in %d value.Ignored.\n", (i - 1)); monprintf(monbuf); }
} }
@ -479,7 +479,7 @@ void debuggerEditWord(int n, char **args)
} }
bool debuggerBreakOnRegisterCondition(u8 registerName, u32 compareVal, u32 regVal, u8 type){ bool debuggerBreakOnRegisterCondition(u8 registerName, u32 compareVal, u32 regVal, u8 type){
char* typeName; const char* typeName;
switch (type){ switch (type){
case 1: case 1:
typeName = "equal to"; typeName = "equal to";
@ -1401,7 +1401,7 @@ void debuggerSymbols(int argc, char **argv)
continue; continue;
} }
} }
char *ts = "?"; const char *ts = "?";
switch (type) { switch (type) {
case 2: case 2:
ts = "ARM"; ts = "ARM";
@ -1656,7 +1656,7 @@ void debuggerBreakRegisterDelete(int n, char** args){
//WARNING: Some old particle to new code conversion may convert a single command //WARNING: Some old particle to new code conversion may convert a single command
//into two or more words. Such words are separated by space, so a new tokenizer can //into two or more words. Such words are separated by space, so a new tokenizer can
//find them. //find them.
char* replaceAlias(char* lower_cmd, char** aliasTable){ const char* replaceAlias(const char* lower_cmd, const char** aliasTable){
for (int i = 0; aliasTable[i]; i = i + 2){ for (int i = 0; aliasTable[i]; i = i + 2){
if (strcmp(lower_cmd, aliasTable[i]) == 0){ if (strcmp(lower_cmd, aliasTable[i]) == 0){
return aliasTable[i + 1]; return aliasTable[i + 1];
@ -1665,7 +1665,7 @@ char* replaceAlias(char* lower_cmd, char** aliasTable){
return lower_cmd; return lower_cmd;
} }
char* breakAliasTable[] = { const char* breakAliasTable[] = {
//actual beginning //actual beginning
"break", "b 0 0", "break", "b 0 0",
@ -1813,13 +1813,13 @@ char* breakSymbolCombo(char * command, int* length){
return res; return res;
} }
char* typeMapping[] = { "'u8", "'u16", "'u32", "'u32", "'s8", "'s16", "'s32", "'s32" }; const char* typeMapping[] = { "'u8", "'u16", "'u32", "'u32", "'s8", "'s16", "'s32", "'s32" };
char* compareFlagMapping[] = { "Never", "==", ">", ">=", "<", "<=", "!=", "<=>" }; const char* compareFlagMapping[] = { "Never", "==", ">", ">=", "<", "<=", "!=", "<=>" };
struct intToString{ struct intToString{
int value; int value;
char mapping[20]; const char mapping[20];
}; };
struct intToString breakFlagMapping[] = { struct intToString breakFlagMapping[] = {
@ -1837,9 +1837,9 @@ struct intToString breakFlagMapping[] = {
//printers //printers
void printCondition(struct ConditionalBreakNode* toPrint){ void printCondition(struct ConditionalBreakNode* toPrint){
if (toPrint){ if (toPrint){
char* firstType = typeMapping[toPrint->exp_type_flags & 0x7]; const char* firstType = typeMapping[toPrint->exp_type_flags & 0x7];
char* secondType = typeMapping[(toPrint->exp_type_flags >> 4) & 0x7]; const char* secondType = typeMapping[(toPrint->exp_type_flags >> 4) & 0x7];
char* operand = compareFlagMapping[toPrint->cond_flags & 0x7]; const char* operand = compareFlagMapping[toPrint->cond_flags & 0x7];
{ sprintf(monbuf, "%s %s %s%s %s %s", firstType, toPrint->address, { sprintf(monbuf, "%s %s %s%s %s %s", firstType, toPrint->address,
((toPrint->cond_flags & 8) ? "s" : ""), operand, ((toPrint->cond_flags & 8) ? "s" : ""), operand,
secondType, toPrint->value); secondType, toPrint->value);
@ -2036,8 +2036,8 @@ void deleteBreak(u32 address, u8 flags, char** expression, int howToDelete){
bool applyOr = true; bool applyOr = true;
if (howToDelete > 0){ if (howToDelete > 0){
if (((expression[0][0] == '&') && !expression[0][1]) || if (((expression[0][0] == '&') && !expression[0][1]) ||
(tolower(expression[0][0]) == 'o') && (tolower(expression[0][1]) == 'n') && ((tolower(expression[0][0]) == 'o') && (tolower(expression[0][1]) == 'n')) ||
(tolower(expression[0][0]) == 'l') && (tolower(expression[0][1]) == 'y')){ ((tolower(expression[0][0]) == 'l') && (tolower(expression[0][1]) == 'y'))){
applyOr = false; applyOr = false;
howToDelete--; howToDelete--;
expression++; expression++;
@ -2124,7 +2124,7 @@ void executeBreakCommands(int n, char** cmd){
for (int i = 0; cmd[0][i]; i++){ for (int i = 0; cmd[0][i]; i++){
cmd[0][i] = tolower(cmd[0][i]); cmd[0][i] = tolower(cmd[0][i]);
} }
char* replaced = replaceAlias(cmd[0], breakAliasTable); const char* replaced = replaceAlias(cmd[0], breakAliasTable);
if (replaced == cmd[0]){ if (replaced == cmd[0]){
target = '*'; target = '*';
} }
@ -2207,9 +2207,9 @@ void executeBreakCommands(int n, char** cmd){
} }
else if (operation == clearBreaks){ else if (operation == clearBreaks){
if (!hasAddress && (n >= 1)){ if (!hasAddress && (n >= 1)){
if (((cmd[0][0] == '|' && cmd[0][1] == '|') || if ((cmd[0][0] == '|' && cmd[0][1] == '|') ||
((cmd[0][0] == 'O' || cmd[0][0] == 'o') && ((cmd[0][0] == 'O' || cmd[0][0] == 'o') &&
cmd[0][1] == 'r' || cmd[0][1] == 'r'))) { (cmd[0][1] == 'R' || cmd[0][1] == 'r'))) {
operation(address, flag, NULL, 2); operation(address, flag, NULL, 2);
} }
else{ else{
@ -2411,7 +2411,7 @@ void printFlagHelp()
monprintf("Special flags: always(all true), never(all false).\n"); monprintf("Special flags: always(all true), never(all false).\n");
} }
void debuggerUsage(char *cmd) void debuggerUsage(const char *cmd)
{ {
if (!strcmp(cmd, "break")){ if (!strcmp(cmd, "break")){
monprintf("Break command, composed of three parts:\n"); monprintf("Break command, composed of three parts:\n");
@ -2650,7 +2650,7 @@ void dbgExecute(char* toRun){
// return; // return;
//} //}
commands[0] = replaceAlias(commands[0], cmdAliasTable); commands[0] = (char*)replaceAlias(commands[0], cmdAliasTable);
if (commands[0][0] == 'b'){ if (commands[0][0] == 'b'){
executeBreakCommands(commandCount, commands); executeBreakCommands(commandCount, commands);
@ -3563,7 +3563,7 @@ std::string HexToString(char * p)
std::string hex(p); std::string hex(p);
std::string cmd; std::string cmd;
std::stringstream ss; std::stringstream ss;
int offset = 0; u32 offset = 0;
while (offset < hex.length()) { while (offset < hex.length()) {
unsigned int buffer = 0; unsigned int buffer = 0;
ss.clear(); ss.clear();
@ -3579,7 +3579,7 @@ std::string StringToHex(std::string &cmd)
{ {
std::stringstream ss; std::stringstream ss;
ss << std::hex; ss << std::hex;
for (int i = 0; i < cmd.length(); ++i) for (u32 i = 0; i < cmd.length(); ++i)
ss << std::setw(2) << std::setfill('0') << (int)cmd.c_str()[i]; ss << std::setw(2) << std::setfill('0') << (int)cmd.c_str()[i];
return ss.str(); return ss.str();
} }

View File

@ -1,20 +1,32 @@
#Do not use this file directly. Always use the top level CMakeLists.txt file #Do not use this file directly. Always use the top level CMakeLists.txt file
SET( CMAKE_CXX_FLAGS -std=gnu++11 )
#GTK dependencies #GTK dependencies
FIND_PACKAGE ( PkgConfig REQUIRED ) FIND_PACKAGE ( PkgConfig REQUIRED )
FIND_PACKAGE ( Gettext REQUIRED ) FIND_PACKAGE ( Gettext REQUIRED )
# These dependencies require pkg-config to be found # These dependencies require pkg-config to be found
PKG_CHECK_MODULES ( GTKMM REQUIRED gtkmm-2.4 )
PKG_CHECK_MODULES ( GDKMM REQUIRED gdkmm-2.4 )
PKG_CHECK_MODULES ( GLIBMM REQUIRED glibmm-2.4 ) PKG_CHECK_MODULES ( GLIBMM REQUIRED glibmm-2.4 )
PKG_CHECK_MODULES ( GIOMM REQUIRED giomm-2.4 ) PKG_CHECK_MODULES ( GIOMM REQUIRED giomm-2.4 )
PKG_CHECK_MODULES ( GTKGLMM REQUIRED gtkglextmm-x11-1.2 )
if(ENABLE_GTK)
PKG_CHECK_MODULES ( GTKMM REQUIRED gtkmm-2.4 )
PKG_CHECK_MODULES ( GDKMM REQUIRED gdkmm-2.4 )
PKG_CHECK_MODULES ( GTKGLMM REQUIRED gtkglextmm-x11-1.2 )
endif(ENABLE_GTK)
if(ENABLE_GTK3)
PKG_CHECK_MODULES ( GTKMM REQUIRED gtkmm-3.0 )
PKG_CHECK_MODULES ( GDKMM REQUIRED gdkmm-3.0 )
endif(ENABLE_GTK3)
if(NOT APPLE AND NOT WIN32)
FIND_PACKAGE ( X11 REQUIRED )
endif(NOT APPLE AND NOT WIN32)
#Make sure the gtk ui elements are available for out of tree builds #Make sure the gtk ui elements are available for out of tree builds
#See window.cpp:1544 (the sGetUiFilePath function) for more details #See window.cpp:1544 (the sGetUiFilePath function) for more details
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ui/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ui/) #file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ui/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ui/)
SET(SRC_GTK SET(SRC_GTK
configfile.cpp configfile.cpp
@ -35,7 +47,7 @@ SET(SRC_GTK
soundconfig.cpp soundconfig.cpp
screenarea.cpp screenarea.cpp
screenarea-cairo.cpp screenarea-cairo.cpp
screenarea-opengl.cpp #screenarea-opengl.cpp
tools.cpp tools.cpp
window.cpp window.cpp
../sdl/inputSDL.cpp ../sdl/inputSDL.cpp
@ -47,6 +59,7 @@ INCLUDE_DIRECTORIES(
${GTKMM_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS}
${GDKMM_INCLUDE_DIRS} ${GDKMM_INCLUDE_DIRS}
${GTKGLMM_INCLUDE_DIRS} ${GTKGLMM_INCLUDE_DIRS}
${X11_INCLUDE_DIRS}
) )
LINK_DIRECTORIES( LINK_DIRECTORIES(
@ -61,6 +74,7 @@ ADD_EXECUTABLE (
WIN32 WIN32
MACOSX_BUNDLE MACOSX_BUNDLE
${SRC_GTK} ${SRC_GTK}
../common/SoundSDL.cpp
) )
TARGET_LINK_LIBRARIES ( TARGET_LINK_LIBRARIES (
@ -68,6 +82,7 @@ TARGET_LINK_LIBRARIES (
${VBAMCORE_LIBS} ${VBAMCORE_LIBS}
${GTKMM_LIBRARIES} ${GTKMM_LIBRARIES}
${GTKGLMM_LIBRARIES} ${GTKGLMM_LIBRARIES}
${X11_LIBRARIES}
) )
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/gvbam DESTINATION bin) INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/gvbam DESTINATION bin)
@ -83,4 +98,4 @@ if(APPLE)
SET_PROPERTY(TARGET wxvbam APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in) SET_PROPERTY(TARGET wxvbam APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in)
endif(APPLE) endif(APPLE)
SET(WX_EXE_NAME gvbam${CMAKE_EXECUTABLE_SUFFIX}) SET(WX_EXE_NAME gvbam${CMAKE_EXECUTABLE_SUFFIX})

View File

@ -18,6 +18,7 @@
#include "cheatlist.h" #include "cheatlist.h"
#include <glibmm/miscutils.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include "intl.h" #include "intl.h"

View File

@ -36,7 +36,7 @@ const DirectoriesConfigDialog::SDirEntry DirectoriesConfigDialog::m_astDirs[] =
}; };
DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) : DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) :
Gtk::Dialog(_("Directories config"), true, true), Gtk::Dialog(_("Directories config"), true),
m_poConfig(_poConfig) m_poConfig(_poConfig)
{ {
Gtk::Table * poTable = Gtk::manage( new Gtk::Table(G_N_ELEMENTS(m_astDirs), 2, false)); Gtk::Table * poTable = Gtk::manage( new Gtk::Table(G_N_ELEMENTS(m_astDirs), 2, false));
@ -45,7 +45,7 @@ DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) :
for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++) for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++)
{ {
Gtk::Label * poLabel = Gtk::manage( new Gtk::Label(gettext(m_astDirs[i].m_csLabel), Gtk::ALIGN_RIGHT) ); Gtk::Label * poLabel = Gtk::manage( new Gtk::Label(gettext(m_astDirs[i].m_csLabel), Gtk::ALIGN_END) );
m_poButtons[i] = Gtk::manage( new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER) ); m_poButtons[i] = Gtk::manage( new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER) );
m_poButtons[i]->set_current_folder(m_poConfig->sGetKey(m_astDirs[i].m_csKey)); m_poButtons[i]->set_current_folder(m_poConfig->sGetKey(m_astDirs[i].m_csKey));

View File

@ -22,6 +22,7 @@
#include <gtkmm/frame.h> #include <gtkmm/frame.h>
#include <gtkmm/radiobutton.h> #include <gtkmm/radiobutton.h>
#include <gtkmm/liststore.h> #include <gtkmm/liststore.h>
#include <gtkmm/radiobutton.h>
#include "intl.h" #include "intl.h"
#include "filters.h" #include "filters.h"

View File

@ -22,6 +22,7 @@
#include <gtkmm/dialog.h> #include <gtkmm/dialog.h>
#include <gtkmm/builder.h> #include <gtkmm/builder.h>
#include <gtkmm/combobox.h> #include <gtkmm/combobox.h>
#include <gtkmm/radiobutton.h>
#include "configfile.h" #include "configfile.h"
#include "window.h" #include "window.h"

View File

@ -71,6 +71,7 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
"*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]" "*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]"
}; };
#if !GTK_CHECK_VERSION(3, 0, 0)
Gtk::FileFilter oAllFilter; Gtk::FileFilter oAllFilter;
oAllFilter.set_name(_("All files")); oAllFilter.set_name(_("All files"));
oAllFilter.add_pattern("*"); oAllFilter.add_pattern("*");
@ -81,6 +82,18 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
{ {
oBiosFilter.add_pattern(acsPattern[i]); oBiosFilter.add_pattern(acsPattern[i]);
} }
#else
const Glib::RefPtr<Gtk::FileFilter> oAllFilter = Gtk::FileFilter::create();
oAllFilter->set_name(_("All files"));
oAllFilter->add_pattern("*");
const Glib::RefPtr<Gtk::FileFilter> oBiosFilter = Gtk::FileFilter::create();
oBiosFilter->set_name(_("Gameboy Advance BIOS"));
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
{
oBiosFilter->add_pattern(acsPattern[i]);
}
#endif
m_poBiosFileChooserButton->add_filter(oAllFilter); m_poBiosFileChooserButton->add_filter(oAllFilter);
m_poBiosFileChooserButton->add_filter(oBiosFilter); m_poBiosFileChooserButton->add_filter(oBiosFilter);

View File

@ -19,6 +19,7 @@
#ifndef __VBA_GAMEBOYADVANCECONFIG_H__ #ifndef __VBA_GAMEBOYADVANCECONFIG_H__
#define __VBA_GAMEBOYADVANCECONFIG_H__ #define __VBA_GAMEBOYADVANCECONFIG_H__
#include <gtkmm/checkbutton.h>
#include <gtkmm/combobox.h> #include <gtkmm/combobox.h>
#include <gtkmm/filechooserbutton.h> #include <gtkmm/filechooserbutton.h>

View File

@ -19,6 +19,7 @@
#ifndef __VBA_GAMEBOYCONFIG_H__ #ifndef __VBA_GAMEBOYCONFIG_H__
#define __VBA_GAMEBOYCONFIG_H__ #define __VBA_GAMEBOYCONFIG_H__
#include <gtkmm/checkbutton.h>
#include <gtkmm/combobox.h> #include <gtkmm/combobox.h>
#include <gtkmm/filechooserbutton.h> #include <gtkmm/filechooserbutton.h>

View File

@ -19,7 +19,9 @@
#ifndef __VBA_GENERALCONFIG_H__ #ifndef __VBA_GENERALCONFIG_H__
#define __VBA_GENERALCONFIG_H__ #define __VBA_GENERALCONFIG_H__
#include <gtkmm.h> #include <gtkmm/checkbutton.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/combobox.h>
#include "configfile.h" #include "configfile.h"
#include "window.h" #include "window.h"

View File

@ -18,6 +18,7 @@
#include "joypadconfig.h" #include "joypadconfig.h"
#include <glibmm/main.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include "intl.h" #include "intl.h"
@ -44,9 +45,9 @@ const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] =
}; };
JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) : JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
Gtk::Dialog(_("Joypad config"), true, true), Gtk::Dialog(_("Joypad config"), true),
m_oTitleHBox(false, 5), m_oTitleHBox(false, 5),
m_oTitleLabel(_("Joypad :"), Gtk::ALIGN_RIGHT), m_oTitleLabel(_("Joypad :"), Gtk::ALIGN_END),
m_oDefaultJoypad(_("Default joypad")), m_oDefaultJoypad(_("Default joypad")),
m_oTable(G_N_ELEMENTS(m_astKeys), 2, false), m_oTable(G_N_ELEMENTS(m_astKeys), 2, false),
m_iCurrentEntry(-1), m_iCurrentEntry(-1),
@ -55,10 +56,17 @@ JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
m_poConfig(_poConfig) m_poConfig(_poConfig)
{ {
// Joypad selection // Joypad selection
#if !GTK_CHECK_VERSION(3, 0, 0)
m_oTitleCombo.append_text("1"); m_oTitleCombo.append_text("1");
m_oTitleCombo.append_text("2"); m_oTitleCombo.append_text("2");
m_oTitleCombo.append_text("3"); m_oTitleCombo.append_text("3");
m_oTitleCombo.append_text("4"); m_oTitleCombo.append_text("4");
#else
m_oTitleCombo.append("1");
m_oTitleCombo.append("2");
m_oTitleCombo.append("3");
m_oTitleCombo.append("4");
#endif
m_oTitleHBox.pack_start(m_oTitleLabel, Gtk::PACK_SHRINK); m_oTitleHBox.pack_start(m_oTitleLabel, Gtk::PACK_SHRINK);
m_oTitleHBox.pack_start(m_oTitleCombo); m_oTitleHBox.pack_start(m_oTitleCombo);
@ -66,7 +74,7 @@ JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
// Joypad buttons // Joypad buttons
for (guint i = 0; i < G_N_ELEMENTS(m_astKeys); i++) for (guint i = 0; i < G_N_ELEMENTS(m_astKeys); i++)
{ {
Gtk::Label * poLabel = Gtk::manage( new Gtk::Label(gettext(m_astKeys[i].m_csKeyName), Gtk::ALIGN_RIGHT) ); Gtk::Label * poLabel = Gtk::manage( new Gtk::Label(gettext(m_astKeys[i].m_csKeyName), Gtk::ALIGN_END) );
Gtk::Entry * poEntry = Gtk::manage( new Gtk::Entry() ); Gtk::Entry * poEntry = Gtk::manage( new Gtk::Entry() );
m_oTable.attach(* poLabel, 0, 1, i, i + 1); m_oTable.attach(* poLabel, 0, 1, i, i + 1);
m_oTable.attach(* poEntry, 1, 2, i, i + 1); m_oTable.attach(* poEntry, 1, 2, i, i + 1);
@ -199,7 +207,11 @@ bool JoypadConfigDialog::on_key_press_event(GdkEventKey * _pstEvent)
// Forward the keyboard event by faking a SDL event // Forward the keyboard event by faking a SDL event
SDL_Event event; SDL_Event event;
event.type = SDL_KEYDOWN; event.type = SDL_KEYDOWN;
event.key.keysym.sym = (SDLKey)_pstEvent->keyval; //event.key.timestamp = SDL_GetTicks();
//event.key.windowID = 0;
//event.key.repeat = 0;
//event.key.keysym.sym = (SDLKey)_pstEvent->keyval;
event.key.keysym.sym = (SDL_Keycode)_pstEvent->keyval;
vOnInputEvent(event); vOnInputEvent(event);
return true; return true;

View File

@ -19,11 +19,15 @@
#include <gtkmm/main.h> #include <gtkmm/main.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <gtkmm/messagedialog.h> #include <gtkmm/messagedialog.h>
#include <glibmm/miscutils.h>
#ifdef USE_OPENGL #if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
#include <gtkmm/gl/init.h> #include <gtkmm/gl/init.h>
#endif // USE_OPENGL #endif // USE_OPENGL
// this will be ifdefed soon
#include <X11/Xlib.h>
#include "window.h" #include "window.h"
#include "intl.h" #include "intl.h"
@ -39,12 +43,14 @@ int main(int argc, char * argv[])
bindtextdomain("gvbam", LOCALEDIR); bindtextdomain("gvbam", LOCALEDIR);
textdomain("gvbam"); textdomain("gvbam");
#endif // ENABLE_NLS #endif // ENABLE_NLS
//will be ifdefed
XInitThreads();
Glib::set_application_name(_("VBA-M")); Glib::set_application_name(_("VBA-M"));
Gtk::Main oKit(argc, argv); Gtk::Main oKit(argc, argv);
#ifdef USE_OPENGL #if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
Gtk::GL::init(argc, argv); Gtk::GL::init(argc, argv);
#endif // USE_OPENGL #endif // USE_OPENGL

View File

@ -39,6 +39,7 @@ void ScreenAreaCairo::vDrawPixels(u8 * _puiData)
queue_draw(); queue_draw();
} }
#if !GTK_CHECK_VERSION(3, 0, 0)
bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent) bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent)
{ {
DrawingArea::on_expose_event(_pstEvent); DrawingArea::on_expose_event(_pstEvent);
@ -50,16 +51,16 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent)
poContext = get_window()->create_cairo_context(); poContext = get_window()->create_cairo_context();
poContext->set_identity_matrix(); //poContext->set_identity_matrix();
poContext->scale(m_dScaleFactor, m_dScaleFactor); poContext->scale(m_dScaleFactor, m_dScaleFactor);
poImage = Cairo::ImageSurface::create((u8 *)m_puiPixels, Cairo::FORMAT_RGB24, poImage = Cairo::ImageSurface::create((u8 *)m_puiPixels, Cairo::FORMAT_RGB24,
m_iScaledWidth, m_iScaledHeight, iScaledPitch); m_iScaledWidth, m_iScaledHeight, iScaledPitch);
cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop); //cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop);
poPattern = Cairo::SurfacePattern::create(poImage); poPattern = Cairo::SurfacePattern::create(poImage);
poPattern->set_filter(Cairo::FILTER_NEAREST); poPattern->set_filter(Cairo::FILTER_NEAREST);
poPattern->set_matrix (oMatrix); //poPattern->set_matrix (oMatrix);
poContext->set_source_rgb(0.0, 0.0, 0.0); poContext->set_source_rgb(0.0, 0.0, 0.0);
poContext->paint(); poContext->paint();
@ -68,10 +69,38 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent)
return true; return true;
} }
#else
bool ScreenAreaCairo::on_draw(const Cairo::RefPtr<Cairo::Context> &poContext)
{
DrawingArea::on_draw(poContext);
Cairo::RefPtr< Cairo::ImageSurface > poImage;
Cairo::RefPtr< Cairo::SurfacePattern > poPattern;
Cairo::Matrix oMatrix;
const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(u32);
//poContext->set_identity_matrix();
poContext->scale(m_dScaleFactor, m_dScaleFactor);
poImage = Cairo::ImageSurface::create((u8 *)m_puiPixels, Cairo::FORMAT_RGB24,
m_iScaledWidth, m_iScaledHeight, iScaledPitch);
//cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop);
poPattern = Cairo::SurfacePattern::create(poImage);
poPattern->set_filter(Cairo::FILTER_NEAREST);
//poPattern->set_matrix (oMatrix);
poContext->set_source_rgb(0.0, 0.0, 0.0);
poContext->paint();
poContext->set_source(poPattern);
poContext->paint();
return true;
}
#endif
void ScreenAreaCairo::vDrawBlackScreen() void ScreenAreaCairo::vDrawBlackScreen()
{ {
if (m_puiPixels && is_realized()) if (m_puiPixels && get_realized())
{ {
memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32)); memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32));
queue_draw_area(0, 0, get_width(), get_height()); queue_draw_area(0, 0, get_width(), get_height());

View File

@ -33,7 +33,11 @@ public:
void vDrawBlackScreen(); void vDrawBlackScreen();
protected: protected:
#if !GTK_CHECK_VERSION(3, 0, 0)
bool on_expose_event(GdkEventExpose * _pstEvent); bool on_expose_event(GdkEventExpose * _pstEvent);
#else
bool on_draw(const Cairo::RefPtr<Cairo::Context> &poContext);
#endif
void vOnWidgetResize(); void vOnWidgetResize();
private: private:

View File

@ -109,7 +109,7 @@ void ScreenAreaGl::vDrawPixels(u8 * _puiData)
void ScreenAreaGl::vDrawBlackScreen() void ScreenAreaGl::vDrawBlackScreen()
{ {
if (m_puiPixels && is_realized()) if (m_puiPixels && get_realized())
{ {
memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32)); memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32));
queue_draw_area(0, 0, get_width(), get_height()); queue_draw_area(0, 0, get_width(), get_height());
@ -177,7 +177,7 @@ bool ScreenAreaGl::on_expose_event(GdkEventExpose * _pstEvent)
void ScreenAreaGl::vOnSizeUpdated() void ScreenAreaGl::vOnSizeUpdated()
{ {
if (!is_realized()) if (!get_realized())
return; return;
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window(); Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();

View File

@ -19,6 +19,7 @@
#include "screenarea.h" #include "screenarea.h"
#include <cstring> #include <cstring>
#include <glibmm/main.h>
namespace VBA namespace VBA
{ {
@ -45,16 +46,14 @@ ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
| Gdk::ENTER_NOTIFY_MASK | Gdk::ENTER_NOTIFY_MASK
| Gdk::LEAVE_NOTIFY_MASK); | Gdk::LEAVE_NOTIFY_MASK);
char aiEmptyData[8]; Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, 8, 8);
memset(aiEmptyData, 0, sizeof(aiEmptyData)); pixbuf->fill(0);
Glib::RefPtr<Gdk::Bitmap> poSource = Gdk::Bitmap::create(aiEmptyData, 8, 8);
Glib::RefPtr<Gdk::Bitmap> poMask = Gdk::Bitmap::create(aiEmptyData, 8, 8);
Gdk::Color oFg;
Gdk::Color oBg;
oFg.set_rgb(0, 0, 0);
oBg.set_rgb(0, 0, 0);
m_poEmptyCursor = new Gdk::Cursor(poSource, poMask, oFg, oBg, 0, 0); #if !GTK_CHECK_VERSION(3, 0, 0)
m_poEmptyCursor = new Gdk::Cursor(get_display, pixbuf, 0, 0);
#else
m_poEmptyCursor = Gdk::Cursor::create(get_display(), pixbuf, 0, 0);
#endif
} }
ScreenArea::~ScreenArea() ScreenArea::~ScreenArea()
@ -69,10 +68,14 @@ ScreenArea::~ScreenArea()
delete[] m_puiDelta; delete[] m_puiDelta;
} }
#if !GTK_CHECK_VERSION(3, 0, 0)
if (m_poEmptyCursor != NULL) if (m_poEmptyCursor != NULL)
{ {
delete m_poEmptyCursor; delete m_poEmptyCursor;
} }
#else
m_poEmptyCursor.reset();
#endif
} }
void ScreenArea::vSetSize(int _iWidth, int _iHeight) void ScreenArea::vSetSize(int _iWidth, int _iHeight)
@ -133,7 +136,11 @@ void ScreenArea::vStopCursorTimeout()
void ScreenArea::vHideCursor() void ScreenArea::vHideCursor()
{ {
#if !GTK_CHECK_VERSION(3, 0, 0)
get_window()->set_cursor(*m_poEmptyCursor); get_window()->set_cursor(*m_poEmptyCursor);
#else
get_window()->set_cursor(m_poEmptyCursor);
#endif
m_bShowCursor = false; m_bShowCursor = false;
} }

View File

@ -65,7 +65,12 @@ protected:
bool m_bEnableRender; bool m_bEnableRender;
bool m_bShowCursor; bool m_bShowCursor;
#if !GTK_CHECK_VERSION(3, 0, 0)
Gdk::Cursor * m_poEmptyCursor; Gdk::Cursor * m_poEmptyCursor;
#else
Glib::RefPtr<Gdk::Cursor> m_poEmptyCursor;
#endif
sigc::connection m_oCursorSig; sigc::connection m_oCursorSig;
void vUpdateSize(); void vUpdateSize();

View File

@ -106,6 +106,7 @@ void systemUpdateMotionSensor()
u8 systemGetSensorDarkness() u8 systemGetSensorDarkness()
{ {
return 0xE8;
} }
int systemGetSensorX() int systemGetSensorX()

View File

@ -47,7 +47,6 @@
<property name="border_width">5</property> <property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1"> <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -31,7 +31,6 @@
<property name="title" translatable="yes">GameBoy settings</property> <property name="title" translatable="yes">GameBoy settings</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1"> <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -44,7 +44,6 @@
<property name="title" translatable="yes">Game Boy Advance settings</property> <property name="title" translatable="yes">Game Boy Advance settings</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1"> <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="border_width">5</property> <property name="border_width">5</property>
<property name="title" translatable="yes">Preferences</property> <property name="title" translatable="yes">Preferences</property>
<property name="type_hint">normal</property> <property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1"> <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -46,7 +46,6 @@
<property name="border_width">5</property> <property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1"> <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -22,6 +22,9 @@
#include <gtkmm/alignment.h> #include <gtkmm/alignment.h>
#include <gtkmm/messagedialog.h> #include <gtkmm/messagedialog.h>
#include <glibmm/keyfile.h> #include <glibmm/keyfile.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include <glibmm/main.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -42,7 +45,7 @@
#include "intl.h" #include "intl.h"
#include "screenarea-cairo.h" #include "screenarea-cairo.h"
#ifdef USE_OPENGL #if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
#include "screenarea-opengl.h" #include "screenarea-opengl.h"
#endif // USE_OPENGL #endif // USE_OPENGL
@ -135,6 +138,7 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml
{ {
vLoadConfig(m_sConfigFile); vLoadConfig(m_sConfigFile);
vCheckConfig(); vCheckConfig();
LoadConfig();
} }
else else
{ {
@ -245,8 +249,13 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml
// //
m_poRecentManager = Gtk::RecentManager::get_default(); m_poRecentManager = Gtk::RecentManager::get_default();
#if !GTK_CHECK_VERSION(3, 0, 0)
Gtk::RecentFilter oRecentFilter; Gtk::RecentFilter oRecentFilter;
oRecentFilter.add_application( Glib::get_application_name() ); oRecentFilter.add_application( Glib::get_application_name() );
#else
Glib::RefPtr<Gtk::RecentFilter> oRecentFilter = Gtk::RecentFilter::create();
oRecentFilter->add_application( Glib::get_application_name() );
#endif
m_poRecentChooserMenu = Gtk::manage( new Gtk::RecentChooserMenu(m_poRecentManager) ); m_poRecentChooserMenu = Gtk::manage( new Gtk::RecentChooserMenu(m_poRecentManager) );
m_poRecentChooserMenu->set_show_numbers(); m_poRecentChooserMenu->set_show_numbers();
@ -413,7 +422,7 @@ void Window::vApplyConfigScreenArea()
{ {
switch (eVideoOutput) switch (eVideoOutput)
{ {
#ifdef USE_OPENGL #if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
case OutputOpenGL: case OutputOpenGL:
vInitColors(ColorFormatBGR); vInitColors(ColorFormatBGR);
m_poScreenArea = Gtk::manage(new ScreenAreaGl(m_iScreenWidth, m_iScreenHeight)); m_poScreenArea = Gtk::manage(new ScreenAreaGl(m_iScreenWidth, m_iScreenHeight));
@ -465,28 +474,20 @@ void Window::vInitSDL()
if (bDone) if (bDone)
return; return;
int iFlags = (SDL_INIT_EVERYTHING | SDL_INIT_NOPARACHUTE); inputSetKeymap(PAD_DEFAULT, KEY_LEFT, GDK_KEY_Left);
inputSetKeymap(PAD_DEFAULT, KEY_RIGHT, GDK_KEY_Right);
if (SDL_Init(iFlags) < 0) inputSetKeymap(PAD_DEFAULT, KEY_UP, GDK_KEY_Up);
{ inputSetKeymap(PAD_DEFAULT, KEY_DOWN, GDK_KEY_Down);
fprintf(stderr, _("Failed to init SDL: %s"), SDL_GetError()); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_A, GDK_KEY_z);
abort(); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_B, GDK_KEY_x);
} inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_START, GDK_KEY_Return);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_SELECT, GDK_KEY_BackSpace);
inputSetKeymap(PAD_DEFAULT, KEY_LEFT, GDK_Left); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_L, GDK_KEY_a);
inputSetKeymap(PAD_DEFAULT, KEY_RIGHT, GDK_Right); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_R, GDK_KEY_s);
inputSetKeymap(PAD_DEFAULT, KEY_UP, GDK_Up); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_SPEED, GDK_KEY_space);
inputSetKeymap(PAD_DEFAULT, KEY_DOWN, GDK_Down); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_CAPTURE, GDK_KEY_F12);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_A, GDK_z); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_AUTO_A, GDK_KEY_q);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_B, GDK_x); inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_AUTO_B, GDK_KEY_w);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_START, GDK_Return);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_SELECT, GDK_BackSpace);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_L, GDK_a);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_R, GDK_s);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_SPEED, GDK_space);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_CAPTURE, GDK_F12);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_AUTO_A, GDK_q);
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_AUTO_B, GDK_w);
// TODO : remove // TODO : remove
int sdlNumDevices = SDL_NumJoysticks(); int sdlNumDevices = SDL_NumJoysticks();
@ -541,7 +542,7 @@ void Window::vInitConfig()
m_poDisplayConfig->vSetKey("scale", 1 ); m_poDisplayConfig->vSetKey("scale", 1 );
m_poDisplayConfig->vSetKey("filter2x", FilterNone ); m_poDisplayConfig->vSetKey("filter2x", FilterNone );
m_poDisplayConfig->vSetKey("filterIB", FilterIBNone ); m_poDisplayConfig->vSetKey("filterIB", FilterIBNone );
#ifdef USE_OPENGL #if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
m_poDisplayConfig->vSetKey("output", OutputOpenGL ); m_poDisplayConfig->vSetKey("output", OutputOpenGL );
#else #else
m_poDisplayConfig->vSetKey("output", OutputCairo ); m_poDisplayConfig->vSetKey("output", OutputCairo );
@ -1339,6 +1340,7 @@ void Window::vCreateFileOpenDialog()
"*.7[zZ]", "*.7[zZ]",
}; };
#if !GTK_CHECK_VERSION(3, 0, 0)
Gtk::FileFilter oAllGBAFilter; Gtk::FileFilter oAllGBAFilter;
oAllGBAFilter.set_name(_("All Gameboy Advance files")); oAllGBAFilter.set_name(_("All Gameboy Advance files"));
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
@ -1359,6 +1361,28 @@ void Window::vCreateFileOpenDialog()
{ {
oGBFilter.add_pattern(acsPattern[i]); oGBFilter.add_pattern(acsPattern[i]);
} }
#else
const Glib::RefPtr<Gtk::FileFilter> oAllGBAFilter = Gtk::FileFilter::create();
oAllGBAFilter->set_name(_("All Gameboy Advance files"));
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
{
oAllGBAFilter->add_pattern(acsPattern[i]);
}
const Glib::RefPtr<Gtk::FileFilter> oGBAFilter = Gtk::FileFilter::create();
oGBAFilter->set_name(_("Gameboy Advance files"));
for (int i = 0; i < 3; i++)
{
oGBAFilter->add_pattern(acsPattern[i]);
}
const Glib::RefPtr<Gtk::FileFilter> oGBFilter = Gtk::FileFilter::create();
oGBFilter->set_name(_("Gameboy files"));
for (int i = 3; i < 7; i++)
{
oGBFilter->add_pattern(acsPattern[i]);
}
#endif
poDialog->add_filter(oAllGBAFilter); poDialog->add_filter(oAllGBAFilter);
poDialog->add_filter(oGBAFilter); poDialog->add_filter(oGBAFilter);
@ -1578,6 +1602,7 @@ std::string Window::sGetUiFilePath(const std::string &_sFileName)
{ {
// Use the ui file from the source folder if it exists // Use the ui file from the source folder if it exists
// to make gvbam runnable without installation // to make gvbam runnable without installation
//std::string sUiFile = SOURCEDIR "/src/gtk/ui/" + _sFileName;
std::string sUiFile = "src/gtk/ui/" + _sFileName; std::string sUiFile = "src/gtk/ui/" + _sFileName;
if (!Glib::file_test(sUiFile, Glib::FILE_TEST_EXISTS)) if (!Glib::file_test(sUiFile, Glib::FILE_TEST_EXISTS))
{ {

View File

@ -18,6 +18,11 @@
#include "window.h" #include "window.h"
#include <glibmm/convert.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include <glibmm/main.h>
#include <deque> #include <deque>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
@ -98,9 +103,15 @@ void Window::vOnFileLoad()
oDialog.add_shortcut_folder(sSaveDir); oDialog.add_shortcut_folder(sSaveDir);
} }
#if !GTK_CHECK_VERSION(3, 0, 0)
Gtk::FileFilter oSaveFilter; Gtk::FileFilter oSaveFilter;
oSaveFilter.set_name(_("VisualBoyAdvance save game")); oSaveFilter.set_name(_("VisualBoyAdvance save game"));
oSaveFilter.add_pattern("*.[sS][gG][mM]"); oSaveFilter.add_pattern("*.[sS][gG][mM]");
#else
const Glib::RefPtr<Gtk::FileFilter> oSaveFilter = Gtk::FileFilter::create();
oSaveFilter->set_name(_("VisualBoyAdvance save game"));
oSaveFilter->add_pattern("*.[sS][gG][mM]");
#endif
oDialog.add_filter(oSaveFilter); oDialog.add_filter(oSaveFilter);
@ -133,9 +144,15 @@ void Window::vOnFileSave()
} }
oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile))); oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile)));
#if !GTK_CHECK_VERSION(3, 0, 0)
Gtk::FileFilter oSaveFilter; Gtk::FileFilter oSaveFilter;
oSaveFilter.set_name(_("VisualBoyAdvance save game")); oSaveFilter.set_name(_("VisualBoyAdvance save game"));
oSaveFilter.add_pattern("*.[sS][gG][mM]"); oSaveFilter.add_pattern("*.[sS][gG][mM]");
#else
const Glib::RefPtr<Gtk::FileFilter> oSaveFilter = Gtk::FileFilter::create();
oSaveFilter->set_name(_("VisualBoyAdvance save game"));
oSaveFilter->add_pattern("*.[sS][gG][mM]");
#endif
oDialog.add_filter(oSaveFilter); oDialog.add_filter(oSaveFilter);
@ -293,9 +310,15 @@ void Window::vOnFileScreenCapture()
} }
oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile))); oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile)));
#if !GTK_CHECK_VERSION(3, 0, 0)
Gtk::FileFilter oPngFilter; Gtk::FileFilter oPngFilter;
oPngFilter.set_name(_("PNG image")); oPngFilter.set_name(_("PNG image"));
oPngFilter.add_pattern("*.[pP][nN][gG]"); oPngFilter.add_pattern("*.[pP][nN][gG]");
#else
const Glib::RefPtr<Gtk::FileFilter> oPngFilter = Gtk::FileFilter::create();
oPngFilter->set_name(_("PNG image"));
oPngFilter->add_pattern("*.[pP][nN][gG]");
#endif
oDialog.add_filter(oPngFilter); oDialog.add_filter(oPngFilter);
@ -523,7 +546,7 @@ void Window::vOnHelpAbout()
oAboutDialog.set_website("http://www.vba-m.com/"); oAboutDialog.set_website("http://www.vba-m.com/");
std::list<Glib::ustring> list_authors; std::vector<Glib::ustring> list_authors;
list_authors.push_back("Forgotten"); list_authors.push_back("Forgotten");
list_authors.push_back("kxu"); list_authors.push_back("kxu");
list_authors.push_back("Pokemonhacker"); list_authors.push_back("Pokemonhacker");
@ -534,7 +557,7 @@ void Window::vOnHelpAbout()
list_authors.push_back("bgK"); list_authors.push_back("bgK");
oAboutDialog.set_authors(list_authors); oAboutDialog.set_authors(list_authors);
std::list<Glib::ustring> list_artists; std::vector<Glib::ustring> list_artists;
list_artists.push_back("Matteo Drera"); list_artists.push_back("Matteo Drera");
list_artists.push_back("Jakub Steiner"); list_artists.push_back("Jakub Steiner");
list_artists.push_back("Jones Lee"); list_artists.push_back("Jones Lee");
@ -581,7 +604,7 @@ bool Window::bOnEmuSaveStateRewind() {
if (m_stEmulator.emuWriteMemState(m_psavestate, SZSTATE, resize)) { if (m_stEmulator.emuWriteMemState(m_psavestate, SZSTATE, resize)) {
/*resize*=2; // if tell does not return correct size this leverage factor is needed /*resize*=2; // if tell does not return correct size this leverage factor is needed
if (resize > SZSTATE) resize = SZSTATE;*/ if (resize > SZSTATE) resize = SZSTATE;*/
g_assert( resize <= SZSTATE ); g_assert( resize <= (int) SZSTATE );
resize+=(sizeof(resize)*8); // some leverage resize+=(sizeof(resize)*8); // some leverage
psavestate = new char[resize]; psavestate = new char[resize];
memmove(psavestate, &resize, sizeof(resize)); // pack size first memmove(psavestate, &resize, sizeof(resize)); // pack size first
@ -627,14 +650,14 @@ bool Window::on_focus_out_event(GdkEventFocus * _pstEvent)
bool Window::on_key_press_event(GdkEventKey * _pstEvent) bool Window::on_key_press_event(GdkEventKey * _pstEvent)
{ {
// The menu accelerators are disabled when it is hidden // The menu accelerators are disabled when it is hidden
if (_pstEvent->keyval == GDK_F11 && !m_poMenuBar->is_visible()) if (_pstEvent->keyval == GDK_KEY_F11 && !m_poMenuBar->is_visible())
{ {
vToggleFullscreen(); vToggleFullscreen();
return true; return true;
} }
// Rewind key CTRL+B // Rewind key CTRL+B
if (m_state_count_max > 0u && (_pstEvent->state & GDK_CONTROL_MASK) && _pstEvent->keyval == GDK_b) { if (m_state_count_max > 0u && (_pstEvent->state & GDK_CONTROL_MASK) && _pstEvent->keyval == GDK_KEY_b) {
// disable saves first and then connect new handler // disable saves first and then connect new handler
if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect(); if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect();
m_state_count_max = 0u; m_state_count_max = 0u;
@ -647,7 +670,11 @@ bool Window::on_key_press_event(GdkEventKey * _pstEvent)
// Forward the keyboard event to the input module by faking a SDL event // Forward the keyboard event to the input module by faking a SDL event
SDL_Event event; SDL_Event event;
event.type = SDL_KEYDOWN; event.type = SDL_KEYDOWN;
event.key.keysym.sym = (SDLKey)_pstEvent->keyval; //event.key.timestamp = SDL_GetTicks();
//event.key.windowID = 0;
//event.key.repeat = 0;
//event.key.keysym.sym = (SDLKey)_pstEvent->keyval;
event.key.keysym.sym = (SDL_Keycode)_pstEvent->keyval;
inputProcessSDLEvent(event); inputProcessSDLEvent(event);
return Gtk::Window::on_key_press_event(_pstEvent); return Gtk::Window::on_key_press_event(_pstEvent);
@ -656,7 +683,7 @@ bool Window::on_key_press_event(GdkEventKey * _pstEvent)
bool Window::on_key_release_event(GdkEventKey * _pstEvent) bool Window::on_key_release_event(GdkEventKey * _pstEvent)
{ {
// Rewind key CTRL+B // Rewind key CTRL+B
if (_pstEvent->keyval == GDK_b /*&& !(_pstEvent->state & GDK_CONTROL_MASK)*/) { if (_pstEvent->keyval == GDK_KEY_b /*&& !(_pstEvent->state & GDK_CONTROL_MASK)*/) {
// connect save handler back // connect save handler back
if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect(); if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect();
m_state_count_max = m_poCoreConfig->oGetKey<unsigned short>("rewind_count_max"); m_state_count_max = m_poCoreConfig->oGetKey<unsigned short>("rewind_count_max");
@ -667,7 +694,11 @@ bool Window::on_key_release_event(GdkEventKey * _pstEvent)
// Forward the keyboard event to the input module by faking a SDL event // Forward the keyboard event to the input module by faking a SDL event
SDL_Event event; SDL_Event event;
event.type = SDL_KEYUP; event.type = SDL_KEYUP;
event.key.keysym.sym = (SDLKey)_pstEvent->keyval; //event.key.timestamp = SDL_GetTicks();
//event.key.windowID = 0;
//event.key.repeat = 0;
//event.key.keysym.sym = (SDLKey)_pstEvent->keyval;
event.key.keysym.sym = (SDL_Keycode)_pstEvent->keyval;
inputProcessSDLEvent(event); inputProcessSDLEvent(event);

View File

@ -271,9 +271,9 @@ void StopLirc(void)
#define S_IFDIR _S_IFDIR #define S_IFDIR _S_IFDIR
#endif #endif
void sdlCheckDirectory(char *dir) void sdlCheckDirectory(const char *dir)
{ {
if (!dir) if (!dir || !dir[0])
{ {
return; return;
} }
@ -282,7 +282,7 @@ void sdlCheckDirectory(char *dir)
int len = strlen(dir); int len = strlen(dir);
char *p = dir + len - 1; char *p = (char *)dir + len - 1;
if(*p == '/' || if(*p == '/' ||
*p == '\\') *p == '\\')

View File

@ -185,8 +185,4 @@ if(APPLE)
SET_SOURCE_FILES_PROPERTIES(${VBAM_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) SET_SOURCE_FILES_PROPERTIES(${VBAM_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif(APPLE) endif(APPLE)
IF(WIN32 OR APPLE) SET(WX_EXE_NAME visualboyadvance-m-wx${CMAKE_EXECUTABLE_SUFFIX})
SET(WX_EXE_NAME visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX})
ELSE()
SET(WX_EXE_NAME vbam${CMAKE_EXECUTABLE_SUFFIX})
ENDIF()

View File

@ -4,7 +4,7 @@ Type=Application
Name=VBA-M Name=VBA-M
GenericName=Game Boy Advance Emulator GenericName=Game Boy Advance Emulator
Comment=Nintendo Game Boy Advance Emulator Comment=Nintendo Game Boy Advance Emulator
Exec=visualboyadvance-m %f Exec=visualboyadvance-m-wx %f
Icon=vbam Icon=vbam
Categories=Game;Emulator; Categories=Game;Emulator;
Keywords=emulator;Nintendo;gameboy;Game Boy;Game Boy Color;Game Boy Advance; Keywords=emulator;Nintendo;gameboy;Game Boy;Game Boy Color;Game Boy Advance;