added code from Normatt for VRAM A,B,C,D (but commented)

going to add memory viewer for gtk-glade
This commit is contained in:
damdoum 2007-01-12 15:19:06 +00:00
parent c08a996ff2
commit 69ae8304dc
5 changed files with 310 additions and 1 deletions

View File

@ -421,11 +421,13 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
{
GPU * gpu = screen->gpu;
u8 * dst = GPU_screen + (screen->offset + l) * 512;
u8 * mdst = GPU_screen + (MainScreen.offset + l) * 512;
itemsForPriority_t * item;
u8 spr[512];
u8 sprPrio[256];
u8 bgprio,prio;
int i;
int vram_bank;
u8 i8;
u16 i16;
u32 c;
@ -466,7 +468,33 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
}
return;
}
/*
//addition from Normatt
if (gpu->core==0)
for(vram_bank=0; vram_bank<8; vram_bank++) {
switch (MMU.vram_mode[vram_bank])
{
case 0:
case 1:
case 2:
case 3:
{
int ii = l * 256 * 2;
for (i=0; i<(256 * 2); i+=2)
{
u8 * vram = ARM9Mem.ARM9_ABG + MMU.vram_mode[vram_bank] * 0x20000;
T2WriteWord(mdst, i, T1ReadWord(vram, ii));
ii+=2;
}
return;
}
default:
break;
}
}
*/
c = T1ReadWord(ARM9Mem.ARM9_VMEM, gpu->core * 0x400);
c |= (c<<16);

View File

@ -622,6 +622,33 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val)
{
/* TODO: EEEK ! Controls for VRAMs A, B, C, D are missing ! */
/* TODO: Not all mappings of VRAMs are handled... (especially BG and OBJ modes) */
case REG_VRAMCNTA:
case REG_VRAMCNTB:
case REG_VRAMCNTC:
case REG_VRAMCNTD:
if(proc == ARMCPU_ARM9)
{
switch(val & 0x1F)
{
case 1 :
MMU.vram_mode[adr-REG_VRAMCNTA] = 0; // BG-VRAM
//MMU.vram_offset[0] = ARM9Mem.ARM9_ABG+(0x20000*0); // BG-VRAM
break;
case 1 | (1 << 3) :
MMU.vram_mode[adr-REG_VRAMCNTA] = 1; // BG-VRAM
//MMU.vram_offset[0] = ARM9Mem.ARM9_ABG+(0x20000*1); // BG-VRAM
break;
case 1 | (2 << 3) :
MMU.vram_mode[adr-REG_VRAMCNTA] = 2; // BG-VRAM
//MMU.vram_offset[0] = ARM9Mem.ARM9_ABG+(0x20000*2); // BG-VRAM
break;
case 1 | (3 << 3) :
MMU.vram_mode[adr-REG_VRAMCNTA] = 3; // BG-VRAM
//MMU.vram_offset[0] = ARM9Mem.ARM9_ABG+(0x20000*3); // BG-VRAM
break;
}
}
break;
case REG_VRAMCNTE :
if(proc == ARMCPU_ARM9)
{

View File

@ -51,6 +51,8 @@ typedef struct {
u8 ARM7_REG[0x10000];
u8 ARM7_WIRAM[0x10000];
u8 vram_mode[9];
//Shared ram
u8 SWIRAM[0x8000];

View File

@ -43,3 +43,15 @@ void on_wtools_1_r_dispb_win0v_toggled(GtkToggleButton *togglebutton, gpointer u
void on_wtools_1_r_dispb_win1v_toggled(GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_dispb_winin_toggled(GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_dispb_winout_toggled(GtkToggleButton *togglebutton, gpointer user_data);
/* ***** ***** MEMORY VIEWER ***** ***** */
void on_wtools_2_MemView_show (GtkWidget *widget, gpointer user_data);
void on_wtools_2_r8_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_2_r16_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_2_r32_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data);
void on_wtools_2_GotoAddress_changed (GtkEntry *entry, gpointer user_data);
void on_wtools_2_GotoButton_clicked (GtkButton *button, gpointer user_data);
void on_wtools_2_scroll_scroll_child (GtkScrolledWindow *scrolledwindow, GtkScrollType scroll, gboolean horizontal, gpointer user_data);
gboolean on_wtools_2_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data);

View File

@ -370,6 +370,7 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_1_r_dispb_win0h_toggled">
<property name="visible">True</property>
@ -583,4 +584,243 @@ cpu : ARM9</property>
</child>
</widget>
<widget class="GtkDialog" id="wtools_2_MemView">
<property name="title" translatable="yes">memory viewer</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="icon">DeSmuME.xpm</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="gtk_widget_hide" last_modification_time="Fri, 12 Jan 2007 12:58:31 GMT"/>
<signal name="response" handler="gtk_widget_hide" last_modification_time="Fri, 12 Jan 2007 12:58:38 GMT"/>
<signal name="show" handler="on_wtools_2_MemView_show" last_modification_time="Fri, 12 Jan 2007 13:35:53 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="closebutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">6</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkRadioButton" id="wtools_2_r8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">8 bit</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_wtools_2_r8_toggled" last_modification_time="Fri, 12 Jan 2007 13:30:18 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_2_r16">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">16 bit</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">wtools_2_r8</property>
<signal name="toggled" handler="on_wtools_2_r16_toggled" last_modification_time="Fri, 12 Jan 2007 13:30:26 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_2_r32">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">32 bit</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">wtools_2_r8</property>
<signal name="toggled" handler="on_wtools_2_r32_toggled" last_modification_time="Fri, 12 Jan 2007 13:30:34 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes"> GoTo: </property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="wtools_2_GotoAddress">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">10</property>
<property name="text" translatable="yes">0x0000000</property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
<signal name="activate" handler="on_wtools_2_GotoAddress_activate" last_modification_time="Fri, 12 Jan 2007 13:15:12 GMT"/>
<signal name="changed" handler="on_wtools_2_GotoAddress_changed" last_modification_time="Fri, 12 Jan 2007 13:43:06 GMT"/>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="wtools_2_GotoButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Go!</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_wtools_2_GotoButton_clicked" last_modification_time="Fri, 12 Jan 2007 13:15:27 GMT"/>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="wtools_2_scroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<signal name="scroll_child" handler="on_wtools_2_scroll_scroll_child" last_modification_time="Fri, 12 Jan 2007 13:14:01 GMT"/>
<child>
<widget class="GtkDrawingArea" id="wtools_2_draw">
<property name="visible">True</property>
<signal name="expose_event" handler="on_wtools_2_draw_expose_event" last_modification_time="Fri, 12 Jan 2007 13:14:44 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">6</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>