MCPcopy Create free account
hub / github.com/TASEmulators/fceux / offsetStringToInt

Function offsetStringToInt

src/debug.cpp:22–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20int vblankPixel = 0; //Used to calculate the pixels in vblank
21
22int offsetStringToInt(unsigned int type, const char* offsetBuffer, bool *conversionOk)
23{
24 int offset = -1;
25
26 if (conversionOk)
27 {
28 *conversionOk = false;
29 }
30
31 if (sscanf(offsetBuffer,"%7X",(unsigned int *)&offset) == EOF)
32 {
33 return -1;
34 }
35
36 if (type & BT_P)
37 {
38 if (conversionOk)
39 {
40 *conversionOk = (offset >= 0) && (offset < 0x4000);
41 }
42 return offset & 0x3FFF;
43 }
44 else if (type & BT_S)
45 {
46 if (conversionOk)
47 {
48 *conversionOk = (offset >= 0) && (offset < 0x100);
49 }
50 return offset & 0x00FF;
51 }
52 else if (type & BT_R)
53 {
54 if (conversionOk)
55 {
56 *conversionOk = (offset >= 0);
57 }
58 return offset;
59 }
60 else // BT_C
61 {
62 auto sym = debugSymbolTable.getSymbolAtAnyBank(offsetBuffer);
63
64 if (sym)
65 {
66 if (conversionOk)
67 {
68 *conversionOk = true;
69 }
70 return sym->offset() & 0xFFFF;
71 }
72
73 int type = GIT_CART;
74
75 if (GameInfo)
76 {
77 type = GameInfo->type;
78 }
79 if (type == GIT_NSF) { //NSF Breakpoint keywords

Callers 8

NewBreakWindowsFunction · 0.85
DebuggerCallBFunction · 0.85
AddDebuggerBookmarkFunction · 0.85
checkDataValidMethod · 0.85
loadBreakpointMethod · 0.85
openBpEditWindowMethod · 0.85
handleDialogResponseFunction · 0.85
seekToCBFunction · 0.85

Calls 3

GetMemFunction · 0.85
getSymbolAtAnyBankMethod · 0.80
offsetMethod · 0.80

Tested by

no test coverage detected