palette viewer :)
This commit is contained in:
parent
4e98173b06
commit
71f9ef2fe6
|
@ -32,7 +32,7 @@ static void display_current_reg();
|
|||
|
||||
/* update */
|
||||
|
||||
void wtools_1_update () {
|
||||
static void wtools_1_update () {
|
||||
display_current_reg();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static void initialize();
|
|||
|
||||
/* update */
|
||||
|
||||
void wtools_2_update() {
|
||||
static void wtools_2_update() {
|
||||
int i,j, x,y=5;
|
||||
int px = w/78, qx;
|
||||
u8 m8, *mem8 =mem; u16 m16, *mem16=(u16*)mem; u32 m32, *mem32=(u32*)mem;
|
||||
|
|
|
@ -22,53 +22,85 @@
|
|||
#include "callbacks_dtools.h"
|
||||
|
||||
static u16* base_addr[20];
|
||||
|
||||
static BOOL init=FALSE;
|
||||
static int palnum=0;
|
||||
static int palindex=0;
|
||||
static void refresh();
|
||||
static GtkWidget * wPaint;
|
||||
|
||||
static void wtools_3_update() {
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
static void refresh() {
|
||||
int x,y,X,Y; u16 * addr = base_addr[palindex];
|
||||
COLOR c; COLOR32 c32;
|
||||
|
||||
GdkGC * GC = gdk_gc_new(wPaint->window);
|
||||
|
||||
for(y=Y= 0; y < 16; y++,Y+=16)
|
||||
for(x=X= 0; x < 16; x++,X+=16)
|
||||
{
|
||||
if (addr) {
|
||||
c.val = *(addr+Y+x+0x100*palnum);
|
||||
COLOR_16_32(c,c32)
|
||||
gdk_rgb_gc_set_foreground(GC, c32.val);
|
||||
gdk_draw_rectangle(wPaint->window, GC, TRUE, X, Y, 15, 15);
|
||||
} else {
|
||||
gdk_rgb_gc_set_foreground(GC, 0x808080);
|
||||
gdk_draw_rectangle(wPaint->window, GC, TRUE, X, Y, 15, 15);
|
||||
gdk_rgb_gc_set_foreground(GC, 0xFF0000);
|
||||
gdk_draw_line(wPaint->window, GC, X+14, Y+1, X+1, Y+14);
|
||||
gdk_draw_line(wPaint->window, GC, X+1, Y+1, X+14, Y+14);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
g_object_unref(GC);
|
||||
}
|
||||
|
||||
|
||||
static void initialize() {
|
||||
GtkComboBox * combo;
|
||||
GtkTreeIter iter;
|
||||
|
||||
GtkTreeIter iter, *parent=NULL;
|
||||
GtkListStore* model;
|
||||
int i=0;
|
||||
if (init) return;
|
||||
|
||||
combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_3_palette");
|
||||
#define DO(str,addr) gtk_combo_box_append_text(combo,str); base_addr[i]=(u16*)(addr); i++;
|
||||
DO("Main screen BG PAL", ARM9Mem.ARM9_VMEM)
|
||||
DO("Main screen SPR PAL", ARM9Mem.ARM9_VMEM + 0x100)
|
||||
DO("Sub screen BG PAL", ARM9Mem.ARM9_VMEM + 0x200)
|
||||
DO("Sub screen SPR PAL", ARM9Mem.ARM9_VMEM + 0x300)
|
||||
DO("Main screen ExtPAL 0", ARM9Mem.ExtPal[0][0])
|
||||
DO("Main screen ExtPAL 1", ARM9Mem.ExtPal[0][1])
|
||||
DO("Main screen ExtPAL 2", ARM9Mem.ExtPal[0][2])
|
||||
DO("Main screen ExtPAL 3", ARM9Mem.ExtPal[0][3])
|
||||
DO("Sub screen ExtPAL 0", ARM9Mem.ExtPal[1][0])
|
||||
DO("Sub screen ExtPAL 1", ARM9Mem.ExtPal[1][1])
|
||||
DO("Sub screen ExtPAL 2", ARM9Mem.ExtPal[1][2])
|
||||
DO("Sub screen ExtPAL 3", ARM9Mem.ExtPal[1][3])
|
||||
DO("Main screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[0][0])
|
||||
DO("Main screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[0][1])
|
||||
DO("Sub screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[1][0])
|
||||
DO("Sub screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[1][1])
|
||||
DO("Texture PAL 0", ARM9Mem.texPalSlot[0])
|
||||
DO("Texture PAL 1", ARM9Mem.texPalSlot[1])
|
||||
DO("Texture PAL 2", ARM9Mem.texPalSlot[2])
|
||||
DO("Texture PAL 3", ARM9Mem.texPalSlot[3])
|
||||
model = (GtkListStore*)gtk_combo_box_get_model(combo);
|
||||
wPaint= glade_xml_get_widget(xml_tools, "wtools_3_draw");
|
||||
|
||||
#define DO(str,addr,r) \
|
||||
gtk_list_store_append (model, &iter); \
|
||||
gtk_list_store_set (model, &iter, 0, str,-1); \
|
||||
base_addr[i]=((u16*)(addr) r); i++;
|
||||
|
||||
DO("Main screen BG PAL", ARM9Mem.ARM9_VMEM,)
|
||||
DO("Main screen SPR PAL", ARM9Mem.ARM9_VMEM,+0x100)
|
||||
DO("Sub screen BG PAL", ARM9Mem.ARM9_VMEM,+0x200)
|
||||
DO("Sub screen SPR PAL", ARM9Mem.ARM9_VMEM,+0x300)
|
||||
DO("Main screen ExtPAL 0", ARM9Mem.ExtPal[0][0],)
|
||||
DO("Main screen ExtPAL 1", ARM9Mem.ExtPal[0][1],)
|
||||
DO("Main screen ExtPAL 2", ARM9Mem.ExtPal[0][2],)
|
||||
DO("Main screen ExtPAL 3", ARM9Mem.ExtPal[0][3],)
|
||||
DO("Sub screen ExtPAL 0", ARM9Mem.ExtPal[1][0],)
|
||||
DO("Sub screen ExtPAL 1", ARM9Mem.ExtPal[1][1],)
|
||||
DO("Sub screen ExtPAL 2", ARM9Mem.ExtPal[1][2],)
|
||||
DO("Sub screen ExtPAL 3", ARM9Mem.ExtPal[1][3],)
|
||||
DO("Main screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[0][0],)
|
||||
DO("Main screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[0][1],)
|
||||
DO("Sub screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[1][0],)
|
||||
DO("Sub screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[1][1],)
|
||||
DO("Texture PAL 0", ARM9Mem.texPalSlot[0],)
|
||||
DO("Texture PAL 1", ARM9Mem.texPalSlot[1],)
|
||||
DO("Texture PAL 2", ARM9Mem.texPalSlot[2],)
|
||||
DO("Texture PAL 3", ARM9Mem.texPalSlot[3],)
|
||||
#undef DO
|
||||
init=TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
for(y = 0; y < 16; ++y)
|
||||
{
|
||||
for(x = 0; x < 16; ++x)
|
||||
{
|
||||
c = adr[(y<<4)+x+0x100*num];
|
||||
brush = CreateSolidBrush(RGB((c&0x1F)<<3, (c&0x3E0)>>2, (c&0x7C00)>>7)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void on_wtools_3_PalView_show (GtkWidget *widget, gpointer data) {
|
||||
initialize();
|
||||
|
@ -81,8 +113,11 @@ gboolean on_wtools_3_PalView_close (GtkWidget *widget, ...) {
|
|||
|
||||
|
||||
gboolean on_wtools_3_draw_expose_event (GtkWidget * widget, GdkEventExpose *event, gpointer user_data) {
|
||||
refresh();
|
||||
}
|
||||
void on_wtools_3_palette_changed (GtkComboBox *combo, gpointer user_data) {
|
||||
palindex = gtk_combo_box_get_active(combo);
|
||||
refresh();
|
||||
}
|
||||
void on_wtools_3_palnum_value_changed (GtkSpinButton *spin, gpointer user_data) {
|
||||
}
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
*/
|
||||
|
||||
#include "../globals.h"
|
||||
/* update functions */
|
||||
void wtools_1_update();
|
||||
void wtools_2_update();
|
||||
|
||||
|
||||
/* ***** ***** IO REGISTERS ***** ***** */
|
||||
void on_wtools_1_combo_cpu_changed (GtkComboBox *, gpointer );
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<signal name="activate" handler="on_menu_reset_activate" last_modification_time="Mon, 01 Jan 2007 16:40:47 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image61">
|
||||
<widget class="GtkImage" id="image66">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-refresh</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -164,7 +164,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs1_activate" last_modification_time="Mon, 01 Jan 2007 16:40:47 GMT"/>
|
||||
</widget>
|
||||
|
@ -175,7 +175,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">2</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs2_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -186,7 +186,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">3</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs3_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -197,7 +197,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">4</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs4_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -208,7 +208,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">5</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs5_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -219,7 +219,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">6</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs6_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -230,7 +230,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">7</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs7_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -241,7 +241,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">8</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs8_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -252,7 +252,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">9</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">fs0</property>
|
||||
<signal name="activate" handler="on_fs9_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
|
||||
</widget>
|
||||
|
@ -286,7 +286,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">2x</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">size1x</property>
|
||||
<signal name="activate" handler="on_size2x_activate" last_modification_time="Mon, 01 Jan 2007 20:14:20 GMT"/>
|
||||
</widget>
|
||||
|
@ -297,7 +297,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">3x</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">size1x</property>
|
||||
<signal name="activate" handler="on_size3x_activate" last_modification_time="Mon, 01 Jan 2007 20:14:20 GMT"/>
|
||||
</widget>
|
||||
|
@ -328,7 +328,7 @@
|
|||
<signal name="activate" handler="on_menu_controls_activate" last_modification_time="Mon, 01 Jan 2007 16:53:11 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image62">
|
||||
<widget class="GtkImage" id="image67">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -349,7 +349,7 @@
|
|||
<signal name="activate" handler="on_menu_joy_controls_activate" last_modification_time="Fri, 12 Jan 2007 22:26:36 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image63">
|
||||
<widget class="GtkImage" id="image68">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -423,7 +423,7 @@
|
|||
<signal name="activate" handler="on_menu_IO_regs_activate" last_modification_time="Mon, 01 Jan 2007 16:53:11 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image64">
|
||||
<widget class="GtkImage" id="image69">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -444,7 +444,7 @@
|
|||
<signal name="activate" handler="on_menu_memview_activate" last_modification_time="Fri, 12 Jan 2007 15:44:42 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image65">
|
||||
<widget class="GtkImage" id="image70">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -465,7 +465,7 @@
|
|||
<signal name="activate" handler="on_menu_palview_activate" last_modification_time="Sun, 14 Jan 2007 10:34:32 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image66">
|
||||
<widget class="GtkImage" id="image71">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
|
|
@ -909,6 +909,7 @@ ARM7 cpu</property>
|
|||
<child>
|
||||
<widget class="GtkComboBox" id="wtools_3_palette">
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes"></property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="changed" handler="on_wtools_3_palette_changed" last_modification_time="Sun, 14 Jan 2007 09:29:39 GMT"/>
|
||||
|
@ -985,8 +986,8 @@ ARM7 cpu</property>
|
|||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue