Finish committing the remaining gtk3 patch (wip)
This commit is contained in:
parent
c8343267fc
commit
7ed85a8c6f
|
@ -46,6 +46,7 @@ extern "C" {
|
|||
#include <getopt.h>
|
||||
#endif // ! __GNUC__
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
enum named_opts
|
||||
{
|
||||
|
@ -120,22 +121,22 @@ bool mirroringEnable = true;
|
|||
bool parseDebug = true;
|
||||
bool speedHack = false;
|
||||
bool speedup = false;
|
||||
char* aviRecordDir;
|
||||
char* batteryDir;
|
||||
char* biosFileNameGB;
|
||||
char* biosFileNameGBA;
|
||||
char* biosFileNameGBC;
|
||||
char* loadDotCodeFile;
|
||||
char* saveDotCodeFile;
|
||||
char* linkHostAddr;
|
||||
char* movieRecordDir;
|
||||
const char* aviRecordDir;
|
||||
const char* batteryDir;
|
||||
const char* biosFileNameGB;
|
||||
const char* biosFileNameGBA;
|
||||
const char* biosFileNameGBC;
|
||||
const char* loadDotCodeFile;
|
||||
const char* saveDotCodeFile;
|
||||
const char* linkHostAddr;
|
||||
const char* movieRecordDir;
|
||||
char* rewindMemory = NULL;
|
||||
char* romDirGB;
|
||||
char* romDirGBA;
|
||||
char* romDirGBC;
|
||||
char* saveDir;
|
||||
char* screenShotDir;
|
||||
char* soundRecordDir;
|
||||
const char* romDirGB;
|
||||
const char* romDirGBA;
|
||||
const char* romDirGBC;
|
||||
const char* saveDir;
|
||||
const char* screenShotDir;
|
||||
const char* soundRecordDir;
|
||||
int active = 1;
|
||||
int agbPrint;
|
||||
int autoFire;
|
||||
|
@ -387,7 +388,7 @@ struct option argOptions[] = {
|
|||
};
|
||||
|
||||
|
||||
u32 fromHex(char *s)
|
||||
u32 fromHex(const char *s)
|
||||
{
|
||||
if (!s)
|
||||
return 0;
|
||||
|
@ -396,7 +397,7 @@ u32 fromHex(char *s)
|
|||
return value;
|
||||
}
|
||||
|
||||
u32 fromDec(char *s)
|
||||
u32 fromDec(const char *s)
|
||||
{
|
||||
if (!s)
|
||||
return 0;
|
||||
|
@ -554,7 +555,7 @@ void LoadConfig()
|
|||
volume_percent = 1.0;
|
||||
soundSetVolume(volume_percent);
|
||||
|
||||
soundSetEnable((ReadPrefHex("soundEnable")) & 0x30f);
|
||||
soundSetEnable((ReadPrefHex("soundEnable", 0x30f)) & 0x30f);
|
||||
if ((ReadPrefHex("soundStereo"))) {
|
||||
gb_effects_config.enabled = true;
|
||||
}
|
||||
|
@ -613,7 +614,7 @@ void CloseConfig()
|
|||
iniparser_freedict(preferences);
|
||||
}
|
||||
|
||||
char* FindConfigFile(char *name)
|
||||
const char* FindConfigFile(const char *name)
|
||||
{
|
||||
char buffer[4096];
|
||||
|
||||
|
@ -721,13 +722,13 @@ void LoadConfigFile()
|
|||
|
||||
if (preferences == NULL)
|
||||
{
|
||||
char* configFile = FindConfigFile("vbam.ini");
|
||||
const char* configFile = FindConfigFile("vbam.ini");
|
||||
OpenPreferences(configFile);
|
||||
}
|
||||
|
||||
if (preferences == NULL)
|
||||
{
|
||||
char* configFile = FindConfigFile("vbam.cfg");
|
||||
const char* configFile = FindConfigFile("vbam.cfg");
|
||||
OpenPreferences(configFile);
|
||||
}
|
||||
}
|
||||
|
@ -747,7 +748,7 @@ void SaveConfigFile()
|
|||
homeDir = 0;
|
||||
#endif
|
||||
|
||||
char* configFile = FindConfigFile("vbam.ini");
|
||||
const char* configFile = FindConfigFile("vbam.ini");
|
||||
|
||||
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();
|
||||
std::string pref = "preferences:";
|
||||
|
@ -780,7 +794,7 @@ u32 ReadPrefHex(char* pref_key)
|
|||
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();
|
||||
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);
|
||||
}
|
||||
|
||||
u32 ReadPref(char* pref_key)
|
||||
u32 ReadPref(const char* pref_key)
|
||||
{
|
||||
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();
|
||||
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);
|
||||
}
|
||||
|
||||
char* ReadPrefString(char* pref_key)
|
||||
const char* ReadPrefString(const char* pref_key)
|
||||
{
|
||||
return ReadPrefString(pref_key, "");
|
||||
}
|
||||
|
@ -845,7 +859,7 @@ int ReadOpts(int argc, char ** argv)
|
|||
log("Missing BIOS file name\n");
|
||||
break;
|
||||
}
|
||||
strcpy(biosFileNameGBA, optarg);
|
||||
biosFileNameGBA = strdup(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
{
|
||||
|
|
|
@ -22,18 +22,18 @@ extern bool parseDebug;
|
|||
extern bool speedHack;
|
||||
extern bool speedup;
|
||||
extern char* rewindMemory;
|
||||
extern char* aviRecordDir;
|
||||
extern char* biosFileNameGB;
|
||||
extern char* biosFileNameGBA;
|
||||
extern char* biosFileNameGBC;
|
||||
extern char* loadDotCodeFile;
|
||||
extern char* saveDotCodeFile;
|
||||
extern char* linkHostAddr;
|
||||
extern char* movieRecordDir;
|
||||
extern char* romDirGB;
|
||||
extern char* romDirGBA;
|
||||
extern char* romDirGBC;
|
||||
extern char* soundRecordDir;
|
||||
extern const char* aviRecordDir;
|
||||
extern const char* biosFileNameGB;
|
||||
extern const char* biosFileNameGBA;
|
||||
extern const char* biosFileNameGBC;
|
||||
extern const char* loadDotCodeFile;
|
||||
extern const char* saveDotCodeFile;
|
||||
extern const char* linkHostAddr;
|
||||
extern const char* movieRecordDir;
|
||||
extern const char* romDirGB;
|
||||
extern const char* romDirGBA;
|
||||
extern const char* romDirGBC;
|
||||
extern const char* soundRecordDir;
|
||||
extern int* rewindSerials;
|
||||
extern int active;
|
||||
extern int agbPrint;
|
||||
|
@ -155,9 +155,9 @@ extern IFBFilterFunc ifbFunction;
|
|||
|
||||
|
||||
extern char* homeDir;
|
||||
extern char* screenShotDir;
|
||||
extern char* saveDir;
|
||||
extern char* batteryDir;
|
||||
extern const char* screenShotDir;
|
||||
extern const char* saveDir;
|
||||
extern const char* batteryDir;
|
||||
|
||||
// Directory within homedir to use for default save location.
|
||||
#define DOT_DIR ".vbam"
|
||||
|
@ -165,11 +165,12 @@ extern char* batteryDir;
|
|||
void SetHome(char *_arg0);
|
||||
void SaveConfigFile();
|
||||
void CloseConfig();
|
||||
u32 ReadPrefHex(char* pref_key);
|
||||
u32 ReadPref(char* pref_key, int default_value);
|
||||
u32 ReadPref(char* pref_key);
|
||||
char* ReadPrefString(char* pref_key, char* default_value);
|
||||
char* ReadPrefString(char* pref_key);
|
||||
u32 ReadPrefHex(const char* pref_key, int default_value);
|
||||
u32 ReadPrefHex(const char* pref_key);
|
||||
u32 ReadPref(const char* pref_key, int default_value);
|
||||
u32 ReadPref(const 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 LoadConfig();
|
||||
int ReadOpts(int argc, char ** argv);
|
||||
|
|
|
@ -172,7 +172,7 @@ void dictionary_del(dictionary * d)
|
|||
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 ;
|
||||
int i ;
|
||||
|
|
|
@ -103,7 +103,7 @@ void dictionary_del(dictionary * vd);
|
|||
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);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
|
|
@ -215,11 +215,19 @@ void iniparser_dump_ini(dictionary * d, FILE * f)
|
|||
nsec = iniparser_getnsec(d);
|
||||
if (nsec<1) {
|
||||
/* No section in file: dump all keys as they are */
|
||||
fprintf(f, "[preferences]\n");
|
||||
for (i=0 ; i<d->size ; i++) {
|
||||
if (d->key[i]==NULL)
|
||||
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 ;
|
||||
}
|
||||
for (i=0 ; i<nsec ; i++) {
|
||||
|
@ -365,10 +373,10 @@ char ** iniparser_getseckeys(dictionary * d, char * s)
|
|||
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 * sval ;
|
||||
const char * sval ;
|
||||
|
||||
if (d==NULL || key==NULL)
|
||||
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)
|
||||
{
|
||||
char * str ;
|
||||
const char *str;
|
||||
|
||||
str = iniparser_getstring(d, key, INI_INVALID_KEY);
|
||||
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)
|
||||
{
|
||||
char * str ;
|
||||
const char *str;
|
||||
|
||||
str = iniparser_getstring(d, key, INI_INVALID_KEY);
|
||||
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)
|
||||
{
|
||||
char * c ;
|
||||
const char * c;
|
||||
int ret ;
|
||||
|
||||
c = iniparser_getstring(d, key, INI_INVALID_KEY);
|
||||
|
@ -699,7 +707,10 @@ dictionary * iniparser_load(const char * ininame)
|
|||
break ;
|
||||
|
||||
case LINE_VALUE:
|
||||
if (strlen(section))
|
||||
sprintf(tmp, "%s:%s", section, key);
|
||||
else
|
||||
sprintf(tmp, "preferences:%s", key);
|
||||
errs = dictionary_set(dict, tmp, val) ;
|
||||
break ;
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ char ** iniparser_getseckeys(dictionary * d, char * s);
|
|||
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);
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
|
|
@ -86,23 +86,23 @@ int debuggerRadix = 0;
|
|||
#define NUMBEROFDB 1000
|
||||
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",
|
||||
"exe", "execute", "exec", "execute",
|
||||
NULL, NULL };
|
||||
|
||||
struct DebuggerCommand {
|
||||
char *name;
|
||||
const char *name;
|
||||
void(*function)(int, char **);
|
||||
char *help;
|
||||
char *syntax;
|
||||
const char *help;
|
||||
const char *syntax;
|
||||
};
|
||||
|
||||
char monbuf[1000];
|
||||
void monprintf(std::string line);
|
||||
std::string StringToHex(std::string &cmd);
|
||||
std::string HexToString(char * p);
|
||||
void debuggerUsage(char *cmd);
|
||||
void debuggerUsage(const char *cmd);
|
||||
void debuggerHelp(int n, char **args);
|
||||
void printFlagHelp();
|
||||
void dbgExecute(std::string &cmd);
|
||||
|
@ -230,7 +230,7 @@ void addBreakRegToList(u8 regnum, u8 flags, u32 value){
|
|||
}
|
||||
|
||||
void printBreakRegList(bool verbose){
|
||||
char* flagsToOP[] = { "never", "==", ">", ">=", "<", "<=", "!=", "always" };
|
||||
const char* flagsToOP[] = { "never", "==", ">", ">=", "<", "<=", "!=", "always" };
|
||||
bool anyPrint = false;
|
||||
for (int i = 0; i<4; i++){
|
||||
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); }
|
||||
return;
|
||||
}
|
||||
for (u32 i = 2; i < n; i++){
|
||||
for (int i = 2; i < n; i++){
|
||||
if (!dexp_eval(args[i], &value)) {
|
||||
{ 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); }
|
||||
return;
|
||||
}
|
||||
for (u32 i = 2; i < n; i++){
|
||||
for (int i = 2; i < n; i++){
|
||||
if (!dexp_eval(args[i], &value)) {
|
||||
{ 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); }
|
||||
return;
|
||||
}
|
||||
for (u32 i = 2; i < n; i++){
|
||||
for (int i = 2; i < n; i++){
|
||||
if (!dexp_eval(args[i], &value)) {
|
||||
{ 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){
|
||||
char* typeName;
|
||||
const char* typeName;
|
||||
switch (type){
|
||||
case 1:
|
||||
typeName = "equal to";
|
||||
|
@ -1401,7 +1401,7 @@ void debuggerSymbols(int argc, char **argv)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
char *ts = "?";
|
||||
const char *ts = "?";
|
||||
switch (type) {
|
||||
case 2:
|
||||
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
|
||||
//into two or more words. Such words are separated by space, so a new tokenizer can
|
||||
//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){
|
||||
if (strcmp(lower_cmd, aliasTable[i]) == 0){
|
||||
return aliasTable[i + 1];
|
||||
|
@ -1665,7 +1665,7 @@ char* replaceAlias(char* lower_cmd, char** aliasTable){
|
|||
return lower_cmd;
|
||||
}
|
||||
|
||||
char* breakAliasTable[] = {
|
||||
const char* breakAliasTable[] = {
|
||||
|
||||
//actual beginning
|
||||
"break", "b 0 0",
|
||||
|
@ -1813,13 +1813,13 @@ char* breakSymbolCombo(char * command, int* length){
|
|||
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{
|
||||
int value;
|
||||
char mapping[20];
|
||||
const char mapping[20];
|
||||
};
|
||||
|
||||
struct intToString breakFlagMapping[] = {
|
||||
|
@ -1837,9 +1837,9 @@ struct intToString breakFlagMapping[] = {
|
|||
//printers
|
||||
void printCondition(struct ConditionalBreakNode* toPrint){
|
||||
if (toPrint){
|
||||
char* firstType = typeMapping[toPrint->exp_type_flags & 0x7];
|
||||
char* secondType = typeMapping[(toPrint->exp_type_flags >> 4) & 0x7];
|
||||
char* operand = compareFlagMapping[toPrint->cond_flags & 0x7];
|
||||
const char* firstType = typeMapping[toPrint->exp_type_flags & 0x7];
|
||||
const char* secondType = typeMapping[(toPrint->exp_type_flags >> 4) & 0x7];
|
||||
const char* operand = compareFlagMapping[toPrint->cond_flags & 0x7];
|
||||
{ sprintf(monbuf, "%s %s %s%s %s %s", firstType, toPrint->address,
|
||||
((toPrint->cond_flags & 8) ? "s" : ""), operand,
|
||||
secondType, toPrint->value);
|
||||
|
@ -2036,8 +2036,8 @@ void deleteBreak(u32 address, u8 flags, char** expression, int howToDelete){
|
|||
bool applyOr = true;
|
||||
if (howToDelete > 0){
|
||||
if (((expression[0][0] == '&') && !expression[0][1]) ||
|
||||
(tolower(expression[0][0]) == 'o') && (tolower(expression[0][1]) == 'n') &&
|
||||
(tolower(expression[0][0]) == 'l') && (tolower(expression[0][1]) == 'y')){
|
||||
((tolower(expression[0][0]) == 'o') && (tolower(expression[0][1]) == 'n')) ||
|
||||
((tolower(expression[0][0]) == 'l') && (tolower(expression[0][1]) == 'y'))){
|
||||
applyOr = false;
|
||||
howToDelete--;
|
||||
expression++;
|
||||
|
@ -2124,7 +2124,7 @@ void executeBreakCommands(int n, char** cmd){
|
|||
for (int i = 0; cmd[0][i]; 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]){
|
||||
target = '*';
|
||||
}
|
||||
|
@ -2207,9 +2207,9 @@ void executeBreakCommands(int n, char** cmd){
|
|||
}
|
||||
else if (operation == clearBreaks){
|
||||
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][1] == 'r' || cmd[0][1] == 'r'))) {
|
||||
(cmd[0][1] == 'R' || cmd[0][1] == 'r'))) {
|
||||
operation(address, flag, NULL, 2);
|
||||
}
|
||||
else{
|
||||
|
@ -2411,7 +2411,7 @@ void printFlagHelp()
|
|||
monprintf("Special flags: always(all true), never(all false).\n");
|
||||
}
|
||||
|
||||
void debuggerUsage(char *cmd)
|
||||
void debuggerUsage(const char *cmd)
|
||||
{
|
||||
if (!strcmp(cmd, "break")){
|
||||
monprintf("Break command, composed of three parts:\n");
|
||||
|
@ -2650,7 +2650,7 @@ void dbgExecute(char* toRun){
|
|||
// return;
|
||||
//}
|
||||
|
||||
commands[0] = replaceAlias(commands[0], cmdAliasTable);
|
||||
commands[0] = (char*)replaceAlias(commands[0], cmdAliasTable);
|
||||
|
||||
if (commands[0][0] == 'b'){
|
||||
executeBreakCommands(commandCount, commands);
|
||||
|
@ -3563,7 +3563,7 @@ std::string HexToString(char * p)
|
|||
std::string hex(p);
|
||||
std::string cmd;
|
||||
std::stringstream ss;
|
||||
int offset = 0;
|
||||
u32 offset = 0;
|
||||
while (offset < hex.length()) {
|
||||
unsigned int buffer = 0;
|
||||
ss.clear();
|
||||
|
@ -3579,7 +3579,7 @@ std::string StringToHex(std::string &cmd)
|
|||
{
|
||||
std::stringstream ss;
|
||||
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];
|
||||
return ss.str();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,32 @@
|
|||
#Do not use this file directly. Always use the top level CMakeLists.txt file
|
||||
|
||||
SET( CMAKE_CXX_FLAGS -std=gnu++11 )
|
||||
|
||||
#GTK dependencies
|
||||
FIND_PACKAGE ( PkgConfig REQUIRED )
|
||||
FIND_PACKAGE ( Gettext REQUIRED )
|
||||
|
||||
# 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 ( 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
|
||||
#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
|
||||
configfile.cpp
|
||||
|
@ -35,7 +47,7 @@ SET(SRC_GTK
|
|||
soundconfig.cpp
|
||||
screenarea.cpp
|
||||
screenarea-cairo.cpp
|
||||
screenarea-opengl.cpp
|
||||
#screenarea-opengl.cpp
|
||||
tools.cpp
|
||||
window.cpp
|
||||
../sdl/inputSDL.cpp
|
||||
|
@ -47,6 +59,7 @@ INCLUDE_DIRECTORIES(
|
|||
${GTKMM_INCLUDE_DIRS}
|
||||
${GDKMM_INCLUDE_DIRS}
|
||||
${GTKGLMM_INCLUDE_DIRS}
|
||||
${X11_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
LINK_DIRECTORIES(
|
||||
|
@ -61,6 +74,7 @@ ADD_EXECUTABLE (
|
|||
WIN32
|
||||
MACOSX_BUNDLE
|
||||
${SRC_GTK}
|
||||
../common/SoundSDL.cpp
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES (
|
||||
|
@ -68,6 +82,7 @@ TARGET_LINK_LIBRARIES (
|
|||
${VBAMCORE_LIBS}
|
||||
${GTKMM_LIBRARIES}
|
||||
${GTKGLMM_LIBRARIES}
|
||||
${X11_LIBRARIES}
|
||||
)
|
||||
|
||||
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/gvbam DESTINATION bin)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "cheatlist.h"
|
||||
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
|
|
@ -36,7 +36,7 @@ const DirectoriesConfigDialog::SDirEntry DirectoriesConfigDialog::m_astDirs[] =
|
|||
};
|
||||
|
||||
DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) :
|
||||
Gtk::Dialog(_("Directories config"), true, true),
|
||||
Gtk::Dialog(_("Directories config"), true),
|
||||
m_poConfig(_poConfig)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
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]->set_current_folder(m_poConfig->sGetKey(m_astDirs[i].m_csKey));
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "filters.h"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <gtkmm/dialog.h>
|
||||
#include <gtkmm/builder.h>
|
||||
#include <gtkmm/combobox.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
|
||||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
|
|
@ -71,6 +71,7 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
|
|||
"*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]"
|
||||
};
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::FileFilter oAllFilter;
|
||||
oAllFilter.set_name(_("All files"));
|
||||
oAllFilter.add_pattern("*");
|
||||
|
@ -81,6 +82,18 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
|
|||
{
|
||||
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(oBiosFilter);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __VBA_GAMEBOYADVANCECONFIG_H__
|
||||
#define __VBA_GAMEBOYADVANCECONFIG_H__
|
||||
|
||||
#include <gtkmm/checkbutton.h>
|
||||
#include <gtkmm/combobox.h>
|
||||
#include <gtkmm/filechooserbutton.h>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __VBA_GAMEBOYCONFIG_H__
|
||||
#define __VBA_GAMEBOYCONFIG_H__
|
||||
|
||||
#include <gtkmm/checkbutton.h>
|
||||
#include <gtkmm/combobox.h>
|
||||
#include <gtkmm/filechooserbutton.h>
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#ifndef __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 "window.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "joypadconfig.h"
|
||||
|
||||
#include <glibmm/main.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
@ -44,9 +45,9 @@ const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] =
|
|||
};
|
||||
|
||||
JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
|
||||
Gtk::Dialog(_("Joypad config"), true, true),
|
||||
Gtk::Dialog(_("Joypad config"), true),
|
||||
m_oTitleHBox(false, 5),
|
||||
m_oTitleLabel(_("Joypad :"), Gtk::ALIGN_RIGHT),
|
||||
m_oTitleLabel(_("Joypad :"), Gtk::ALIGN_END),
|
||||
m_oDefaultJoypad(_("Default joypad")),
|
||||
m_oTable(G_N_ELEMENTS(m_astKeys), 2, false),
|
||||
m_iCurrentEntry(-1),
|
||||
|
@ -55,10 +56,17 @@ JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
|
|||
m_poConfig(_poConfig)
|
||||
{
|
||||
// Joypad selection
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
m_oTitleCombo.append_text("1");
|
||||
m_oTitleCombo.append_text("2");
|
||||
m_oTitleCombo.append_text("3");
|
||||
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_oTitleCombo);
|
||||
|
@ -66,7 +74,7 @@ JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
|
|||
// Joypad buttons
|
||||
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() );
|
||||
m_oTable.attach(* poLabel, 0, 1, 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
|
||||
SDL_Event event;
|
||||
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);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
#include <gtkmm/main.h>
|
||||
#include <gtkmm/window.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>
|
||||
#endif // USE_OPENGL
|
||||
|
||||
// this will be ifdefed soon
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "window.h"
|
||||
#include "intl.h"
|
||||
|
||||
|
@ -39,12 +43,14 @@ int main(int argc, char * argv[])
|
|||
bindtextdomain("gvbam", LOCALEDIR);
|
||||
textdomain("gvbam");
|
||||
#endif // ENABLE_NLS
|
||||
//will be ifdefed
|
||||
XInitThreads();
|
||||
|
||||
Glib::set_application_name(_("VBA-M"));
|
||||
|
||||
Gtk::Main oKit(argc, argv);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
#if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::GL::init(argc, argv);
|
||||
#endif // USE_OPENGL
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ void ScreenAreaCairo::vDrawPixels(u8 * _puiData)
|
|||
queue_draw();
|
||||
}
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent)
|
||||
{
|
||||
DrawingArea::on_expose_event(_pstEvent);
|
||||
|
@ -50,16 +51,16 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent)
|
|||
|
||||
poContext = get_window()->create_cairo_context();
|
||||
|
||||
poContext->set_identity_matrix();
|
||||
//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);
|
||||
//cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop);
|
||||
poPattern = Cairo::SurfacePattern::create(poImage);
|
||||
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->paint();
|
||||
|
||||
|
@ -68,10 +69,38 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent)
|
|||
|
||||
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()
|
||||
{
|
||||
if (m_puiPixels && is_realized())
|
||||
if (m_puiPixels && get_realized())
|
||||
{
|
||||
memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32));
|
||||
queue_draw_area(0, 0, get_width(), get_height());
|
||||
|
|
|
@ -33,7 +33,11 @@ public:
|
|||
void vDrawBlackScreen();
|
||||
|
||||
protected:
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
bool on_expose_event(GdkEventExpose * _pstEvent);
|
||||
#else
|
||||
bool on_draw(const Cairo::RefPtr<Cairo::Context> &poContext);
|
||||
#endif
|
||||
void vOnWidgetResize();
|
||||
|
||||
private:
|
||||
|
|
|
@ -109,7 +109,7 @@ void ScreenAreaGl::vDrawPixels(u8 * _puiData)
|
|||
|
||||
void ScreenAreaGl::vDrawBlackScreen()
|
||||
{
|
||||
if (m_puiPixels && is_realized())
|
||||
if (m_puiPixels && get_realized())
|
||||
{
|
||||
memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32));
|
||||
queue_draw_area(0, 0, get_width(), get_height());
|
||||
|
@ -177,7 +177,7 @@ bool ScreenAreaGl::on_expose_event(GdkEventExpose * _pstEvent)
|
|||
|
||||
void ScreenAreaGl::vOnSizeUpdated()
|
||||
{
|
||||
if (!is_realized())
|
||||
if (!get_realized())
|
||||
return;
|
||||
|
||||
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "screenarea.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <glibmm/main.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
@ -45,16 +46,14 @@ ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
|
|||
| Gdk::ENTER_NOTIFY_MASK
|
||||
| Gdk::LEAVE_NOTIFY_MASK);
|
||||
|
||||
char aiEmptyData[8];
|
||||
memset(aiEmptyData, 0, sizeof(aiEmptyData));
|
||||
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);
|
||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, 8, 8);
|
||||
pixbuf->fill(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()
|
||||
|
@ -69,10 +68,14 @@ ScreenArea::~ScreenArea()
|
|||
delete[] m_puiDelta;
|
||||
}
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
if (m_poEmptyCursor != NULL)
|
||||
{
|
||||
delete m_poEmptyCursor;
|
||||
}
|
||||
#else
|
||||
m_poEmptyCursor.reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ScreenArea::vSetSize(int _iWidth, int _iHeight)
|
||||
|
@ -133,7 +136,11 @@ void ScreenArea::vStopCursorTimeout()
|
|||
|
||||
void ScreenArea::vHideCursor()
|
||||
{
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
get_window()->set_cursor(*m_poEmptyCursor);
|
||||
#else
|
||||
get_window()->set_cursor(m_poEmptyCursor);
|
||||
#endif
|
||||
m_bShowCursor = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,12 @@ protected:
|
|||
bool m_bEnableRender;
|
||||
|
||||
bool m_bShowCursor;
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gdk::Cursor * m_poEmptyCursor;
|
||||
#else
|
||||
Glib::RefPtr<Gdk::Cursor> m_poEmptyCursor;
|
||||
#endif
|
||||
sigc::connection m_oCursorSig;
|
||||
|
||||
void vUpdateSize();
|
||||
|
|
|
@ -106,6 +106,7 @@ void systemUpdateMotionSensor()
|
|||
|
||||
u8 systemGetSensorDarkness()
|
||||
{
|
||||
return 0xE8;
|
||||
}
|
||||
|
||||
int systemGetSensorX()
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
<property name="border_width">5</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
<property name="title" translatable="yes">GameBoy settings</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
<property name="title" translatable="yes">Game Boy Advance settings</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Preferences</property>
|
||||
<property name="type_hint">normal</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
<property name="border_width">5</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include <gtkmm/alignment.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <glibmm/keyfile.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/main.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
@ -42,7 +45,7 @@
|
|||
#include "intl.h"
|
||||
#include "screenarea-cairo.h"
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
#if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
|
||||
#include "screenarea-opengl.h"
|
||||
#endif // USE_OPENGL
|
||||
|
||||
|
@ -135,6 +138,7 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml
|
|||
{
|
||||
vLoadConfig(m_sConfigFile);
|
||||
vCheckConfig();
|
||||
LoadConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -245,8 +249,13 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml
|
|||
//
|
||||
m_poRecentManager = Gtk::RecentManager::get_default();
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::RecentFilter oRecentFilter;
|
||||
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->set_show_numbers();
|
||||
|
@ -413,7 +422,7 @@ void Window::vApplyConfigScreenArea()
|
|||
{
|
||||
switch (eVideoOutput)
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
#if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
|
||||
case OutputOpenGL:
|
||||
vInitColors(ColorFormatBGR);
|
||||
m_poScreenArea = Gtk::manage(new ScreenAreaGl(m_iScreenWidth, m_iScreenHeight));
|
||||
|
@ -465,28 +474,20 @@ void Window::vInitSDL()
|
|||
if (bDone)
|
||||
return;
|
||||
|
||||
int iFlags = (SDL_INIT_EVERYTHING | SDL_INIT_NOPARACHUTE);
|
||||
|
||||
if (SDL_Init(iFlags) < 0)
|
||||
{
|
||||
fprintf(stderr, _("Failed to init SDL: %s"), SDL_GetError());
|
||||
abort();
|
||||
}
|
||||
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_LEFT, GDK_Left);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_RIGHT, GDK_Right);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_UP, GDK_Up);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_DOWN, GDK_Down);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_A, GDK_z);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_B, GDK_x);
|
||||
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);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_LEFT, GDK_KEY_Left);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_RIGHT, GDK_KEY_Right);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_UP, GDK_KEY_Up);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_DOWN, GDK_KEY_Down);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_A, GDK_KEY_z);
|
||||
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_BUTTON_L, GDK_KEY_a);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_R, GDK_KEY_s);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_SPEED, GDK_KEY_space);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_CAPTURE, GDK_KEY_F12);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_AUTO_A, GDK_KEY_q);
|
||||
inputSetKeymap(PAD_DEFAULT, KEY_BUTTON_AUTO_B, GDK_KEY_w);
|
||||
|
||||
// TODO : remove
|
||||
int sdlNumDevices = SDL_NumJoysticks();
|
||||
|
@ -541,7 +542,7 @@ void Window::vInitConfig()
|
|||
m_poDisplayConfig->vSetKey("scale", 1 );
|
||||
m_poDisplayConfig->vSetKey("filter2x", FilterNone );
|
||||
m_poDisplayConfig->vSetKey("filterIB", FilterIBNone );
|
||||
#ifdef USE_OPENGL
|
||||
#if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
|
||||
m_poDisplayConfig->vSetKey("output", OutputOpenGL );
|
||||
#else
|
||||
m_poDisplayConfig->vSetKey("output", OutputCairo );
|
||||
|
@ -1339,6 +1340,7 @@ void Window::vCreateFileOpenDialog()
|
|||
"*.7[zZ]",
|
||||
};
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::FileFilter oAllGBAFilter;
|
||||
oAllGBAFilter.set_name(_("All Gameboy Advance files"));
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
|
||||
|
@ -1359,6 +1361,28 @@ void Window::vCreateFileOpenDialog()
|
|||
{
|
||||
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(oGBAFilter);
|
||||
|
@ -1578,6 +1602,7 @@ std::string Window::sGetUiFilePath(const std::string &_sFileName)
|
|||
{
|
||||
// Use the ui file from the source folder if it exists
|
||||
// to make gvbam runnable without installation
|
||||
//std::string sUiFile = SOURCEDIR "/src/gtk/ui/" + _sFileName;
|
||||
std::string sUiFile = "src/gtk/ui/" + _sFileName;
|
||||
if (!Glib::file_test(sUiFile, Glib::FILE_TEST_EXISTS))
|
||||
{
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
|
||||
#include "window.h"
|
||||
|
||||
#include <glibmm/convert.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/main.h>
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
|
@ -98,9 +103,15 @@ void Window::vOnFileLoad()
|
|||
oDialog.add_shortcut_folder(sSaveDir);
|
||||
}
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::FileFilter oSaveFilter;
|
||||
oSaveFilter.set_name(_("VisualBoyAdvance save game"));
|
||||
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);
|
||||
|
||||
|
@ -133,9 +144,15 @@ void Window::vOnFileSave()
|
|||
}
|
||||
oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile)));
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::FileFilter oSaveFilter;
|
||||
oSaveFilter.set_name(_("VisualBoyAdvance save game"));
|
||||
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);
|
||||
|
||||
|
@ -293,9 +310,15 @@ void Window::vOnFileScreenCapture()
|
|||
}
|
||||
oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile)));
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
Gtk::FileFilter oPngFilter;
|
||||
oPngFilter.set_name(_("PNG image"));
|
||||
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);
|
||||
|
||||
|
@ -523,7 +546,7 @@ void Window::vOnHelpAbout()
|
|||
|
||||
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("kxu");
|
||||
list_authors.push_back("Pokemonhacker");
|
||||
|
@ -534,7 +557,7 @@ void Window::vOnHelpAbout()
|
|||
list_authors.push_back("bgK");
|
||||
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("Jakub Steiner");
|
||||
list_artists.push_back("Jones Lee");
|
||||
|
@ -581,7 +604,7 @@ bool Window::bOnEmuSaveStateRewind() {
|
|||
if (m_stEmulator.emuWriteMemState(m_psavestate, SZSTATE, resize)) {
|
||||
/*resize*=2; // if tell does not return correct size this leverage factor is needed
|
||||
if (resize > SZSTATE) resize = SZSTATE;*/
|
||||
g_assert( resize <= SZSTATE );
|
||||
g_assert( resize <= (int) SZSTATE );
|
||||
resize+=(sizeof(resize)*8); // some leverage
|
||||
psavestate = new char[resize];
|
||||
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)
|
||||
{
|
||||
// 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();
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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
|
||||
if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect();
|
||||
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
|
||||
SDL_Event event;
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
// 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
|
||||
if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect();
|
||||
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
|
||||
SDL_Event event;
|
||||
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);
|
||||
|
||||
|
||||
|
|
|
@ -271,9 +271,9 @@ void StopLirc(void)
|
|||
#define S_IFDIR _S_IFDIR
|
||||
#endif
|
||||
|
||||
void sdlCheckDirectory(char *dir)
|
||||
void sdlCheckDirectory(const char *dir)
|
||||
{
|
||||
if (!dir)
|
||||
if (!dir || !dir[0])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ void sdlCheckDirectory(char *dir)
|
|||
|
||||
int len = strlen(dir);
|
||||
|
||||
char *p = dir + len - 1;
|
||||
char *p = (char *)dir + len - 1;
|
||||
|
||||
if(*p == '/' ||
|
||||
*p == '\\')
|
||||
|
|
|
@ -185,8 +185,4 @@ if(APPLE)
|
|||
SET_SOURCE_FILES_PROPERTIES(${VBAM_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
endif(APPLE)
|
||||
|
||||
IF(WIN32 OR APPLE)
|
||||
SET(WX_EXE_NAME visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX})
|
||||
ELSE()
|
||||
SET(WX_EXE_NAME vbam${CMAKE_EXECUTABLE_SUFFIX})
|
||||
ENDIF()
|
||||
SET(WX_EXE_NAME visualboyadvance-m-wx${CMAKE_EXECUTABLE_SUFFIX})
|
||||
|
|
|
@ -4,7 +4,7 @@ Type=Application
|
|||
Name=VBA-M
|
||||
GenericName=Game Boy Advance Emulator
|
||||
Comment=Nintendo Game Boy Advance Emulator
|
||||
Exec=visualboyadvance-m %f
|
||||
Exec=visualboyadvance-m-wx %f
|
||||
Icon=vbam
|
||||
Categories=Game;Emulator;
|
||||
Keywords=emulator;Nintendo;gameboy;Game Boy;Game Boy Color;Game Boy Advance;
|
||||
|
|
Loading…
Reference in New Issue