Rizin
unix-like reverse engineering framework and cli tools
nin.h File Reference
#include <rz_types.h>
#include <string.h>

Go to the source code of this file.

Enumerations

enum  { GB_SGB = 3 , GB_GBC = 0x80 }
 
enum  {
  GB_ROM , GB_ROM_MBC1 , GB_ROM_MBC1_RAM , GB_ROM_MBC1_RAM_BAT ,
  GB_ROM_MBC2 = 0x5 , GB_ROM_MBC2_BAT , GB_ROM_RAM = 0x8 , GB_ROM_RAM_BAT ,
  GB_ROM_MMM0 = 0xb , GB_ROM_MMM0_SRAM , GB_ROM_MMM0_SRAM_BAT , GB_ROM_MBC3_TIMER_BAT = 0xf ,
  GB_ROM_MBC3_TIMER_RAM_BAT , GB_ROM_MBC3 , GB_ROM_MBC3_RAM , GB_ROM_MBC3_RAM_BAT ,
  GB_ROM_MBC5 = 0x19 , GB_ROM_MBC5_RAM , GB_ROM_MBC5_RAM_BAT , GB_ROM_MBC5_RMBL ,
  GB_ROM_MBC5_RMBL_SRAM , GB_ROM_MBC5_RMBL_SRAM_BAT , GB_CAM , GB_TAMA5 = 0xfd ,
  GB_HUC3 , GB_HUC1
}
 
enum  {
  GB_ROM_BANKS_2 , GB_ROM_BANKS_4 , GB_ROM_BANKS_8 , GB_ROM_BANKS_16 ,
  GB_ROM_BANKS_32 , GB_ROM_BANKS_64 , GB_ROM_BANKS_128 , GB_ROM_BANKS_72 = 0x52 ,
  GB_ROM_BANKS_80 , GB_ROM_BANKS_96
}
 
enum  {
  GB_NO_RAM , GB_RAM_2 , GB_RAM_8 , GB_RAM_32 ,
  GB_RAM_128
}
 

Functions

void gb_add_cardtype (char *type, ut8 cardcode)
 
int gb_get_rombanks (ut8 id)
 
void gb_get_gbtype (char *type, ut8 foo, ut8 bar)
 

Variables

const ut8 lic []
 
const char * gb_card_type_str []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GB_SGB 
GB_GBC 

Definition at line 7 of file nin.h.

7  {
8  GB_SGB = 3,
9  GB_GBC = 0x80
10 };
@ GB_GBC
Definition: nin.h:9
@ GB_SGB
Definition: nin.h:8

◆ anonymous enum

anonymous enum
Enumerator
GB_ROM 
GB_ROM_MBC1 
GB_ROM_MBC1_RAM 
GB_ROM_MBC1_RAM_BAT 
GB_ROM_MBC2 
GB_ROM_MBC2_BAT 
GB_ROM_RAM 
GB_ROM_RAM_BAT 
GB_ROM_MMM0 
GB_ROM_MMM0_SRAM 
GB_ROM_MMM0_SRAM_BAT 
GB_ROM_MBC3_TIMER_BAT 
GB_ROM_MBC3_TIMER_RAM_BAT 
GB_ROM_MBC3 
GB_ROM_MBC3_RAM 
GB_ROM_MBC3_RAM_BAT 
GB_ROM_MBC5 
GB_ROM_MBC5_RAM 
GB_ROM_MBC5_RAM_BAT 
GB_ROM_MBC5_RMBL 
GB_ROM_MBC5_RMBL_SRAM 
GB_ROM_MBC5_RMBL_SRAM_BAT 
GB_CAM 
GB_TAMA5 
GB_HUC3 
GB_HUC1 

Definition at line 12 of file nin.h.

12  {
13  GB_ROM,
17  GB_ROM_MBC2 = 0x5,
19  GB_ROM_RAM = 0x8,
21  GB_ROM_MMM0 = 0xb,
29  GB_ROM_MBC5 = 0x19,
35  GB_CAM,
36  GB_TAMA5 = 0xfd,
37  GB_HUC3,
38  GB_HUC1
39 };
@ GB_ROM_MBC5
Definition: nin.h:29
@ GB_HUC1
Definition: nin.h:38
@ GB_TAMA5
Definition: nin.h:36
@ GB_ROM_MBC3_RAM_BAT
Definition: nin.h:28
@ GB_ROM_MBC3_RAM
Definition: nin.h:27
@ GB_HUC3
Definition: nin.h:37
@ GB_ROM_MBC3
Definition: nin.h:26
@ GB_ROM_MMM0
Definition: nin.h:21
@ GB_ROM_RAM
Definition: nin.h:19
@ GB_ROM_MMM0_SRAM
Definition: nin.h:22
@ GB_ROM
Definition: nin.h:13
@ GB_ROM_MBC3_TIMER_RAM_BAT
Definition: nin.h:25
@ GB_ROM_MBC3_TIMER_BAT
Definition: nin.h:24
@ GB_ROM_MBC2_BAT
Definition: nin.h:18
@ GB_ROM_MMM0_SRAM_BAT
Definition: nin.h:23
@ GB_ROM_MBC5_RAM
Definition: nin.h:30
@ GB_ROM_MBC5_RAM_BAT
Definition: nin.h:31
@ GB_ROM_RAM_BAT
Definition: nin.h:20
@ GB_CAM
Definition: nin.h:35
@ GB_ROM_MBC1_RAM
Definition: nin.h:15
@ GB_ROM_MBC1_RAM_BAT
Definition: nin.h:16
@ GB_ROM_MBC5_RMBL_SRAM
Definition: nin.h:33
@ GB_ROM_MBC1
Definition: nin.h:14
@ GB_ROM_MBC2
Definition: nin.h:17
@ GB_ROM_MBC5_RMBL_SRAM_BAT
Definition: nin.h:34
@ GB_ROM_MBC5_RMBL
Definition: nin.h:32

◆ anonymous enum

anonymous enum
Enumerator
GB_ROM_BANKS_2 
GB_ROM_BANKS_4 
GB_ROM_BANKS_8 
GB_ROM_BANKS_16 
GB_ROM_BANKS_32 
GB_ROM_BANKS_64 
GB_ROM_BANKS_128 
GB_ROM_BANKS_72 
GB_ROM_BANKS_80 
GB_ROM_BANKS_96 

Definition at line 41 of file nin.h.

41  {
49  GB_ROM_BANKS_72 = 0x52,
52 };
@ GB_ROM_BANKS_2
Definition: nin.h:42
@ GB_ROM_BANKS_4
Definition: nin.h:43
@ GB_ROM_BANKS_96
Definition: nin.h:51
@ GB_ROM_BANKS_128
Definition: nin.h:48
@ GB_ROM_BANKS_8
Definition: nin.h:44
@ GB_ROM_BANKS_64
Definition: nin.h:47
@ GB_ROM_BANKS_72
Definition: nin.h:49
@ GB_ROM_BANKS_80
Definition: nin.h:50
@ GB_ROM_BANKS_32
Definition: nin.h:46
@ GB_ROM_BANKS_16
Definition: nin.h:45

◆ anonymous enum

anonymous enum
Enumerator
GB_NO_RAM 
GB_RAM_2 
GB_RAM_8 
GB_RAM_32 
GB_RAM_128 

Definition at line 54 of file nin.h.

54  {
55  GB_NO_RAM,
56  GB_RAM_2,
57  GB_RAM_8,
58  GB_RAM_32,
60 };
@ GB_NO_RAM
Definition: nin.h:55
@ GB_RAM_2
Definition: nin.h:56
@ GB_RAM_8
Definition: nin.h:57
@ GB_RAM_128
Definition: nin.h:59
@ GB_RAM_32
Definition: nin.h:58

Function Documentation

◆ gb_add_cardtype()

void gb_add_cardtype ( char *  type,
ut8  cardcode 
)

Definition at line 105 of file nin.h.

105  {
106  strcat(type, "\ncard\t");
107  switch (cardcode) {
108  case GB_TAMA5:
109  case GB_HUC3:
110  case GB_HUC1:
111  strcat(type, gb_card_type_str[cardcode - 240]);
112  break;
113  case 0x15:
114  case 0x16:
115  case 0x17:
116  strcat(type, "XXX");
117  break;
118  default:
119  if (cardcode > GB_CAM) {
120  strcat(type, "XXX");
121  return;
122  }
123  strcat(type, gb_card_type_str[cardcode]);
124  break;
125  }
126 }
int type
Definition: mipsasm.c:17
const char * gb_card_type_str[]
Definition: nin.h:70

References GB_CAM, gb_card_type_str, GB_HUC1, GB_HUC3, GB_TAMA5, and type.

Referenced by info().

◆ gb_get_gbtype()

void gb_get_gbtype ( char *  type,
ut8  foo,
ut8  bar 
)

Definition at line 154 of file nin.h.

154  {
155  if (foo == GB_SGB) {
156  strcpy(type, "SuperGameboy-Rom");
157  } else {
158  if (bar == GB_GBC) {
159  strcpy(type, "GameboyColor-Rom");
160  } else {
161  strcpy(type, "Gameboy-Rom");
162  }
163  }
164 }
static RzMain foo[]
Definition: main.c:11

References foo, GB_GBC, GB_SGB, and type.

Referenced by info().

◆ gb_get_rombanks()

int gb_get_rombanks ( ut8  id)

Definition at line 128 of file nin.h.

128  {
129  switch (id) {
130  case GB_ROM_BANKS_2:
131  return 2;
132  case GB_ROM_BANKS_4:
133  return 4;
134  case GB_ROM_BANKS_8:
135  return 8;
136  case GB_ROM_BANKS_16:
137  return 16;
138  case GB_ROM_BANKS_32:
139  return 32;
140  case GB_ROM_BANKS_64:
141  return 64;
142  case GB_ROM_BANKS_128:
143  return 128;
144  case GB_ROM_BANKS_72:
145  return 72;
146  case GB_ROM_BANKS_80:
147  return 80;
148  case GB_ROM_BANKS_96:
149  return 96;
150  }
151  return 2;
152 }

References GB_ROM_BANKS_128, GB_ROM_BANKS_16, GB_ROM_BANKS_2, GB_ROM_BANKS_32, GB_ROM_BANKS_4, GB_ROM_BANKS_64, GB_ROM_BANKS_72, GB_ROM_BANKS_8, GB_ROM_BANKS_80, and GB_ROM_BANKS_96.

Referenced by sections().

Variable Documentation

◆ gb_card_type_str

const char* gb_card_type_str[]

Definition at line 70 of file nin.h.

Referenced by gb_add_cardtype().

◆ lic

const ut8 lic[]
Initial value:
= {
0xce, 0xed, 0x66, 0x66, 0xcc, 0x0d, 0x00, 0x0b, 0x03, 0x73, 0x00,
0x83, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x08, 0x11, 0x1f, 0x88, 0x89,
0x00, 0x0e, 0xdc, 0xcc, 0x6e, 0xe6, 0xdd, 0xdd, 0xd9, 0x99, 0xbb,
0xbb, 0x67, 0x63, 0x6e, 0x0e, 0xec, 0xcc, 0xdd, 0xdc, 0x99, 0x9f,
0xbb, 0xb9, 0x33, 0x3e
}

Definition at line 62 of file nin.h.

Referenced by check_buffer().