Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 67036 Details for
Bug 62700
VisualBoyAdvance: Add Cheat Codes
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated patch. Should work with both cheat formats now.
Visualboyadvance-cheat.patch (text/plain), 3.60 KB, created by
qube99
on 2005-08-27 16:29:54 UTC
(
hide
)
Description:
Updated patch. Should work with both cheat formats now.
Filename:
MIME Type:
Creator:
qube99
Created:
2005-08-27 16:29:54 UTC
Size:
3.60 KB
patch
obsolete
>diff -ur VisualBoyAdvance-1.7.2-org/src/sdl/SDL.cpp VisualBoyAdvance-1.7.2/src/sdl/SDL.cpp >--- VisualBoyAdvance-1.7.2-org/src/sdl/SDL.cpp 2005-03-20 20:25:09.667430192 -0500 >+++ VisualBoyAdvance-1.7.2/src/sdl/SDL.cpp 2005-03-20 20:31:35.947706664 -0500 >@@ -22,7 +22,8 @@ > #include <string.h> > #include <sys/types.h> > #include <sys/stat.h> >- >+#include <fcntl.h> >+ > #include "AutoBuild.h" > > #include "SDL.h" >@@ -170,6 +171,7 @@ > void (*filterFunction)(u8*,u32,u8*,u8*,u32,int,int) = NULL; > void (*ifbFunction)(u8*,u32,int,int) = NULL; > int ifbType = 0; >+char cheatfile[2048] = ""; > char filename[2048]; > char ipsname[2048]; > char biosFileName[2048]; >@@ -305,6 +307,7 @@ > { "agb-print", no_argument, &sdlAgbPrint, 1 }, > { "auto-frameskip", no_argument, &autoFrameSkip, 1 }, > { "bios", required_argument, 0, 'b' }, >+ { "cheat", required_argument, 0, 'C' }, > { "config", required_argument, 0, 'c' }, > { "debug", no_argument, 0, 'd' }, > { "filter", required_argument, 0, 'f' }, >@@ -1872,6 +1875,7 @@ > 4 - IYUV\n\ > -b, --bios=BIOS Use given bios file\n\ > -c, --config=FILE Read the given configuration file\n\ >+ -C, --cheat=FILE Read the given cheat file\n\ > -d, --debug Enter debugger\n\ > -f, --filter=FILTER Select filter:\n\ > --filter-normal 0 - normal mode\n\ >@@ -1988,6 +1992,16 @@ > fclose(f); > } > break; >+ case 'C': >+ { >+ if(optarg == NULL) { >+ fprintf(stderr, "Missing cheat file name\n"); >+ exit(-1); >+ } >+ strncpy(cheatfile,optarg,2047); >+ cheatfile[2047]='\0'; >+ } >+ break; > case 'd': > debugger = true; > break; >@@ -2245,6 +2259,72 @@ > CPUReset(); > } > } >+ if (strcmp(cheatfile, "") != 0) { >+ int fd; >+ fd = open(cheatfile,O_RDONLY); >+ if (fd != -1) { >+ struct stat buf; >+ fstat(fd,&buf); >+ if (buf.st_size <= 65536) { >+ char buffer[buf.st_size+1]; >+ buffer[buf.st_size] = '\0'; >+ if (read(fd, buffer, buf.st_size) != buf.st_size) >+ printf("Cheat file read error.\n"); >+ else { >+ int i = 0, c = 0; >+ char *code, *desc; >+ while (c < buf.st_size) { >+ code = desc = ""; >+ while (c < buf.st_size && >+ buffer[c] == ' ' || buffer[c] == '\t' || >+ buffer[c] == '\n' || buffer[c] == '\r') >+ c++; >+ if (c < buf.st_size) { >+ code = &buffer[c]; >+ while (c < buf.st_size && >+ buffer[c] != '#' && >+ buffer[c] != '\r' && >+ buffer[c] != '\n') >+ c++; >+ if (c < buf.st_size) { >+ if (buffer[c] == '#') { >+ buffer[c++] = '\0'; >+ desc = &buffer[c]; >+ while (c < buf.st_size && >+ buffer[c] != '\r' && >+ buffer[c] != '\n') >+ c++; >+ if (c < buf.st_size) >+ buffer[c++] = '\0'; >+ } else >+ buffer[c++] = '\0'; >+ >+ } >+ if (strlen(code) >= 17) { >+ code[17] = '\0'; >+ printf("GSA Code: #%s# ; Desc: #%s#\n", code, desc); >+ int j; >+ for (j = 8; j < 17; j++) >+ { >+ code[j] = code[j+1]; >+ } >+ cheatsAddGSACode(code, desc, 1); >+ cheatsEnable(i++); >+ } else if (strlen(code) >= 13) { >+ code[13] = '\0'; >+ printf("CBA Code: #%s# ; Desc: #%s#\n", code, desc); >+ cheatsAddCBACode(code, desc); >+ cheatsEnable(i++); >+ } >+ } >+ } >+ } >+ } else { >+ printf("Cheat file too large (>64K).\n"); >+ } >+ } else >+ printf("Cheat file error.\n"); >+ } > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62700
:
38809
| 67036