From 24f6a55c4c1604b7dfa43c6e1e1468a060003c14 Mon Sep 17 00:00:00 2001 From: damdoum Date: Thu, 22 Feb 2007 15:04:11 +0000 Subject: [PATCH] some explicit conversions (less warnings) better structure documentation --- desmume/src/GPU.h | 474 +++++++++++------- desmume/src/gtk-glade/callbacks.c | 10 +- desmume/src/gtk-glade/dTools/dTools_display.h | 2 +- desmume/src/gtk-glade/main.c | 4 +- desmume/src/registers.h | 1 - 5 files changed, 308 insertions(+), 183 deletions(-) diff --git a/desmume/src/GPU.h b/desmume/src/GPU.h index 67c36eba1..fbb4716f5 100644 --- a/desmume/src/GPU.h +++ b/desmume/src/GPU.h @@ -1,25 +1,25 @@ /* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com + yopyop156@ifrance.com + yopyop156.ifrance.com - Copyright (C) 2006-2007 Theo Berkau - Copyright (C) 2007 shash + Copyright (C) 2006-2007 Theo Berkau + Copyright (C) 2007 shash - This file is part of DeSmuME + This file is part of DeSmuME - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + DeSmuME is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + DeSmuME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef GPU_H @@ -36,6 +36,261 @@ extern "C" { #endif +/******************************************************************************* + this structure is for display control, + it holds flags for general display +*******************************************************************************/ + +struct _DISPCNT +{ +/*0*/ unsigned BG_Mode:3; // A+B: +/*3*/ unsigned BG0_3D:1; // A : 0=2D, 1=3D +/*4*/ unsigned OBJ_Tile_1D:1; // A+B: 0=2D (32KB), 1=1D (32..256KB) +/*5*/ unsigned OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels +/*6*/ unsigned OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB) + + // 7-15 same as GBA +/*7*/ unsigned ForceBlank:1; // A+B: +/*8*/ unsigned BG0_Enable:1; // A+B: 0=disable, 1=Enable +/*9*/ unsigned BG1_Enable:1; // A+B: 0=disable, 1=Enable +/*10*/ unsigned BG2_Enable:1; // A+B: 0=disable, 1=Enable +/*11*/ unsigned BG3_Enable:1; // A+B: 0=disable, 1=Enable +/*12*/ unsigned OBJ_Enable:1; // A+B: 0=disable, 1=Enable +/*13*/ unsigned Win0_Enable:1; // A+B: 0=disable, 1=Enable +/*14*/ unsigned Win1_Enable:1; // A+B: 0=disable, 1=Enable +/*15*/ unsigned WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable + +/*16*/ unsigned DisplayMode:2; // A+B: coreA(0..3) coreB(0..1) GBA(Green Swap) + // 0=off (white screen) + // 1=on (normal BG & OBJ layers) + // 2=VRAM display (coreA only) + // 3=RAM display (coreA only, DMA transfers) + +/*18*/ unsigned VRAM_Block:2; // A : VRAM block (0..3=A..D) +/*20*/ unsigned OBJ_Tile_1D_Bound:2; // A+B: +/*22*/ unsigned OBJ_BMP_1D_Bound:1; // A : +/*23*/ unsigned OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5) +/*24*/ unsigned CharacBase_Block:3; // A : Character Base (64K step) +/*27*/ unsigned ScreenBase_Block:3; // A : Screen Base (64K step) +/*30*/ unsigned ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette +/*31*/ unsigned ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette +}; + +typedef union +{ + struct _DISPCNT bits; + u32 val; +} DISPCNT; +#define BGxENABLED(cnt,num) ((num<8)? ((cnt.val>>8) & num):0) + + + + +/******************************************************************************* + this structure is for display control of a specific layer, + there are 4 background layers + their priority indicate which one to draw on top of the other + some flags indicate special drawing mode, size, FX +*******************************************************************************/ + +struct _BGxCNT +{ +/* 0*/ unsigned Priority:2; // 0..3=high..low +/* 2*/ unsigned CharacBase_Block:4; // individual character base offset (n*16KB) +/* 6*/ unsigned Mosaic_Enable:1; // 0=disable, 1=Enable mosaic +/* 7*/ unsigned Palette_256:1; // 0=16x16, 1=1*256 palette +/* 8*/ unsigned ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB) +/*13*/ unsigned PaletteSet_Wrap:1; // BG0 extended palette set 0=set0, 1=set2 + // BG1 extended palette set 0=set1, 1=set3 + // BG2 overflow area wraparound 0=off, 1=wrap + // BG3 overflow area wraparound 0=off, 1=wrap +/*14*/ unsigned ScreenSize:2; // text : 256x256 512x256 256x512 512x512 + // x/rot/s : 128x128 256x256 512x512 1024x1024 + // bmp : 128x128 256x256 512x256 512x512 + // large : 512x1024 1024x512 - - +}; + + +typedef union +{ + struct _BGxCNT bits; + u16 val; +} BGxCNT; + +/******************************************************************************* + this structure is for background offset +*******************************************************************************/ + +typedef struct { + u16 BGxHOFS; + u16 BGxVOFS; +} BGxOFS; + +/******************************************************************************* + this structure is for rotoscale parameters +*******************************************************************************/ + +typedef struct { + u16 BGxPA; + u16 BGxPB; + u16 BGxPC; + u16 BGxPD; + u32 BGxX; + u32 BGxY; +} BGxPARMS; + + +/******************************************************************************* + this structure is for windows parameters +*******************************************************************************/ + +typedef struct { + u16 WIN0H; + u16 WIN1H; + u16 WIN0V; + u16 WIN1V; + u16 WININ; + u16 WINOUT; +} WINCNT; + +/******************************************************************************* + this structure is for miscellanous settings +*******************************************************************************/ + +typedef struct { + u16 MOSAIC; + u16 unused1; + u16 BLDCNT; + u16 BLDALPHA; + u16 BLDY; + u16 unused2; + u16 unused3; + u16 unused4; + u16 unused5; + u16 unused6; +} MISCCNT; + + +/******************************************************************************* + this structure is for 3D settings +*******************************************************************************/ + +struct _DISP3DCNT +{ +/* 0*/ unsigned EnableTexMapping:1; // +/* 1*/ unsigned PolygonShading:1; // 0=Toon Shading, 1=Highlight Shading +/* 2*/ unsigned EnableAlphaTest:1; // see ALPHA_TEST_REF +/* 3*/ unsigned EnableAlphaBlending:1; // see various Alpha values +/* 4*/ unsigned EnableAntiAliasing:1; // +/* 5*/ unsigned EnableEdgeMarking:1; // see EDGE_COLOR +/* 6*/ unsigned FogOnlyAlpha:1; // 0=Alpha and Color, 1=Only Alpha (see FOG_COLOR) +/* 7*/ unsigned EnableFog:1; // Fog Master Enable +/* 8*/ unsigned FogShiftSHR:4; // 0..10 SHR-Divider (see FOG_OFFSET) +/*12*/ unsigned AckColorBufferUnderflow:1; // Color Buffer RDLINES Underflow (0=None, 1=Underflow/Acknowledge) +/*13*/ unsigned AckVertexRAMOverflow:1; // Polygon/Vertex RAM Overflow (0=None, 1=Overflow/Acknowledge) +/*14*/ unsigned RearPlaneMode:1; // 0=Blank, 1=Bitmap +/*15*/ unsigned :17; +}; + +typedef union +{ + struct _DISP3DCNT bits; + u32 val; +} DISP3DCNT; + +/******************************************************************************* + this structure is for capture control (core A only) + + source: + http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode +*******************************************************************************/ + +struct _DISPCAPCNT +{ +/* 0*/ unsigned BlendFactor_A:5; // 0..16 = Blending Factor for Source A +/* 5*/ unsigned :3; // +/* 8*/ unsigned BlendFactor_B:5; // 0..16 = Blending Factor for Source B +/*13*/ unsigned :3; // +/*16*/ unsigned VRAM_Write_Block:2; // 0..3 = VRAM A..D +/*18*/ unsigned VRAM_Write_Offset:2; // n x 0x08000 +/*20*/ unsigned Capture_Size:2; // 0=128x128, 1=256x64, 2=256x128, 3=256x192 dots +/*22*/ unsigned :2; // +/*24*/ unsigned Source_A:1; // 0=Graphics Screen BG+3D+OBJ, 1=3D Screen +/*25*/ unsigned Source_B:1; // 0=VRAM, 1=Main Memory Display FIFO +/*26*/ unsigned VRAM_Read_Offset:2; // n x 0x08000 +/*28*/ unsigned :1; // +/*29*/ unsigned Capture_Source:2; // 0=Source A, 1=Source B, 2/3=Sources A+B blended +/*31*/ unsigned Capture_Enable:1; // 0=Disable/Ready, 1=Enable/Busy +}; + +typedef union +{ + struct _DISPCAPCNT bits; + u32 val; +} DISPCAPCNT; + + + +/******************************************************************************* + this structure is to represent global FX + applied to each pixel (each color of x555 is expanded to 6 bits) + + Lighten : New = Old + (63-Old) * Factor/16 + Darken : New = Old - Old * Factor/16 +*******************************************************************************/ + +struct _MASTER_BRIGHT +{ +/* 0*/ unsigned Factor:4; // combine with (Factor / 16) of white/black +/* 4*/ unsigned FactorEx:1; // if true use white or black +/* 5*/ unsigned :9; +/*14*/ unsigned Mode:2; // 0=off, 1=Lighten, 2=Darken, 3=? +}; + +typedef union +{ + struct _MASTER_BRIGHT bits; + u16 val; +} MASTER_BRIGHT; + +/******************************************************************************* + this structure holds everything and should be mapped to + * core A : 0x04000000 + * core B : 0x04001000 +*******************************************************************************/ + +typedef struct _reg_dispx { + DISPCNT dispx_DISPCNT; // 0x0400x000 + u16 dispA_DISPSTAT; // 0x04000004 + u16 dispx_VCOUNT; // 0x0400x006 + BGxCNT dispx_BG0CNT; // 0x0400x008 + BGxCNT dispx_BG1CNT; // 0x0400x00A + BGxCNT dispx_BG2CNT; // 0x0400x00C + BGxCNT dispx_BG3CNT; // 0x0400x00E + BGxOFS dispx_BG0OFS; // 0x0400x010 + BGxOFS dispx_BG1OFS; // 0x0400x014 + BGxOFS dispx_BG2OFS; // 0x0400x018 + BGxOFS dispx_BG3OFS; // 0x0400x01C + BGxPARMS dispx_BG2PARMS; // 0x0400x020 + BGxPARMS dispx_BG3PARMS; // 0x0400x030 + WINCNT dispx_WINCNT; // 0x0400x040 + MISCCNT dispx_MISC; // 0x0400x04C + DISP3DCNT dispA_DISP3DCNT; // 0x04000060 + DISPCAPCNT dispA_DISPCAPCNT; // 0x04000064 + u32 dispA_DISPMMEMFIFO; // 0x04000068 + MASTER_BRIGHT dispx_MASTERBRIGHT; // 0x0400x06C +} REG_DISPx; + + + + + + + + + + + #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif @@ -54,14 +309,14 @@ void register_gl_fun(fun_gl_Begin beg,fun_gl_End end); #define GPU_SUB 1 /* human readable bitmask names */ -#define ADDRESS_STEP_512B 0x00200 -#define ADDRESS_STEP_1KB 0x00400 -#define ADDRESS_STEP_2KB 0x00800 -#define ADDRESS_STEP_4KB 0x01000 -#define ADDRESS_STEP_8KB 0x02000 -#define ADDRESS_STEP_16KB 0x04000 -#define ADDRESS_STEP_32KB 0x08000 -#define ADDRESS_STEP_64kB 0x10000 +#define ADDRESS_STEP_512B 0x00200 +#define ADDRESS_STEP_1KB 0x00400 +#define ADDRESS_STEP_2KB 0x00800 +#define ADDRESS_STEP_4KB 0x01000 +#define ADDRESS_STEP_8KB 0x02000 +#define ADDRESS_STEP_16KB 0x04000 +#define ADDRESS_STEP_32KB 0x08000 +#define ADDRESS_STEP_64kB 0x10000 struct _TILEENTRY { @@ -88,83 +343,11 @@ typedef union s32 val; } ROTOCOORD; -/* - this structure is for display control, - it holds flags for general display -*/ - -struct _DISPCNT -{ -/*0*/ unsigned BG_Mode:3; // A+B: -/*3*/ unsigned BG0_3D:1; // A : 0=2D, 1=3D -/*4*/ unsigned OBJ_Tile_1D:1; // A+B: 0=2D (32KB), 1=1D (32..256KB) -/*5*/ unsigned OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels -/*6*/ unsigned OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB) - -// 7-15 same as GBA -/*7*/ unsigned ForceBlank:1; // A+B: -/*8*/ unsigned BG0_Enable:1; // A+B: 0=disable, 1=Enable -/*9*/ unsigned BG1_Enable:1; // A+B: 0=disable, 1=Enable -/*10*/ unsigned BG2_Enable:1; // A+B: 0=disable, 1=Enable -/*11*/ unsigned BG3_Enable:1; // A+B: 0=disable, 1=Enable -/*12*/ unsigned OBJ_Enable:1; // A+B: 0=disable, 1=Enable -/*13*/ unsigned Win0_Enable:1; // A+B: 0=disable, 1=Enable -/*14*/ unsigned Win1_Enable:1; // A+B: 0=disable, 1=Enable -/*15*/ unsigned WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable - -/*16*/ unsigned DisplayMode:2; // A+B: coreA(0..3) coreB(0..1) GBA(Green Swap) - // 0=off (white screen) - // 1=on (normal BG & OBJ layers) - // 2=VRAM display (coreA only) - // 3=RAM display (coreA only, DMA transfers) - -/*18*/ unsigned VRAM_Block:2; // A : VRAM block (0..3=A..D) -/*20*/ unsigned OBJ_Tile_1D_Bound:2; // A+B: -/*22*/ unsigned OBJ_BMP_1D_Bound:1; // A : -/*23*/ unsigned OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5) -/*24*/ unsigned CharacBase_Block:3; // A : Character Base (64K step) -/*27*/ unsigned ScreenBase_Block:3; // A : Screen Base (64K step) -/*30*/ unsigned ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette -/*31*/ unsigned ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette -}; - -typedef union -{ - struct _DISPCNT bits; - u32 val; -} DISPCNT; -#define BGxENABLED(cnt,num) ((num<8)? ((cnt.val>>8) & num):0) - -// source: -// http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode -struct _DISPCAPCNT -{ -/* 0*/ unsigned BlendFactor_A:5; // 0..16 = Blending Factor for Source A -/* 5*/ unsigned :3; // -/* 8*/ unsigned BlendFactor_B:5; // 0..16 = Blending Factor for Source B -/*13*/ unsigned :3; // -/*16*/ unsigned VRAM_Write_Block:2; // 0..3 = VRAM A..D -/*18*/ unsigned VRAM_Write_Offset:2; // n x 0x08000 -/*20*/ unsigned Capture_Size:2; // 0=128x128, 1=256x64, 2=256x128, 3=256x192 dots -/*22*/ unsigned :2; // -/*24*/ unsigned Source_A:1; // 0=Graphics Screen BG+3D+OBJ, 1=3D Screen -/*25*/ unsigned Source_B:1; // 0=VRAM, 1=Main Memory Display FIFO -/*26*/ unsigned VRAM_Read_Offset:2; // n x 0x08000 -/*28*/ unsigned :1; // -/*29*/ unsigned Capture_Source:2; // 0=Source A, 1=Source B, 2/3=Sources A+B blended -/*31*/ unsigned Capture_Enable:1; // 0=Disable/Ready, 1=Enable/Busy -}; -typedef union -{ - struct _DISPCAPCNT bits; - u32 val; -} DISPCAPCNT; - /* this structure is for color representation, it holds 5 meaningful bits per color channel (red,green,blue) - and 1 meaningful bit for alpha representation + and 1 meaningful bit for alpha representation this bit can be unused or used for special FX */ @@ -213,63 +396,6 @@ typedef union -/* - this structure is for display control of a specific layer, - there are 4 background layers - their priority indicate which one to draw on top of the other - some flags indicate special drawing mode, size, FX -*/ - - -struct _BGxCNT -{ -/*0*/ unsigned Priority:2; // 0..3=high..low -/*2*/ unsigned CharacBase_Block:4; // individual character base offset (n*16KB) -/*6*/ unsigned Mosaic_Enable:1; // 0=disable, 1=Enable mosaic -/*7*/ unsigned Palette_256:1; // 0=16x16, 1=1*256 palette -/*8*/ unsigned ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB) -/*13*/ unsigned PaletteSet_Wrap:1; // BG0 extended palette set 0=set0, 1=set2 - // BG1 extended palette set 0=set1, 1=set3 - // BG2 overflow area wraparound 0=off, 1=wrap - // BG3 overflow area wraparound 0=off, 1=wrap -/*14*/ unsigned ScreenSize:2; // text : 256x256 512x256 256x512 512x512 - // x/rot/s : 128x128 256x256 512x512 1024x1024 - // bmp : 128x128 256x256 512x256 512x512 - // large : 512x1024 1024x512 - - -}; - - -typedef union -{ - struct _BGxCNT bits; - u16 val; -} BGxCNT; - -/* - this structure is to represent global FX - applied to a pixel - - Factor (5bits values 0-16, values >16 same as 16) -// damdoum : then the 4th bit use is questionnable ? - - Lighten : New = Old + (63-Old) * Factor/16 - Darken : New = Old - Old * Factor/16 -*/ - -struct _MASTER_BRIGHT -{ -/*0*/ unsigned Factor:4; // brightnessFactor = Factor | FactorEx << 4 -/*4*/ unsigned FactorEx:1; // -/*5*/ unsigned :9; -/*14*/ unsigned Mode:2; // 0=off, 1=Lighten, 2=Darken, 3=? -}; - -typedef union -{ - struct _MASTER_BRIGHT bits; - u16 val; -} MASTER_BRIGHT; - /* @@ -282,20 +408,20 @@ ref: http://www.bottledlight.com/ds/index.php/Video/Sprites typedef struct { // attr0 -/*0*/ unsigned Y:8; -/*8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale) -/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap) +/* 0*/ unsigned Y:8; +/* 8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale) +/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap) /*12*/ unsigned Mosaic:1; // (1: Enabled) -/*13*/ unsigned Depth:1; // (0: 16, 1: 256) -/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal) +/*13*/ unsigned Depth:1; // (0: 16, 1: 256) +/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal) // attr1 -/*0*/ signed X:9; -/*9*/ unsigned RotScalIndex:3; // Rot/scale matrix index +/* 0*/ signed X:9; +/* 9*/ unsigned RotScalIndex:3; // Rot/scale matrix index /*12*/ unsigned HFlip:1; /*13*/ unsigned VFlip:1; /*14*/ unsigned Size:2; // attr2 -/*0*/ unsigned TileIndex:10; +/* 0*/ unsigned TileIndex:10; /*10*/ unsigned Priority:2; /*12*/ unsigned PaletteIndex:4; // attr3 @@ -304,18 +430,18 @@ typedef struct typedef struct { - u16 attr0; - u16 attr1; - u16 attr2; - u16 attr3; + u16 attr0; + u16 attr1; + u16 attr2; + u16 attr3; } OAM; typedef struct { - s16 x; - s16 y; + s16 x; + s16 y; } size; @@ -327,8 +453,8 @@ typedef struct screen | +-- Window0/Window1/OBJwindow/OutOfWindows - | - +-- BG0/BG1/BG2/BG3/OBJ + | + +-- BG0/BG1/BG2/BG3/OBJ */ typedef union windowdim_t @@ -492,10 +618,10 @@ extern MMU_struct MMU; -#define GFXCORE_DEFAULT -1 -#define GFXCORE_DUMMY 0 +#define GFXCORE_DEFAULT -1 +#define GFXCORE_DUMMY 0 -#define GFXCORE_FULLSCREEN (1 << 0) +#define GFXCORE_FULLSCREEN (1 << 0) typedef struct { @@ -529,7 +655,7 @@ void GPU_setX(GPU *, u8 num, u32 v); void GPU_setY(GPU *, u8 num, u32 v); void GPU_setPAPB(GPU *, u8 num, u32 v); void GPU_setPCPD(GPU *, u8 num, u32 v); - + void GPU_setBLDCNT(GPU *gpu, u16 v) ; void GPU_setBLDALPHA(GPU *gpu, u16 v) ; void GPU_setBLDY(GPU *gpu, u16 v) ; diff --git a/desmume/src/gtk-glade/callbacks.c b/desmume/src/gtk-glade/callbacks.c index 9ae490b19..cb10da5c0 100755 --- a/desmume/src/gtk-glade/callbacks.c +++ b/desmume/src/gtk-glade/callbacks.c @@ -126,12 +126,12 @@ void file_open() { break; default: break; - } + } gtk_widget_destroy(pFileSelection); } void on_menu_ouvrir_activate (GtkMenuItem *menuitem, gpointer user_data) { file_open();} -void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { WriteBMP("./test.bmp",GPU_screen); } +void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { WriteBMP("./test.bmp",(u16*)GPU_screen); } void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); } @@ -293,8 +293,8 @@ user_data) text = "Can't configure joystick while the game is running!"; dlg = (GtkDialog*)glade_xml_get_widget(xml, "wMainW"); - msgbox = - gtk_message_dialog_new(dlg, + msgbox = (GtkDialog*) + gtk_message_dialog_new((GtkWindow*)dlg, GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, @@ -367,7 +367,7 @@ void on_menu_wtoolsXX_activate (GtkMenuItem *menuitem, gpointer user_data) /* About dialog FIXME: Add proper copyright */ void on_menu_apropos_activate (GtkMenuItem *menuitem, gpointer user_data) { - GtkAboutDialog * wAbout = (GtkAboutDialog*)glade_xml_get_widget(xml, "wAboutDlg"); + GtkWidget * wAbout = glade_xml_get_widget(xml, "wAboutDlg"); gtk_widget_show(wAbout); } diff --git a/desmume/src/gtk-glade/dTools/dTools_display.h b/desmume/src/gtk-glade/dTools/dTools_display.h index 8d896bb46..511e3d886 100755 --- a/desmume/src/gtk-glade/dTools/dTools_display.h +++ b/desmume/src/gtk-glade/dTools/dTools_display.h @@ -99,7 +99,7 @@ static void inline dTools_display_select_attr(dTools_dsp * dsp, int index) { pango_layout_set_attributes(dsp->playout, dsp->curr_attr); } -static void inline dTools_display_draw_text(dTools_dsp * dsp, int x, int y, char * txt) { +static void inline dTools_display_draw_text(dTools_dsp * dsp, int x, int y, const char * txt) { pango_layout_set_text(dsp->playout, txt, -1); gdk_draw_layout(dsp->draw, dsp->gc_fg, x * dsp->char_w + dsp->padding, diff --git a/desmume/src/gtk-glade/main.c b/desmume/src/gtk-glade/main.c index 6e55ce2cc..7be5139f4 100755 --- a/desmume/src/gtk-glade/main.c +++ b/desmume/src/gtk-glade/main.c @@ -54,7 +54,7 @@ void notify_Tool (VoidFunPtr fun, gpointer func_data) { } void notify_Tools() { - g_list_foreach(tools_to_update, ¬ify_Tool, NULL); + g_list_foreach(tools_to_update, (GFunc)notify_Tool, NULL); } /* Return the glade directory. @@ -149,7 +149,7 @@ void set_menuitem_label(GtkWidget * w, char * text ) if ( GTK_BIN(w)->child ) { - child = GTK_BIN(w)->child; + child = (GtkLabel*)GTK_BIN(w)->child; gtk_label_set_text(child, text); } } diff --git a/desmume/src/registers.h b/desmume/src/registers.h index 1dd7fa05c..f8242412a 100644 --- a/desmume/src/registers.h +++ b/desmume/src/registers.h @@ -289,4 +289,3 @@ #define cmd_3D_VEC_TEST 0x040005C8 #endif -