diff --git a/desmume/src/windows/IORegView.cpp b/desmume/src/windows/IORegView.cpp index 029e87dfb..b05be383b 100644 --- a/desmume/src/windows/IORegView.cpp +++ b/desmume/src/windows/IORegView.cpp @@ -40,7 +40,7 @@ enum EIORegType typedef struct _IORegBitfield { - char name[32]; + char name[64]; int shift; int nbits; } IORegBitfield; @@ -56,49 +56,149 @@ typedef struct _IOReg } IOReg; IOReg IORegs9[] = { - {AllRegs, "All registers", 0, 9, 0, {{0}}}, + {AllRegs, "All registers", 0, 80, 0, {{0}}}, {CatBegin, "General video registers", 0, 1, 0, {{0}}}, - {MMIOReg, "DISPSTAT", 0x04000004, 2, 8, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Enable VBlank IRQ",3,1}, - {"Enable HBlank IRQ",4,1},{"Enable VCount match IRQ",5,1},{"VCount MSb",7,1},{"VCount LSb's",8,8}}}, + {MMIOReg, "DISPSTAT", 0x04000004, 2, 8, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Enable VBlank IRQ",3,1}, + {"Enable HBlank IRQ",4,1},{"Enable VCount match IRQ",5,1},{"VCount MSb",7,1},{"VCount LSb's",8,8}}}, + {MMIOReg, "VCOUNT", 0x04000006, 2, 1, {{"VCount",0,9}}}, - {CatBegin, "Video engine A registers", 0, 1, 0, {{0}}}, - {MMIOReg, "DISPCNT_A", 0x04000000, 4, 23, {{"BG mode",0,3},{"BG0 -> 3D",3,1},{"Tile OBJ mapping",4,1},{"Bitmap OBJ 2D size",5,1}, - {"Bitmap OBJ mapping",6,1},{"Forced blank",7,1},{"Display BG0",8,1},{"Display BG1",9,1}, - {"Display BG2",10,1},{"Display BG3",11,1},{"Display OBJ",12,1},{"Display window 0",13,1}, - {"Display window 1",14,1},{"Display OBJ window",15,1},{"Display mode",16,2},{"VRAM block",18,2}, - {"Tile OBJ 1D boundary",20,2},{"Bitmap OBJ 1D boundary",22,1},{"Process OBJs during HBlank",23,1},{"Character base",24,3}, - {"Screen base",27,3},{"Enable BG ext. palettes",30,1},{"Enable OBJ ext. palettes",31,1}}}, + {CatBegin, "Video engine A registers", 0, 37, 0, {{0}}}, + {MMIOReg, "[A]DISPCNT", 0x04000000, 4, 23, {{"BG mode",0,3},{"BG0 -> 3D",3,1},{"Tile OBJ mapping",4,1},{"Bitmap OBJ 2D size",5,1}, + {"Bitmap OBJ mapping",6,1},{"Forced blank",7,1},{"Display BG0",8,1},{"Display BG1",9,1}, + {"Display BG2",10,1},{"Display BG3",11,1},{"Display OBJ",12,1},{"Display window 0",13,1}, + {"Display window 1",14,1},{"Display OBJ window",15,1},{"Display mode",16,2},{"VRAM bank",18,2}, + {"Tile OBJ 1D boundary",20,2},{"Bitmap OBJ 1D boundary",22,1},{"Process OBJs during HBlank",23,1},{"Character base",24,3}, + {"Screen base",27,3},{"Enable BG ext. palettes",30,1},{"Enable OBJ ext. palettes",31,1}}}, + {MMIOReg, "[A]BG0CNT", 0x04000008, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Ext. palette slot",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[A]BG1CNT", 0x0400000A, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Ext. palette slot",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[A]BG2CNT", 0x0400000C, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Display area overflow",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[A]BG3CNT", 0x0400000E, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Display area overflow",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[A]BG0HOFS", 0x04000010, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG0VOFS", 0x04000012, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG1HOFS", 0x04000014, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG1VOFS", 0x04000016, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG2HOFS", 0x04000018, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG2VOFS", 0x0400001A, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG3HOFS", 0x0400001C, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG3VOFS", 0x0400001E, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[A]BG2PA", 0x04000020, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG2PB", 0x04000022, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG2PC", 0x04000024, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG2PD", 0x04000026, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG2X", 0x04000028, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[A]BG2Y", 0x0400002C, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[A]BG3PA", 0x04000030, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG3PB", 0x04000032, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG3PC", 0x04000034, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG3PD", 0x04000036, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[A]BG3X", 0x04000038, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[A]BG3Y", 0x0400003C, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[A]WIN0H", 0x04000040, 2, 2, {{"X2",0,8},{"X1",8,8}}}, + {MMIOReg, "[A]WIN1H", 0x04000042, 2, 2, {{"X2",0,8},{"X1",8,8}}}, + {MMIOReg, "[A]WIN0V", 0x04000044, 2, 2, {{"Y2",0,8},{"Y1",8,8}}}, + {MMIOReg, "[A]WIN1V", 0x04000046, 2, 2, {{"Y2",0,8},{"Y1",8,8}}}, + {MMIOReg, "[A]WININ", 0x04000048, 2, 12, {{"Enable WIN0 on BG0",0,1},{"Enable WIN0 on BG1",1,1},{"Enable WIN0 on BG2",2,1},{"Enable WIN0 on BG3",3,1}, + {"Enable WIN0 on OBJ",4,1},{"Enable color effect on WIN0",5,1},{"Enable WIN1 on BG0",8,1},{"Enable WIN1 on BG1",9,1}, + {"Enable WIN1 on BG2",10,1},{"Enable WIN1 on BG3",11,1},{"Enable WIN1 on OBJ",12,1},{"Enable color effect on WIN1",13,1}}}, + {MMIOReg, "[A]WINOUT", 0x04000048, 2, 12, {{"Enable win. out. on BG0",0,1},{"Enable win. out. on BG1",1,1},{"Enable win. out. on BG2",2,1},{"Enable win. out. on BG3",3,1}, + {"Enable win. out. on OBJ",4,1},{"Enable color effect on win. out.",5,1},{"Enable OBJ win. on BG0",8,1},{"Enable OBJ win. on BG1",9,1}, + {"Enable OBJ win. on BG2",10,1},{"Enable OBJ win. on BG3",11,1},{"Enable OBJ win. on OBJ",12,1},{"Enable color effect on OBJ win.",13,1}}}, + {MMIOReg, "[A]MOSAIC", 0x0400004C, 2, 4, {{"BG mosaic width",0,4},{"BG mosaic height",4,4},{"OBJ mosaic width",8,4},{"OBJ mosaic height",12,4}}}, + {MMIOReg, "[A]BLDCNT", 0x04000050, 2, 13, {{"BG0 -> 1st target",0,1},{"BG1 -> 1st target",1,1},{"BG2 -> 1st target",2,1},{"BG3 -> 1st target",3,1}, + {"OBJ -> 1st target",4,1},{"Backdrop -> 1st target",5,1},{"Color effect",6,2},{"BG0 -> 2nd target",8,1}, + {"BG1 -> 2nd target",9,1},{"BG2 -> 2nd target",10,1},{"BG3 -> 2nd target",11,1},{"OBJ -> 2nd target",12,1}, + {"Backdrop -> 2nd target",13,1}}}, + {MMIOReg, "[A]BLDALPHA", 0x04000052, 2, 2, {{"EVA",0,5},{"EVB",8,5}}}, + {MMIOReg, "[A]BLDY", 0x04000054, 2, 1, {{"EVY",0,5}}}, + {MMIOReg, "DISPCAPCNT", 0x04000064, 4, 10, {{"EVA",0,5},{"EVB",8,5},{"VRAM write bank",16,2},{"VRAM write offset",18,2}, + {"Capture size",20,2},{"Source A",24,1},{"Source B",25,1},{"VRAM read offset",26,2}, + {"Capture source",29,2},{"Capture enable",31,1}}}, + {MMIOReg, "[A]MASTER_BRIGHT", 0x0400006C, 2, 2, {{"Factor",0,5},{"Mode",14,2}}}, - {CatBegin, "Video engine B registers", 0, 1, 0, {{0}}}, - {MMIOReg, "DISPCNT_B", 0x04001000, 4, 18, {{"BG mode",0,3},{"Tile OBJ mapping",4,1},{"Bitmap OBJ 2D size",5,1},{"Bitmap OBJ mapping",6,1}, - {"Forced blank",7,1},{"Display BG0",8,1},{"Display BG1",9,1},{"Display BG2",10,1}, - {"Display BG3",11,1},{"Display OBJ",12,1},{"Display window 0",13,1},{"Display window 1",14,1}, - {"Display OBJ window",15,1},{"Display mode",16,2},{"Tile OBJ 1D boundary",20,2},{"Process OBJs during HBlank",23,1}, - {"Enable BG ext. palettes",30,1},{"Enable OBJ ext. palettes",31,1}}}, - + + {CatBegin, "Video engine B registers", 0, 36, 0, {{0}}}, + {MMIOReg, "[B]DISPCNT", 0x04001000, 4, 18, {{"BG mode",0,3},{"Tile OBJ mapping",4,1},{"Bitmap OBJ 2D size",5,1},{"Bitmap OBJ mapping",6,1}, + {"Forced blank",7,1},{"Display BG0",8,1},{"Display BG1",9,1},{"Display BG2",10,1}, + {"Display BG3",11,1},{"Display OBJ",12,1},{"Display window 0",13,1},{"Display window 1",14,1}, + {"Display OBJ window",15,1},{"Display mode",16,2},{"Tile OBJ 1D boundary",20,2},{"Process OBJs during HBlank",23,1}, + {"Enable BG ext. palettes",30,1},{"Enable OBJ ext. palettes",31,1}}}, + {MMIOReg, "[B]BG0CNT", 0x04001008, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Ext. palette slot",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[B]BG1CNT", 0x0400100A, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Ext. palette slot",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[B]BG2CNT", 0x0400100C, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Display area overflow",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[B]BG3CNT", 0x0400100E, 2, 7, {{"Priority",0,2},{"Character base",2,4},{"Mosaic",6,1},{"Palette mode",7,1}, + {"Screen base",8,5},{"Display area overflow",13,1},{"Screen size",14,2}}}, + {MMIOReg, "[B]BG0HOFS", 0x04001010, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG0VOFS", 0x04001012, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG1HOFS", 0x04001014, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG1VOFS", 0x04001016, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG2HOFS", 0x04001018, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG2VOFS", 0x0400101A, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG3HOFS", 0x0400101C, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG3VOFS", 0x0400101E, 2, 1, {{"Offset",0,9}}}, + {MMIOReg, "[B]BG2PA", 0x04001020, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG2PB", 0x04001022, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG2PC", 0x04001024, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG2PD", 0x04001026, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG2X", 0x04001028, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[B]BG2Y", 0x0400102C, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[B]BG3PA", 0x04001030, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG3PB", 0x04001032, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG3PC", 0x04001034, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG3PD", 0x04001036, 2, 3, {{"Fractional part",0,8},{"Integer part",8,7},{"Sign",15,1}}}, + {MMIOReg, "[B]BG3X", 0x04001038, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[B]BG3Y", 0x0400103C, 4, 3, {{"Fractional part",0,8},{"Integer part",8,19},{"Sign",27,1}}}, + {MMIOReg, "[B]WIN0H", 0x04001040, 2, 2, {{"X2",0,8},{"X1",8,8}}}, + {MMIOReg, "[B]WIN1H", 0x04001042, 2, 2, {{"X2",0,8},{"X1",8,8}}}, + {MMIOReg, "[B]WIN0V", 0x04001044, 2, 2, {{"Y2",0,8},{"Y1",8,8}}}, + {MMIOReg, "[B]WIN1V", 0x04001046, 2, 2, {{"Y2",0,8},{"Y1",8,8}}}, + {MMIOReg, "[B]WININ", 0x04001048, 2, 12, {{"Enable WIN0 on BG0",0,1},{"Enable WIN0 on BG1",1,1},{"Enable WIN0 on BG2",2,1},{"Enable WIN0 on BG3",3,1}, + {"Enable WIN0 on OBJ",4,1},{"Enable color effect on WIN0",5,1},{"Enable WIN1 on BG0",8,1},{"Enable WIN1 on BG1",9,1}, + {"Enable WIN1 on BG2",10,1},{"Enable WIN1 on BG3",11,1},{"Enable WIN1 on OBJ",12,1},{"Enable color effect on WIN1",13,1}}}, + {MMIOReg, "[B]WINOUT", 0x04001048, 2, 12, {{"Enable win. out. on BG0",0,1},{"Enable win. out. on BG1",1,1},{"Enable win. out. on BG2",2,1},{"Enable win. out. on BG3",3,1}, + {"Enable win. out. on OBJ",4,1},{"Enable color effect on win. out.",5,1},{"Enable OBJ win. on BG0",8,1},{"Enable OBJ win. on BG1",9,1}, + {"Enable OBJ win. on BG2",10,1},{"Enable OBJ win. on BG3",11,1},{"Enable OBJ win. on OBJ",12,1},{"Enable color effect on OBJ win.",13,1}}}, + {MMIOReg, "[B]MOSAIC", 0x0400104C, 2, 4, {{"BG mosaic width",0,4},{"BG mosaic height",4,4},{"OBJ mosaic width",8,4},{"OBJ mosaic height",12,4}}}, + {MMIOReg, "[B]BLDCNT", 0x04001050, 2, 13, {{"BG0 -> 1st target",0,1},{"BG1 -> 1st target",1,1},{"BG2 -> 1st target",2,1},{"BG3 -> 1st target",3,1}, + {"OBJ -> 1st target",4,1},{"Backdrop -> 1st target",5,1},{"Color effect",6,2},{"BG0 -> 2nd target",8,1}, + {"BG1 -> 2nd target",9,1},{"BG2 -> 2nd target",10,1},{"BG3 -> 2nd target",11,1},{"OBJ -> 2nd target",12,1}, + {"Backdrop -> 2nd target",13,1}}}, + {MMIOReg, "[B]BLDALPHA", 0x04001052, 2, 2, {{"EVA",0,5},{"EVB",8,5}}}, + {MMIOReg, "[B]BLDY", 0x04001054, 2, 1, {{"EVY",0,5}}}, + {MMIOReg, "[B]MASTER_BRIGHT", 0x0400106C, 2, 2, {{"Factor",0,5},{"Mode",14,2}}}, + + {CatBegin, "3D video engine registers", 0, 1, 0, {{0}}}, - {MMIOReg, "GXSTAT", 0x04000600, 4, 12, {{"Box/Pos/Vec-test busy",0,1},{"Box-test result",1,1},{"Pos&Vec mtx stack level",8,5},{"Proj mtx stack level",13,1}, - {"Mtx stack busy",14,1},{"Mtx stack over/under-flow",15,1},{"GX FIFO level",16,9},{"GX FIFO full",24,1}, - {"GX FIFO less than half full",25,1},{"GX FIFO empty",26,1},{"GX busy",27,1},{"GX FIFO IRQ condition",30,2}}}, + {MMIOReg, "GXSTAT", 0x04000600, 4, 12, {{"Box/Pos/Vec-test busy",0,1},{"Box-test result",1,1},{"Pos&Vec mtx stack level",8,5},{"Proj mtx stack level",13,1}, + {"Mtx stack busy",14,1},{"Mtx stack over/under-flow",15,1},{"GX FIFO level",16,9},{"GX FIFO full",24,1}, + {"GX FIFO less than half full",25,1},{"GX FIFO empty",26,1},{"GX busy",27,1},{"GX FIFO IRQ condition",30,2}}}, + {CatBegin, "IPC registers", 0, 2, 0, {{0}}}, - {MMIOReg, "IPCSYNC", 0x04000180, 2, 3, {{"Data input from remote",0,4},{"Data output to remote",8,4},{"Enable IRQ from remote",14,1}}}, - {MMIOReg, "IPCFIFOCNT", 0x04000184, 2, 8, {{"Send FIFO empty",0,1},{"Send FIFO full",1,1},{"Enable send FIFO empty IRQ",2,1},{"Recv FIFO empty",8,1}, - {"Recv FIFO full",9,1},{"Enable recv FIFO not empty IRQ",10,1},{"Recv empty/Send full",14,1},{"Enable send/recv FIFO",15,1}}}, + {MMIOReg, "IPCSYNC", 0x04000180, 2, 3, {{"Data input from remote",0,4},{"Data output to remote",8,4},{"Enable IRQ from remote",14,1}}}, + {MMIOReg, "IPCFIFOCNT", 0x04000184, 2, 8, {{"Send FIFO empty",0,1},{"Send FIFO full",1,1},{"Enable send FIFO empty IRQ",2,1},{"Recv FIFO empty",8,1}, + {"Recv FIFO full",9,1},{"Enable recv FIFO not empty IRQ",10,1},{"Recv empty/Send full",14,1},{"Enable send/recv FIFO",15,1}}}, + {CatBegin, "IRQ control registers", 0, 3, 0, {{0}}}, - {MMIOReg, "IME", 0x04000208, 2, 1, {{"Enable IRQs",0,1}}}, - {MMIOReg, "IE", 0x04000210, 4, 19, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, - {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"DMA 0",8,1}, - {"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1},{"Keypad",12,1}, - {"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1},{"IPC recv FIFO not empty",18,1}, - {"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"GX FIFO",21,1}}}, - {MMIOReg, "IF", 0x04000214, 4, 19, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, - {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"DMA 0",8,1}, - {"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1},{"Keypad",12,1}, - {"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1},{"IPC recv FIFO not empty",18,1}, - {"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"GX FIFO",21,1}}}, + {MMIOReg, "IME", 0x04000208, 2, 1, {{"Enable IRQs",0,1}}}, + {MMIOReg, "IE", 0x04000210, 4, 19, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, + {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"DMA 0",8,1}, + {"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1},{"Keypad",12,1}, + {"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1},{"IPC recv FIFO not empty",18,1}, + {"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"GX FIFO",21,1}}}, + {MMIOReg, "IF", 0x04000214, 4, 19, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, + {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"DMA 0",8,1}, + {"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1},{"Keypad",12,1}, + {"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1},{"IPC recv FIFO not empty",18,1}, + {"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"GX FIFO",21,1}}}, {ListEnd, 0, 0, 0, 0, {{0}}} }; @@ -106,25 +206,27 @@ IOReg IORegs9[] = { IOReg IORegs7[] = { {AllRegs, "All registers", 0, 5, 0, {{0}}}, + {CatBegin, "IPC registers", 0, 2, 0, {{0}}}, - {MMIOReg, "IPCSYNC", 0x04000180, 2, 3, {{"Data input from remote",0,4},{"Data output to remote",8,4},{"Enable IRQ from remote",14,1}}}, - {MMIOReg, "IPCFIFOCNT", 0x04000184, 2, 8, {{"Send FIFO empty",0,1},{"Send FIFO full",1,1},{"Enable send FIFO empty IRQ",2,1},{"Recv FIFO empty",8,1}, - {"Recv FIFO full",9,1},{"Enable recv FIFO not empty IRQ",10,1},{"Recv empty/Send full",14,1},{"Enable send/recv FIFO",15,1}}}, + {MMIOReg, "IPCSYNC", 0x04000180, 2, 3, {{"Data input from remote",0,4},{"Data output to remote",8,4},{"Enable IRQ from remote",14,1}}}, + {MMIOReg, "IPCFIFOCNT", 0x04000184, 2, 8, {{"Send FIFO empty",0,1},{"Send FIFO full",1,1},{"Enable send FIFO empty IRQ",2,1},{"Recv FIFO empty",8,1}, + {"Recv FIFO full",9,1},{"Enable recv FIFO not empty IRQ",10,1},{"Recv empty/Send full",14,1},{"Enable send/recv FIFO",15,1}}}, + {CatBegin, "IRQ control registers", 0, 3, 0, {{0}}}, - {MMIOReg, "IME", 0x04000208, 2, 1, {{"Enable IRQs",0,1}}}, - {MMIOReg, "IE", 0x04000210, 4, 22, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, - {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"RTC",7,1}, - {"DMA 0",8,1},{"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1}, - {"Keypad",12,1},{"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1}, - {"IPC recv FIFO not empty",18,1},{"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"Lid opened",22,1}, - {"SPI bus",23,1},{"Wifi",24,1}}}, - {MMIOReg, "IF", 0x04000214, 4, 22, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, - {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"RTC",7,1}, - {"DMA 0",8,1},{"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1}, - {"Keypad",12,1},{"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1}, - {"IPC recv FIFO not empty",18,1},{"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"Lid opened",22,1}, - {"SPI bus",23,1},{"Wifi",24,1}}}, + {MMIOReg, "IME", 0x04000208, 2, 1, {{"Enable IRQs",0,1}}}, + {MMIOReg, "IE", 0x04000210, 4, 22, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, + {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"RTC",7,1}, + {"DMA 0",8,1},{"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1}, + {"Keypad",12,1},{"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1}, + {"IPC recv FIFO not empty",18,1},{"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"Lid opened",22,1}, + {"SPI bus",23,1},{"Wifi",24,1}}}, + {MMIOReg, "IF", 0x04000214, 4, 22, {{"VBlank",0,1},{"HBlank",1,1},{"VCount match",2,1},{"Timer 0",3,1}, + {"Timer 1",4,1},{"Timer 2",5,1},{"Timer 3",6,1},{"RTC",7,1}, + {"DMA 0",8,1},{"DMA 1",9,1},{"DMA 2",10,1},{"DMA 3",11,1}, + {"Keypad",12,1},{"Game Pak",13,1},{"IPC sync",16,1},{"IPC send FIFO empty",17,1}, + {"IPC recv FIFO not empty",18,1},{"Gamecard transfer",19,1},{"Gamecard IREQ_MC",20,1},{"Lid opened",22,1}, + {"SPI bus",23,1},{"Wifi",24,1}}}, {ListEnd, 0, 0, 0, 0, {{0}}} }; @@ -193,6 +295,14 @@ void CIORegView::ChangeReg(int reg) else numlines = 3 + _reg.numBitfields; + UpdateScrollbar(); + SendMessage(hRegCombo, CB_SETCURSEL, Reg, 0); +} + +/*--------------------------------------------------------------------------*/ + +void CIORegView::UpdateScrollbar() +{ if (maxlines < numlines) { RECT rc; @@ -218,9 +328,10 @@ void CIORegView::ChangeReg(int reg) } } else + { EnableWindow(hScrollbar, FALSE); - - SendMessage(hRegCombo, CB_SETCURSEL, Reg, 0); + yoff = 0; + } } /*--------------------------------------------------------------------------*/ @@ -517,7 +628,6 @@ LRESULT CALLBACK IORegView_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_SIZE: { RECT rc; - int wndHeight, lineHeight; // Resize and reposition the controls SetWindowPos(wnd->hRebar, NULL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, SWP_NOZORDER | SWP_NOMOVE); @@ -529,32 +639,9 @@ LRESULT CALLBACK IORegView_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(wnd->hRebar, RB_SETBANDWIDTH, 0, 60); GetClientRect(hWnd, &rc); - wndHeight = rc.bottom - wnd->rebarHeight; - wnd->maxlines = wndHeight / wnd->lineheight; - - if (wnd->maxlines < wnd->numlines) - { - BOOL oldenable = IsWindowEnabled(wnd->hScrollbar); - int range = (wnd->numlines * wnd->lineheight) - wndHeight; - - if (!oldenable) - { - EnableWindow(wnd->hScrollbar, TRUE); - SendMessage(wnd->hScrollbar, SBM_SETRANGE, 0, range); - SendMessage(wnd->hScrollbar, SBM_SETPOS, 0, TRUE); - wnd->yoff = 0; - } - else - { - int pos = min(range, (int)SendMessage(wnd->hScrollbar, SBM_GETPOS, 0, 0)); - SendMessage(wnd->hScrollbar, SBM_SETRANGE, 0, range); - SendMessage(wnd->hScrollbar, SBM_SETPOS, pos, TRUE); - wnd->yoff = -pos; - } - } - else - EnableWindow(wnd->hScrollbar, FALSE); + wnd->maxlines = (rc.bottom - wnd->rebarHeight) / wnd->lineheight; + wnd->UpdateScrollbar(); wnd->Refresh(); } return 0; diff --git a/desmume/src/windows/IORegView.h b/desmume/src/windows/IORegView.h index 62d4cab68..49a93008e 100644 --- a/desmume/src/windows/IORegView.h +++ b/desmume/src/windows/IORegView.h @@ -35,6 +35,8 @@ public: void ChangeCPU(int cpu); void ChangeReg(int reg); + void UpdateScrollbar(); + int CPU; int Reg;