1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2026-01-03 12:24:17 +01:00
Files
gryf-overlay/games-emulation/grustibus/files/0.43-crash.patch
2010-02-09 21:25:29 +01:00

287 lines
9.6 KiB
Diff

diff -Nur grustibus-0.43/src/grustibus.c grustibus-0.43p1/src/grustibus.c
--- grustibus-0.43/src/grustibus.c 2001-05-10 14:18:21.000000000 +0200
+++ grustibus-0.43p1/src/grustibus.c 2003-12-24 11:30:29.000000000 +0100
@@ -25,6 +25,10 @@
*
* Last modified: 25 April 2001 <kjetilt@users.sourceforge.net>
*
+ * Unofficial modification by Roman 'gryf' Dobosz <gryf@elysium.pl>
+ * for use with latest xmame releases (currently 0.77.1)
+ *
+ * Last modified: 24 December 2003
*/
#include "grustibus.h"
@@ -694,12 +698,12 @@
*exec = g_strconcat("\"", general_prefs.xmame_exe, "\"",
" -rompath ", "\"", general_prefs.rom_dir,
- "\"", " -cheatfile ", "\"",
+ "\"", " -cheat_file ", "\"",
general_prefs.cheat_file, "\"",
- " -historyfile ", "\"",
+ " -history_file ", "\"",
general_prefs.game_history_file, "\"",
- " -screenshotdir ", "\"", screenshotdir, "\"",
- " -spooldir ", "\"",
+ " -snapshot_directory ", "\"", screenshotdir, "\"",
+ " -hiscore_directory ", "\"",
general_prefs.highscore_dir, "\"",
game_settings.fullscreen ? fullscreen :
windowed,
diff -Nur grustibus-0.43/src/gui.c grustibus-0.43p1/src/gui.c
--- grustibus-0.43/src/gui.c 2001-05-10 14:26:30.000000000 +0200
+++ grustibus-0.43p1/src/gui.c 2003-12-24 11:18:39.000000000 +0100
@@ -25,6 +25,13 @@
*
* Last modified: 28 April 2001 <kjetilt@users.sourceforge.net>
*
+ * Unofficial modification by Roman 'gryf' Dobosz <gryf@elysium.pl>
+ * modified function set_game_history(), for other then Mark's Longridge
+ * history.dat usability. Code was taken from gxmame's gui.c
+ * http://gxmame.sourceforge.net
+ *
+ * Last modified: 24 December 2003
+ *
*/
#include "grustibus.h"
@@ -2185,110 +2192,118 @@
gboolean set_game_history(const gchar * game)
{
- FILE *history_file;
- GtkText *history_txt;
- gchar line[2000];
- gint i, n;
- gchar *tmp, *p;
- gchar **games;
- gboolean found_game = FALSE;
- gboolean pointer_in_info = FALSE;
-
- history_txt = GTK_TEXT(gtk_object_get_data
- (GTK_OBJECT(main_window),
- "game_history_text"));
-
- gtk_text_freeze(history_txt);
- gtk_text_set_point(history_txt, gtk_text_get_length(history_txt));
- gtk_text_backward_delete(history_txt,
- gtk_text_get_length(history_txt));
-
- history_file = fopen(general_prefs.game_history_file, "r");
-
- if (!history_file) {
- gtk_text_insert(history_txt,
- NULL,
- NULL,
- NULL,
- _
- ("\n\n History.dat file not found"),
- -1);
- gtk_text_thaw(history_txt);
- return (FALSE);
- }
-
- /* TODO: history.dat should be read in a function in fileio.c that should return
- * the read text or NULL if no text was found
- */
+ FILE *history_file;
+ GtkText *history_txt;
+ gchar line[2000];
+ gint i, n;
+ gchar *tmp, *p;
+ gchar **games;
+ gboolean found_game = FALSE;
+ gboolean pointer_in_info = FALSE;
+ gboolean extra_newline = FALSE;
+
+ history_txt = GTK_TEXT(gtk_object_get_data (GTK_OBJECT(main_window),"game_history_text"));
+
+ gtk_text_freeze(history_txt);
+ gtk_text_set_point(history_txt, gtk_text_get_length(history_txt));
+ gtk_text_backward_delete(history_txt, gtk_text_get_length(history_txt));
+
+ history_file = fopen(general_prefs.game_history_file, "r");
+
+ if (!history_file)
+ {
+ gtk_text_insert(history_txt,
+ NULL,
+ NULL,
+ NULL,
+ _
+ ("\n\n History.dat file not found"),
+ -1);
+ gtk_text_thaw(history_txt);
+ return (FALSE);
+ }
+
+ /* TODO: history.dat should be read in a function in fileio.c that should return
+ * the read text or NULL if no text was found
+ */
+
+ /* Scan through the file. First look for '$',then $info=game, $bio and $end */
+ while (fgets(line, 500, history_file)) {
+ p = line;
+ tmp = p;
+ if (*tmp == '$' && !found_game) {
+ /* Found a line */
+ if (!strncmp(p, "$info", 5)) {
+ p= tmp=p+6;
+ /* It is an info line */
+ i = 0;
+ while (*tmp && (*tmp++ != '\n'))
+ i++;
+ /* Sometimes the list is continued on the next line */
+ i--;
+ do {
+ p[i] = fgetc(history_file);
+ if (p[i] == '\n')
+ i--;
+ if (p[i] == '\r')
+ i--;
+ i++;
+
+ } while ((p[i - 1] != '$') && i < 2000 /* buffer size */);
+ if (p[i - 1] == '$')
+ ungetc('$', history_file);
+
+ p[i - 1] = 0;
+ games = g_strsplit(p, ",", 20);
+ n = 0;
+
+ while ((games[n] != NULL)) {
+ games[n] = g_strchomp(games[n]);
+
+ if (!strcmp(games[n], game)) {
+ /* It is the info for the wanted game */
+ found_game = TRUE;
+ }
+ n++;
+ }
+ g_strfreev(games);
+ }
+ } else if (found_game && (*tmp == '$')) {
+ if (!strncmp(p, "$bio", 4))
+ pointer_in_info = TRUE;
+ if (!strncmp(p, "$end", 4)) {
+ pointer_in_info = FALSE;
+ break;
+ }
+ } else if (found_game && pointer_in_info) {
+ i = 0;
+ while (*tmp && (*tmp != '\r') &&(*tmp++ != '\n'))
+ i++;
+ if (i == 0)
+ {/* and a new line but not severals*/
+ if (!extra_newline)
+ {
+ extra_newline = TRUE;
+ }
+ else
+ extra_newline = FALSE;
+ }
+ else
+ {
+ extra_newline = FALSE;
+ }
+ if (!extra_newline)
+ {
+ p[i] = '\n';
+ p[i + 1] = '\0';
+ gtk_text_insert(history_txt, NULL, NULL, NULL, p, -1);
+ grustibus_debug("Added history txt: %s", p);
+ }
+ }
+ }
- /* Scan through the file. First look for '$',then $info=game, $bio and $end */
- while (fgets(line, 500, history_file)) {
- p = line;
- tmp = p;
- if (*tmp == '$' && !found_game) {
- /* Found a line */
- i = 0;
- while (*tmp && (*tmp++ != '=') && (*tmp != '\n'))
- i++;
- p[i] = 0;
- if (!strncmp(p, "$info", 5)) {
- p = tmp;
- /* It is an info line */
- i = 0;
- while (*tmp && (*tmp++ != '\n'))
- i++;
- /* Sometimes the list is continued on the next line */
- i--;
- do {
- p[i] = fgetc(history_file);
- if (p[i] == '\n')
- i--;
- if (p[i] == '\r')
- i--;
- i++;
- } while ((p[i - 1] != '$'));
- p[i - 1] = 0;
- games = g_strsplit(p, ",", 20);
- n = 0;
- while ((games[n] != NULL)) {
- games[n] = g_strchomp(games[n]);
-
- if (!strcmp(games[n], game)) {
- /* It is the info for the wanted game */
- found_game = TRUE;
- }
- n++;
- }
- g_strfreev(games);
- }
- } else if (found_game && (*tmp == '$')) {
- i = 0;
- while (*tmp && (*tmp++ != '=') && (*tmp != '\n'))
- i++;
- p[i] = 0;
- if (!strncmp(p, "$bio", 4))
- pointer_in_info = TRUE;
- if (!strncmp(p, "$end", 4)) {
- pointer_in_info = FALSE;
- break;
- }
- } else if (found_game && pointer_in_info) {
- i = 0;
- while (*tmp && (*tmp++ != '=') && (*tmp != '\n'))
- i++;
- if (i == 0)
- p[i] = '\n';
- else
- p[i] = ' ';
-
- p[i + 1] = 0;
- gtk_text_insert(history_txt,
- NULL, NULL, NULL, p, -1);
- grustibus_debug("Added history txt: %s", p);
- }
- }
-
- if (!found_game) {
+ if (!found_game)
+ {
tmp = g_malloc(100);
g_snprintf(tmp, 100,
_
@@ -2296,12 +2311,12 @@
game);
gtk_text_insert(history_txt, NULL, NULL, NULL, tmp, -1);
g_free(tmp);
- }
+ }
- fclose(history_file);
+ fclose(history_file);
gtk_text_thaw(history_txt);
- return (found_game);
+ return (found_game);
}
void set_game_info_widgets()