Thread: [Desmume-cvs] SF.net SVN: desmume:[1254] trunk/desmume/src (Page 2) (2024)

Thread: [Desmume-cvs] SF.net SVN: desmume:[1254] trunk/desmume/src (Page 2) (5)

DeSmuME is a Nintendo DS emulator

Status: Beta

Brought to you by:mtabachenko,yabause,zeromus

  • Summary
  • Files
  • Reviews
  • Support
  • Wiki
  • Mailing Lists
  • Tickets ▾
    • Bugs
    • Feature Requests
    • Support Requests
    • Patches
    • Rubbish Bin
  • News
  • Code-moved-to-github

Menu▾▴

  • desmume-cvs

desmume-cvs

[Desmume-cvs] SF.net SVN: desmume:[1254] trunk/desmume/src

From: <ze...@us...> - 2008-12-27 03:49:21

Revision: 1254 Author: zeromusDate: 2008-12-27 03:49:18 +0000 (Sat, 27 Dec 2008)Log Message:-----------minor optimizations to gpu and gfx3d:- sprwin was too big (256x256 instead of 256x192)- line render buffer initializer was a per pixel loop instead of a 256 wide memsetModified Paths:-------------- trunk/desmume/src/GPU.cpp trunk/desmume/src/GPU.h trunk/desmume/src/gfx3d.cppModified: trunk/desmume/src/GPU.cpp===================================================================--- trunk/desmume/src/GPU.cpp2008-12-27 02:42:54 UTC (rev 1253)+++ trunk/desmume/src/GPU.cpp2008-12-27 03:49:18 UTC (rev 1254)@@ -50,10 +50,10 @@ #include "debug.h" #include "render3D.h" #include "GPU_osd.h"-#include "debug.h"--//#define CHECKSPRITES-+#include "debug.h"++//#define CHECKSPRITES+ #ifdef CHECKSPRITES #define CHECK_SPRITE(type) \ if (!src) {\@@ -67,8 +67,8 @@ #else #define CHECK_SPRITE(type) if (!src) { continue; }; #endif- + ARM9_struct ARM9Mem; extern BOOL click;@@ -235,7 +235,7 @@ struct _DISPCNT * cnt = &gpu->dispx_st->dispx_DISPCNT.bits; itemsForPriority_t * item; -memset(gpu->sprWin,0, 256*256);+memset(gpu->sprWin,0, 256*192); // we don't need to check for windows here... // if we tick boxes, invisible layers become invisible & vice versa@@ -2039,7 +2039,7 @@ case 2: gpu->dispCapCnt.capx = 256; gpu->dispCapCnt.capy = 128;-break;+break; case 3: gpu->dispCapCnt.capx = 256; gpu->dispCapCnt.capy = 192;@@ -2060,8 +2060,8 @@ // comment this if want to use formulas instead // #define BRIGHT_TABLES--#ifdef BRIGHT_TABLES++#ifdef BRIGHT_TABLES static void calc_bright_colors() { int base = 31 ; int factor;@@ -2094,9 +2094,9 @@ #undef FORMULA_MORE #undef FORMULA_LESS-}-#endif-+}+#endif+ static INLINE void GPU_ligne_layer(NDS_Screen * screen, u16 l) { GPU * gpu = screen->gpu;@@ -2118,11 +2118,8 @@ !gpu->LayersEnable[4]) return; // init background color & priorities-for(int i = 0; i< 256; ++i)-{-sprPrio[i]=0xFF;-gpu->sprWin[l][i]=0;-}+memset(sprPrio,0xFF,256);+memset(&gpu->sprWin[l],0,256); // init pixels priorities for (int i=0; i<NB_PRIORITIES; i++) {@@ -2187,13 +2184,13 @@ } } }-}-+}+ // TODO: capture emulated not fully static INLINE void GPU_ligne_DispCapture(u16 l) {-GPU * gpu = MainScreen.gpu;-struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;+GPU * gpu = MainScreen.gpu;+struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; if (l == 0) {Modified: trunk/desmume/src/GPU.h===================================================================--- trunk/desmume/src/GPU.h2008-12-27 02:42:54 UTC (rev 1253)+++ trunk/desmume/src/GPU.h2008-12-27 03:49:18 UTC (rev 1254)@@ -1,807 +1,807 @@-/* Copyright (C) 2006 yopyop-yop...@if...-yopyop156.ifrance.com--Copyright (C) 2006-2007 Theo Berkau-Copyright (C) 2007 shash--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 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-*/--#ifndef GPU_H-#define GPU_H--#include "ARM9.h"-#include <stdio.h>-#include "mem.h"-#include "registers.h"-#include "FIFO.h"-#include "MMU.h"-#include "GPU_osd.h"-#include <iosfwd>-+/* Copyright (C) 2006 yopyop+yop...@if...+yopyop156.ifrance.com++Copyright (C) 2006-2007 Theo Berkau+Copyright (C) 2007 shash++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 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+*/++#ifndef GPU_H+#define GPU_H++#include "ARM9.h"+#include <stdio.h>+#include "mem.h"+#include "registers.h"+#include "FIFO.h"+#include "MMU.h"+#include "GPU_osd.h"+#include <iosfwd>+ void gpu_savestate(std::ostream* os);-bool gpu_loadstate(std::istream* is);--/*******************************************************************************- this structure is for display control,- it holds flags for general display-*******************************************************************************/--#ifdef WORDS_BIGENDIAN-struct _DISPCNT-{-/* 7*/ u8 ForceBlank:1; // A+B:-/* 6*/ u8 OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB)-/* 5*/ u8 OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels-/* 4*/ u8 OBJ_Tile_mapping:1;// A+B: 0=2D (32KB), 1=1D (32..256KB)-/* 3*/ u8 BG0_3D:1; // A : 0=2D, 1=3D-/* 0*/ u8 BG_Mode:3; // A+B:-/*15*/ u8 WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable-/*14*/ u8 Win1_Enable:1; // A+B: 0=disable, 1=Enable-/*13*/ u8 Win0_Enable:1; // A+B: 0=disable, 1=Enable-/*12*/ u8 OBJ_Enable:1; // A+B: 0=disable, 1=Enable-/*11*/ u8 BG3_Enable:1; // A+B: 0=disable, 1=Enable-/*10*/ u8 BG2_Enable:1; // A+B: 0=disable, 1=Enable-/* 9*/ u8 BG1_Enable:1; // A+B: 0=disable, 1=Enable-/* 8*/ u8 BG0_Enable:1; // A+B: 0=disable, 1=Enable-/*23*/ u8 OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5)-/*22*/ u8 OBJ_BMP_1D_Bound:1; // A :-/*20*/ u8 OBJ_Tile_1D_Bound:2; // A+B:-/*18*/ u8 VRAM_Block:2; // A : VRAM block (0..3=A..D)--/*16*/ u8 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)--/*31*/ u8 ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette-/*30*/ u8 ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette-/*27*/ u8 ScreenBase_Block:3; // A : Screen Base (64K step)-/*24*/ u8 CharacBase_Block:3; // A : Character Base (64K step)-};-#else-struct _DISPCNT-{-/* 0*/ u8 BG_Mode:3; // A+B:-/* 3*/ u8 BG0_3D:1; // A : 0=2D, 1=3D-/* 4*/ u8 OBJ_Tile_mapping:1; // A+B: 0=2D (32KB), 1=1D (32..256KB)-/* 5*/ u8 OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels-/* 6*/ u8 OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB)-- // 7-15 same as GBA-/* 7*/ u8 ForceBlank:1; // A+B:-/* 8*/ u8 BG0_Enable:1; // A+B: 0=disable, 1=Enable-/* 9*/ u8 BG1_Enable:1; // A+B: 0=disable, 1=Enable-/*10*/ u8 BG2_Enable:1; // A+B: 0=disable, 1=Enable-/*11*/ u8 BG3_Enable:1; // A+B: 0=disable, 1=Enable-/*12*/ u8 OBJ_Enable:1; // A+B: 0=disable, 1=Enable-/*13*/ u8 Win0_Enable:1; // A+B: 0=disable, 1=Enable-/*14*/ u8 Win1_Enable:1; // A+B: 0=disable, 1=Enable-/*15*/ u8 WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable--/*16*/ u8 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*/ u8 VRAM_Block:2; // A : VRAM block (0..3=A..D)-/*20*/ u8 OBJ_Tile_1D_Bound:2; // A+B:-/*22*/ u8 OBJ_BMP_1D_Bound:1; // A :-/*23*/ u8 OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5)-/*24*/ u8 CharacBase_Block:3; // A : Character Base (64K step)-/*27*/ u8 ScreenBase_Block:3; // A : Screen Base (64K step)-/*30*/ u8 ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette-/*31*/ u8 ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette-};-#endif--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-*******************************************************************************/--#ifdef WORDS_BIGENDIAN-struct _BGxCNT-{-/* 7*/ u8 Palette_256:1; // 0=16x16, 1=1*256 palette-/* 6*/ u8 Mosaic_Enable:1; // 0=disable, 1=Enable mosaic-/* 2*/ u8 CharacBase_Block:4; // individual character base offset (n*16KB)-/* 0*/ u8 Priority:2; // 0..3=high..low-/*14*/ u8 ScreenSize:2; // text : 256x256 512x256 256x512 512x512- // x/rot/s : 128x128 256x256 512x512 1024x1024- // bmp : 128x128 256x256 512x256 512x512- // large : 512x1024 1024x512 - --/*13*/ u8 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-/* 8*/ u8 ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB)-};-#else-struct _BGxCNT-{-/* 0*/ u8 Priority:2; // 0..3=high..low-/* 2*/ u8 CharacBase_Block:4; // individual character base offset (n*16KB)-/* 6*/ u8 Mosaic_Enable:1; // 0=disable, 1=Enable mosaic-/* 7*/ u8 Palette_256:1; // 0=16x16, 1=1*256 palette-/* 8*/ u8 ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB)-/*13*/ u8 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*/ u8 ScreenSize:2; // text : 256x256 512x256 256x512 512x512- // x/rot/s : 128x128 256x256 512x512 1024x1024- // bmp : 128x128 256x256 512x256 512x512- // large : 512x1024 1024x512 - --};-#endif---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 {- s16 BGxPA;- s16 BGxPB;- s16 BGxPC;- s16 BGxPD;- s32 BGxX;- s32 BGxY;-} BGxPARMS;---/*******************************************************************************-these structures are for window description,-windows are square regions and can "subclass"-background layers or object layers (i.e window controls the layers)--screen-|-+-- Window0/Window1/OBJwindow/OutOfWindows-|-+-- BG0/BG1/BG2/BG3/OBJ-*******************************************************************************/--typedef union {-struct{-u8 end:8;-u8 start:8;-} bits ;-u16 val;-} WINxDIM;--#ifdef WORDS_BIGENDIAN-typedef struct {-/* 6*/ u8 :2;-/* 5*/ u8 WINx_Effect_Enable:1;-/* 4*/ u8 WINx_OBJ_Enable:1;-/* 3*/ u8 WINx_BG3_Enable:1;-/* 2*/ u8 WINx_BG2_Enable:1;-/* 1*/ u8 WINx_BG1_Enable:1;-/* 0*/ u8 WINx_BG0_Enable:1;-} WINxBIT;-#else-typedef struct {-/* 0*/ u8 WINx_BG0_Enable:1;-/* 1*/ u8 WINx_BG1_Enable:1;-/* 2*/ u8 WINx_BG2_Enable:1;-/* 3*/ u8 WINx_BG3_Enable:1;-/* 4*/ u8 WINx_OBJ_Enable:1;-/* 5*/ u8 WINx_Effect_Enable:1;-/* 6*/ u8 :2;-} WINxBIT;-#endif--#ifdef WORDS_BIGENDIAN-typedef union {-struct {-WINxBIT win0;-WINxBIT win1;-} bits;-struct {-u8 :3;-u8 win0_en:5;-u8 :3;-u8 win1_en:5;-} packed_bits;-struct {-u8 low;-u8 high;-} bytes;-u16 val ;-} WINxCNT ;-#else-typedef union {-struct {-WINxBIT win0;-WINxBIT win1;-} bits;-struct {-u8 win0_en:5;-u8 :3;-u8 win1_en:5;-u8 :3;-} packed_bits;-struct {-u8 low;-u8 high;-} bytes;-u16 val ;-} WINxCNT ;-#endif--/*-typedef struct {- WINxDIM WIN0H;- WINxDIM WIN1H;- WINxDIM WIN0V;- WINxDIM WIN1V;- WINxCNT WININ;- WINxCNT WINOUT;-} WINCNT;-*/--/*******************************************************************************- this structure is for miscellanous settings- //TODO: needs further description-*******************************************************************************/--typedef struct {- u16 MOSAIC;- u16 unused1;- u16 unused2;//BLDCNT;- u16 unused3;//BLDALPHA;- u16 unused4;//BLDY;- u16 unused5;-/*- u16 unused6;- u16 unused7;- u16 unused8;- u16 unused9;-*/-} MISCCNT;---/*******************************************************************************- this structure is for 3D settings-*******************************************************************************/--struct _DISP3DCNT-{-/* 0*/ u8 EnableTexMapping:1; //-/* 1*/ u8 PolygonShading:1; // 0=Toon Shading, 1=Highlight Shading-/* 2*/ u8 EnableAlphaTest:1; // see ALPHA_TEST_REF-/* 3*/ u8 EnableAlphaBlending:1; // see various Alpha values-/* 4*/ u8 EnableAntiAliasing:1; //-/* 5*/ u8 EnableEdgeMarking:1; // see EDGE_COLOR-/* 6*/ u8 FogOnlyAlpha:1; // 0=Alpha and Color, 1=Only Alpha (see FOG_COLOR)-/* 7*/ u8 EnableFog:1; // Fog Master Enable-/* 8*/ u8 FogShiftSHR:4; // 0..10 SHR-Divider (see FOG_OFFSET)-/*12*/ u8 AckColorBufferUnderflow:1; // Color Buffer RDLINES Underflow (0=None, 1=Underflow/Acknowledge)-/*13*/ u8 AckVertexRAMOverflow:1; // Polygon/Vertex RAM Overflow (0=None, 1=Overflow/Acknowledge)-/*14*/ u8 RearPlaneMode:1; // 0=Blank, 1=Bitmap-/*15*/ u8 :1;-/*16*/ u16 :16;-};--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-*******************************************************************************/-typedef struct-{- u32val;-BOOLenabled;-u8EVA;-u8EVB;-u8writeBlock;-u8writeOffset;-u16capx;-u16capy;-u8srcA;-u8srcB;-u8readBlock;-u8readOffset;-u8capSrc;-u8*dst;-u8*src;-} DISPCAPCNT;--/*******************************************************************************- 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_BGxCNT[4]; // 0x0400x008- BGxOFS dispx_BGxOFS[4]; // 0x0400x010- BGxPARMS dispx_BG2PARMS; // 0x0400x020- BGxPARMS dispx_BG3PARMS; // 0x0400x030- u8filler[12]; // 0x0400x040- MISCCNT dispx_MISC; // 0x0400x04C- DISP3DCNT dispA_DISP3DCNT; // 0x04000060- DISPCAPCNT dispA_DISPCAPCNT; // 0x04000064- u32 dispA_DISPMMEMFIFO; // 0x04000068-} REG_DISPx ;---typedef BOOL (*fun_gl_Begin) (int screen);-typedef void (*fun_gl_End) (int screen);-// the GUI should use this function prior to all gl calls-// if call to beg succeeds opengl draw-void register_gl_fun(fun_gl_Begin beg,fun_gl_End end);--#define GPU_MAIN0-#define GPU_SUB1--/* human readable bitmask names */-#define ADDRESS_STEP_512B 0x00200-#define ADDRESS_STEP_1KB0x00400-#define ADDRESS_STEP_2KB0x00800-#define ADDRESS_STEP_4KB0x01000-#define ADDRESS_STEP_8KB0x02000-#define ADDRESS_STEP_16KB 0x04000-#define ADDRESS_STEP_32KB 0x08000-#define ADDRESS_STEP_64kB 0x10000--#ifdef WORDS_BIGENDIAN-struct _TILEENTRY-{-/*14*/unsigned Palette:4;-/*13*/unsigned VFlip:1;// VERTICAL FLIP (top<-->bottom)-/*12*/unsigned HFlip:1;// HORIZONTAL FLIP (left<-->right)-/* 0*/unsigned TileNum:10;-};-#else-struct _TILEENTRY-{-/* 0*/unsigned TileNum:10;-/*12*/unsigned HFlip:1;// HORIZONTAL FLIP (left<-->right)-/*13*/unsigned VFlip:1;// VERTICAL FLIP (top<-->bottom)-/*14*/unsigned Palette:4;-};-#endif-typedef union-{-struct _TILEENTRY bits;-u16 val;-} TILEENTRY;--struct _ROTOCOORD-{-/* 0*/unsigned Fraction:8;-/* 8*/ signed Integer:24;-// /*28*/unsigned :4;-};-typedef union-{-struct _ROTOCOORD bits;-s32 val;-} ROTOCOORD;---/*-this structure is for color representation,-it holds 5 meaningful bits per color channel (red,green,blue)-and 1 meaningful bit for alpha representation-this bit can be unused or used for special FX-*/--struct _COLOR { // abgr x555-#ifdef WORDS_BIGENDIAN-unsigned alpha:1; // sometimes it is unused (pad)-unsigned blue:5;-unsigned green:5;-unsigned red:5;-#else- unsigned red:5;- unsigned green:5;- unsigned blue:5;- unsigned alpha:1; // sometimes it is unused (pad)-#endif-};-struct _COLORx { // abgr x555-unsigned bgr:15;-unsigned alpha:1;// sometimes it is unused (pad)-};--typedef union-{-struct _COLOR bits;-struct _COLORx bitx;-u16 val;-} COLOR;--struct _COLOR32 { // ARGB-unsigned :3;-unsigned blue:5;-unsigned :3;-unsigned green:5;-unsigned :3;-unsigned red:5;-unsigned :7;-unsigned alpha:1;// sometimes it is unused (pad)-};--typedef union-{-struct _COLOR32 bits;-u32 val;-} COLOR32;--#define COLOR_16_32(w,i)\-/* doesnt matter who's 16bit who's 32bit */ \-i.bits.red = w.bits.red; \-i.bits.green = w.bits.green; \-i.bits.blue = w.bits.blue; \-i.bits.alpha = w.bits.alpha;-------/*-this structure is for Sprite description,-it holds flags & transformations for 1 sprite-(max 128 OBJs / screen)-ref: http://www.bottledlight.com/ds/index.php/Video/Sprites-*/--typedef struct-{-#ifdef WORDS_BIGENDIAN-// attr0-/* 0*/ unsigned Y:8;-/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal)-/*13*/ unsigned Depth:1; // (0: 16, 1: 256)-/*12*/ unsigned Mosaic:1; // (1: Enabled)-/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap)-/* 8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale)-// attr1-/* 0*/ signed X:9;-/*14*/ unsigned Size:2;-/*13*/ unsigned VFlip:1;-/*12*/ unsigned HFlip:1;-/* 9*/ unsigned RotScalIndex:3; // Rot/scale matrix index-// attr2-/* 0*/ unsigned TileIndex:10;-/*12*/ unsigned PaletteIndex:4;-/*10*/ unsigned Priority:2;-// attr3-unsigned attr3:16; -#else-// 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)-/*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)-// attr1-/* 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;-/*10*/unsigned Priority:2;-/*12*/unsigned PaletteIndex:4;-// attr3-unsigned attr3:16;-#endif-} _OAM_;--typedef struct-{- u16 attr0;- u16 attr1;- u16 attr2;- u16 attr3;-} OAM;----typedef struct-{- s16 x;- s16 y;-} size;-----/*-this structure holds information-for rendering.-*/--#define NB_PRIORITIES4-#define NB_BG4-typedef struct-{-u8 BGs[NB_BG], nbBGs;-u8 PixelsX[256];-// doh ! yoda says : 256 pixels we can have...-u16 nbPixelsX;-} itemsForPriority_t;-#define ARM9MEM_ABG0x06000000-#define ARM9MEM_BBG0x06200000-#define ARM9MEM_AOBJ0x06400000-#define ARM9MEM_BOBJ0x06600000--typedef struct _GPU GPU;--struct _GPU-{-// some structs are becoming redundant-// some functions too (no need to recopy some vars as it is done by MMU)-REG_DISPx * dispx_st;--DISPCAPCNT dispCapCnt;-BOOL LayersEnable[5];-itemsForPriority_t itemsForPriority[NB_PRIORITIES];-u8 sprWin[256][256];--#define BGBmpBB BG_bmp_ram-#define BGChBB BG_tile_ram--u32 BG_bmp_ram[4];-u32 BG_tile_ram[4];-u32 BG_map_ram[4];--u8 BGExtPalSlot[4];-u32 BGSize[4][2];--u8 core;--u8 dispMode;-u8 vramBlock;-u8 *VRAMaddr;--//FIFOfifo;--BOOL dispBG[4];-BOOL dispOBJ;--OAM * oam;-u32sprMem;-u8 sprBoundary;-u8 sprBMPBoundary;-u8 sprBMPMode;-u32 sprEnable;--u8 WIN0H0;-u8 WIN0H1;-u8 WIN0V0;-u8 WIN0V1;--u8 WIN1H0;-u8 WIN1H1;-u8 WIN1V0;-u8 WIN1V1;--u8 WININ0;-u8 WININ0_SPECIAL;-u8 WININ1;-u8 WININ1_SPECIAL;--u8 WINOUT;-u8 WINOUT_SPECIAL;-u8 WINOBJ;-u8 WINOBJ_SPECIAL;--u8 WIN0_ENABLED;-u8 WIN1_ENABLED;-u8 WINOBJ_ENABLED;--u16 BLDCNT;-u8BLDALPHA_EVA;-u8BLDALPHA_EVB;-u8BLDY_EVY;--u8MasterBrightMode;-u32 MasterBrightFactor;--BOOL (*setFinalColorSpr)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);-BOOL (*setFinalColorBck)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);-void (*spriteRender) (GPU * gpu, u16 l, u8 * dst, u8 * prioTab);-};-/*-// normally should have same addresses-static void REG_DISPx_pack_test(GPU * gpu)-{-REG_DISPx * r = gpu->dispx_st;-printf ("%08x %02x\n", r, (long)(&r->dispx_DISPCNT) - (long)r);-printf ("\t%02x\n", (long)(&r->dispA_DISPSTAT) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_VCOUNT) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_BGxCNT[0]) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_BGxOFS[0]) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_BG2PARMS) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_BG3PARMS) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_WINCNT) - (long)r);-printf ("\t%02x\n", (long)(&r->dispx_MISC) - (long)r);-printf ("\t%02x\n", (long)(&r->dispA_DISP3DCNT) - (long)r);-printf ("\t%02x\n", (long)(&r->dispA_DISPCAPCNT) - (long)r);-printf ("\t%02x\n", (long)(&r->dispA_DISPMMEMFIFO) - (long)r);-}-*/--extern u8 GPU_screen[4*256*192];---GPU * GPU_Init(u8 l);-void GPU_Reset(GPU *g, u8 l);-void GPU_DeInit(GPU *);--void textBG(const GPU * gpu, u8 num, u8 * DST);//Draw text based background-void rotBG(GPU * gpu, u8 num, u8 * DST);-void extRotBG(GPU * gpu, u8 num, u8 * DST);-void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);-void sprite2D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);--extern const short sizeTab[4][4][2];-extern const size sprSizeTab[4][4];-extern const s8 mode2type[8][4];-extern void (*modeRender[8][4])(GPU * gpu, u8 num, u16 l, u8 * DST);--typedef struct {-GPU * gpu;-u16 offset;-} NDS_Screen;--extern NDS_Screen MainScreen;-extern NDS_Screen SubScreen;--int Screen_Init(int coreid);-void Screen_Reset(void);-void Screen_DeInit(void);--extern MMU_struct MMU;----#define GFXCORE_DEFAULT -1-#define GFXCORE_DUMMY 0--#define GFXCORE_FULLSCREEN (1 << 0)--typedef struct-{- int id; // ID number for core(see above defines)- const char *Name; // Name of core- int flags; // What features the core supports(full screen, etc.)- int (*Init)(); // Initializes stuff related to core- void (*DeInit)(); // Deinitializes stuff related to core- void (*Resize)(int width, int height, BOOL fullscreen); // Resizes window or fullscreen- void (*OnScreenText)(char *string, ...); // For handling save state messages, etc.-} GraphicsInterface_struct;--extern GraphicsInterface_struct GFXDummy;--void GPU_setVideoProp(GPU *, u32 p);-void GPU_setBGProp(GPU *, u16 num, u16 p);--void GPU_setBLDCNT(GPU *gpu, u16 v) ;-void GPU_setBLDALPHA(GPU *gpu, u16 v) ;-void GPU_setBLDY(GPU *gpu, u16 v) ;-void GPU_setMOSAIC(GPU *gpu, u16 v) ;---void GPU_remove(GPU *, u8 num);-void GPU_addBack(GPU *, u8 num);--int GPU_ChangeGraphicsCore(int coreid);--void GPU_set_DISPCAPCNT(u32 val) ;-void GPU_ligne(NDS_Screen * screen, u16 l) ;-void GPU_setMasterBrightness (GPU *gpu, u16 val);--#define GPU_setWIN0_H(gpu, val) {gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF;}-#define GPU_setWIN0_H0(gpu, val) gpu->WIN0H0 = val-#define GPU_setWIN0_H1(gpu, val) gpu->WIN0H1 = val--#define GPU_setWIN0_V(gpu, val) {gpu->WIN0V0 = val >> 8; gpu->WIN0V1 = val&0xFF;}-#define GPU_setWIN0_V0(gpu, val) gpu->WIN0V0 = val-#define GPU_setWIN0_V1(gpu, val) gpu->WIN0V1 = val--#define GPU_setWIN1_H(gpu, val) {gpu->WIN1H0 = val >> 8; gpu->WIN1H1 = val&0xFF;}-#define GPU_setWIN1_H0(gpu, val) gpu->WIN1H0 = val-#define GPU_setWIN1_H1(gpu, val) gpu->WIN1H1 = val--#define GPU_setWIN1_V(gpu, val) {gpu->WIN1V0 = val >> 8; gpu->WIN1V1 = val&0xFF;}-#define GPU_setWIN1_V0(gpu, val) gpu->WIN1V0 = val-#define GPU_setWIN1_V1(gpu, val) gpu->WIN1V1 = val--#define GPU_setWININ(gpu, val) {gpu->WININ0=val&0x1F;\-gpu->WININ0_SPECIAL=(val>>5)&1;\-gpu->WININ1=(val>>8)&0x1F;\-gpu->WININ1_SPECIAL=(val>>13)&1;\-}-#define GPU_setWININ0(gpu, val) {gpu->WININ0 = val&0x1F; gpu->WININ0_SPECIAL = (val>>5)&1;}-#define GPU_setWININ1(gpu, val) {gpu->WININ1 = val&0x1F; gpu->WININ1_SPECIAL = (val>>5)&1;}--#define GPU_setWINOUT16(gpu, val) { gpu->WINOUT=val&0x1F;\-gpu->WINOUT_SPECIAL=(val>>5)&1;\-gpu->WINOBJ=(val>>8)&0x1F;\-gpu->WINOBJ_SPECIAL=(val>>13)&1;\-}-#define GPU_setWINOUT(gpu, val) {gpu->WINOUT = val&0x1F; gpu->WINOUT_SPECIAL = (val>>5)&1;}-#define GPU_setWINOBJ(gpu, val) {gpu->WINOBJ = val&0x1F; gpu->WINOBJ_SPECIAL = (val>>5)&1;}--// Blending-void SetupFinalPixelBlitter (GPU *gpu);-#define GPU_setBLDCNT_LOW(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF00) | val; SetupFinalPixelBlitter (gpu);}-#define GPU_setBLDCNT_HIGH(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF) | (val<<8); SetupFinalPixelBlitter (gpu);}-#define GPU_setBLDCNT(gpu, val) {gpu->BLDCNT = val; SetupFinalPixelBlitter (gpu);}--#define GPU_setBLDALPHA(gpu, val) {gpu->BLDALPHA_EVA = (val&0x1f) > 16 ? 16 : (val&0x1f);\-gpu->BLDALPHA_EVB = (val>>8&0x1f) > 16 ? 16 : (val>>8&0x1f);}-#define GPU_setBLDALPHA_EVA(gpu, val) {gpu->BLDALPHA_EVA = (val&0x1f) > 16 ? 16 : (val&0x1f);}-#define GPU_setBLDALPHA_EVB(gpu, val) {gpu->BLDALPHA_EVB = (val&0x1f) > 16 ? 16 : (val&0x1f);}--#define GPU_setBLDY_EVY(gpu, val) {gpu->BLDY_EVY = (val&0x1f) > 16 ? 16 : (val&0x1f);}--#define GPU_setBGxHOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxHOFS = (val & 0x1F)-#define GPU_setBGxVOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxVOFS = (val & 0x1F)--#endif-+bool gpu_loadstate(std::istream* is);++/*******************************************************************************+ this structure is for display control,+ it holds flags for general display+*******************************************************************************/++#ifdef WORDS_BIGENDIAN+struct _DISPCNT+{+/* 7*/ u8 ForceBlank:1; // A+B:+/* 6*/ u8 OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB)+/* 5*/ u8 OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels+/* 4*/ u8 OBJ_Tile_mapping:1;// A+B: 0=2D (32KB), 1=1D (32..256KB)+/* 3*/ u8 BG0_3D:1; // A : 0=2D, 1=3D+/* 0*/ u8 BG_Mode:3; // A+B:+/*15*/ u8 WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable+/*14*/ u8 Win1_Enable:1; // A+B: 0=disable, 1=Enable+/*13*/ u8 Win0_Enable:1; // A+B: 0=disable, 1=Enable+/*12*/ u8 OBJ_Enable:1; // A+B: 0=disable, 1=Enable+/*11*/ u8 BG3_Enable:1; // A+B: 0=disable, 1=Enable+/*10*/ u8 BG2_Enable:1; // A+B: 0=disable, 1=Enable+/* 9*/ u8 BG1_Enable:1; // A+B: 0=disable, 1=Enable+/* 8*/ u8 BG0_Enable:1; // A+B: 0=disable, 1=Enable+/*23*/ u8 OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5)+/*22*/ u8 OBJ_BMP_1D_Bound:1; // A :+/*20*/ u8 OBJ_Tile_1D_Bound:2; // A+B:+/*18*/ u8 VRAM_Block:2; // A : VRAM block (0..3=A..D)++/*16*/ u8 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)++/*31*/ u8 ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette+/*30*/ u8 ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette+/*27*/ u8 ScreenBase_Block:3; // A : Screen Base (64K step)+/*24*/ u8 CharacBase_Block:3; // A : Character Base (64K step)+};+#else+struct _DISPCNT+{+/* 0*/ u8 BG_Mode:3; // A+B:+/* 3*/ u8 BG0_3D:1; // A : 0=2D, 1=3D+/* 4*/ u8 OBJ_Tile_mapping:1; // A+B: 0=2D (32KB), 1=1D (32..256KB)+/* 5*/ u8 OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels+/* 6*/ u8 OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB)++ // 7-15 same as GBA+/* 7*/ u8 ForceBlank:1; // A+B:+/* 8*/ u8 BG0_Enable:1; // A+B: 0=disable, 1=Enable+/* 9*/ u8 BG1_Enable:1; // A+B: 0=disable, 1=Enable+/*10*/ u8 BG2_Enable:1; // A+B: 0=disable, 1=Enable+/*11*/ u8 BG3_Enable:1; // A+B: 0=disable, 1=Enable+/*12*/ u8 OBJ_Enable:1; // A+B: 0=disable, 1=Enable+/*13*/ u8 Win0_Enable:1; // A+B: 0=disable, 1=Enable+/*14*/ u8 Win1_Enable:1; // A+B: 0=disable, 1=Enable+/*15*/ u8 WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable++/*16*/ u8 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*/ u8 VRAM_Block:2; // A : VRAM block (0..3=A..D)+/*20*/ u8 OBJ_Tile_1D_Bound:2; // A+B:+/*22*/ u8 OBJ_BMP_1D_Bound:1; // A :+/*23*/ u8 OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5)+/*24*/ u8 CharacBase_Block:3; // A : Character Base (64K step)+/*27*/ u8 ScreenBase_Block:3; // A : Screen Base (64K step)+/*30*/ u8 ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette+/*31*/ u8 ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette+};+#endif++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+*******************************************************************************/++#ifdef WORDS_BIGENDIAN+struct _BGxCNT+{+/* 7*/ u8 Palette_256:1; // 0=16x16, 1=1*256 palette+/* 6*/ u8 Mosaic_Enable:1; // 0=disable, 1=Enable mosaic+/* 2*/ u8 CharacBase_Block:4; // individual character base offset (n*16KB)+/* 0*/ u8 Priority:2; // 0..3=high..low+/*14*/ u8 ScreenSize:2; // text : 256x256 512x256 256x512 512x512+ // x/rot/s : 128x128 256x256 512x512 1024x1024+ // bmp : 128x128 256x256 512x256 512x512+ // large : 512x1024 1024x512 - -+/*13*/ u8 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+/* 8*/ u8 ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB)+};+#else+struct _BGxCNT+{+/* 0*/ u8 Priority:2; // 0..3=high..low+/* 2*/ u8 CharacBase_Block:4; // individual character base offset (n*16KB)+/* 6*/ u8 Mosaic_Enable:1; // 0=disable, 1=Enable mosaic+/* 7*/ u8 Palette_256:1; // 0=16x16, 1=1*256 palette+/* 8*/ u8 ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB)+/*13*/ u8 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*/ u8 ScreenSize:2; // text : 256x256 512x256 256x512 512x512+ // x/rot/s : 128x128 256x256 512x512 1024x1024+ // bmp : 128x128 256x256 512x256 512x512+ // large : 512x1024 1024x512 - -+};+#endif+++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 {+ s16 BGxPA;+ s16 BGxPB;+ s16 BGxPC;+ s16 BGxPD;+ s32 BGxX;+ s32 BGxY;+} BGxPARMS;+++/*******************************************************************************+these structures are for window description,+windows are square regions and can "subclass"+background layers or object layers (i.e window controls the layers)++screen+|++-- Window0/Window1/OBJwindow/OutOfWindows+|++-- BG0/BG1/BG2/BG3/OBJ+*******************************************************************************/++typedef union {+struct{+u8 end:8;+u8 start:8;+} bits ;+u16 val;+} WINxDIM;++#ifdef WORDS_BIGENDIAN+typedef struct {+/* 6*/ u8 :2;+/* 5*/ u8 WINx_Effect_Enable:1;+/* 4*/ u8 WINx_OBJ_Enable:1;+/* 3*/ u8 WINx_BG3_Enable:1;+/* 2*/ u8 WINx_BG2_Enable:1;+/* 1*/ u8 WINx_BG1_Enable:1;+/* 0*/ u8 WINx_BG0_Enable:1;+} WINxBIT;+#else+typedef struct {+/* 0*/ u8 WINx_BG0_Enable:1;+/* 1*/ u8 WINx_BG1_Enable:1;+/* 2*/ u8 WINx_BG2_Enable:1;+/* 3*/ u8 WINx_BG3_Enable:1;+/* 4*/ u8 WINx_OBJ_Enable:1;+/* 5*/ u8 WINx_Effect_Enable:1;+/* 6*/ u8 :2;+} WINxBIT;+#endif++#ifdef WORDS_BIGENDIAN+typedef union {+struct {+WINxBIT win0;+WINxBIT win1;+} bits;+struct {+u8 :3;+u8 win0_en:5;+u8 :3;+u8 win1_en:5;+} packed_bits;+struct {+u8 low;+u8 high;+} bytes;+u16 val ;+} WINxCNT ;+#else+typedef union {+struct {+WINxBIT win0;+WINxBIT win1;+} bits;+struct {+u8 win0_en:5;+u8 :3;+u8 win1_en:5;+u8 :3;+} packed_bits;+struct {+u8 low;+u8 high;+} bytes;+u16 val ;+} WINxCNT ;+#endif++/*+typedef struct {+ WINxDIM WIN0H;+ WINxDIM WIN1H;+ WINxDIM WIN0V;+ WINxDIM WIN1V;+ WINxCNT WININ;+ WINxCNT WINOUT;+} WINCNT;+*/++/*******************************************************************************+ this structure is for miscellanous settings+ //TODO: needs further description+*******************************************************************************/++typedef struct {+ u16 MOSAIC;+ u16 unused1;+ u16 unused2;//BLDCNT;+ u16 unused3;//BLDALPHA;+ u16 unused4;//BLDY;+ u16 unused5;+/*+ u16 unused6;+ u16 unused7;+ u16 unused8;+ u16 unused9;+*/+} MISCCNT;+++/*******************************************************************************+ this structure is for 3D settings+*******************************************************************************/++struct _DISP3DCNT+{+/* 0*/ u8 EnableTexMapping:1; //+/* 1*/ u8 PolygonShading:1; // 0=Toon Shading, 1=Highlight Shading+/* 2*/ u8 EnableAlphaTest:1; // see ALPHA_TEST_REF+/* 3*/ u8 EnableAlphaBlending:1; // see various Alpha values+/* 4*/ u8 EnableAntiAliasing:1; //+/* 5*/ u8 EnableEdgeMarking:1; // see EDGE_COLOR+/* 6*/ u8 FogOnlyAlpha:1; // 0=Alpha and Color, 1=Only Alpha (see FOG_COLOR)+/* 7*/ u8 EnableFog:1; // Fog Master Enable+/* 8*/ u8 FogShiftSHR:4; // 0..10 SHR-Divider (see FOG_OFFSET)+/*12*/ u8 AckColorBufferUnderflow:1; // Color Buffer RDLINES Underflow (0=None, 1=Underflow/Acknowledge)+/*13*/ u8 AckVertexRAMOverflow:1; // Polygon/Vertex RAM Overflow (0=None, 1=Overflow/Acknowledge)+/*14*/ u8 RearPlaneMode:1; // 0=Blank, 1=Bitmap+/*15*/ u8 :1;+/*16*/ u16 :16;+};++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+*******************************************************************************/+typedef struct+{+ u32val;+BOOLenabled;+u8EVA;+u8EVB;+u8writeBlock;+u8writeOffset;+u16capx;+u16capy;+u8srcA;+u8srcB;+u8readBlock;+u8readOffset;+u8capSrc;+u8*dst;+u8*src;+} DISPCAPCNT;++/*******************************************************************************+ 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_BGxCNT[4]; // 0x0400x008+ BGxOFS dispx_BGxOFS[4]; // 0x0400x010+ BGxPARMS dispx_BG2PARMS; // 0x0400x020+ BGxPARMS dispx_BG3PARMS; // 0x0400x030+ u8filler[12]; // 0x0400x040+ MISCCNT dispx_MISC; // 0x0400x04C+ DISP3DCNT dispA_DISP3DCNT; // 0x04000060+ DISPCAPCNT dispA_DISPCAPCNT; // 0x04000064+ u32 dispA_DISPMMEMFIFO; // 0x04000068+} REG_DISPx ;+++typedef BOOL (*fun_gl_Begin) (int screen);+typedef void (*fun_gl_End) (int screen);+// the GUI should use this function prior to all gl calls+// if call to beg succeeds opengl draw+void register_gl_fun(fun_gl_Begin beg,fun_gl_End end);++#define GPU_MAIN0+#define GPU_SUB1++/* human readable bitmask names */+#define ADDRESS_STEP_512B 0x00200+#define ADDRESS_STEP_1KB0x00400+#define ADDRESS_STEP_2KB0x00800+#define ADDRESS_STEP_4KB0x01000+#define ADDRESS_STEP_8KB0x02000+#define ADDRESS_STEP_16KB 0x04000+#define ADDRESS_STEP_32KB 0x08000+#define ADDRESS_STEP_64kB 0x10000++#ifdef WORDS_BIGENDIAN+struct _TILEENTRY+{+/*14*/unsigned Palette:4;+/*13*/unsigned VFlip:1;// VERTICAL FLIP (top<-->bottom)+/*12*/unsigned HFlip:1;// HORIZONTAL FLIP (left<-->right)+/* 0*/unsigned TileNum:10;+};+#else+struct _TILEENTRY+{+/* 0*/unsigned TileNum:10;+/*12*/unsigned HFlip:1;// HORIZONTAL FLIP (left<-->right)+/*13*/unsigned VFlip:1;// VERTICAL FLIP (top<-->bottom)+/*14*/unsigned Palette:4;+};+#endif+typedef union+{+struct _TILEENTRY bits;+u16 val;+} TILEENTRY;++struct _ROTOCOORD+{+/* 0*/unsigned Fraction:8;+/* 8*/ signed Integer:24;+// /*28*/unsigned :4;+};+typedef union+{+struct _ROTOCOORD bits;+s32 val;+} ROTOCOORD;+++/*+this structure is for color representation,+it holds 5 meaningful bits per color channel (red,green,blue)+and 1 meaningful bit for alpha representation+this bit can be unused or used for special FX+*/++struct _COLOR { // abgr x555+#ifdef WORDS_BIGENDIAN+unsigned alpha:1; // sometimes it is unused (pad)+unsigned blue:5;+unsigned green:5;+unsigned red:5;+#else+ unsigned red:5;+ unsigned green:5;+ unsigned blue:5;+ unsigned alpha:1; // sometimes it is unused (pad)+#endif+};+struct _COLORx { // abgr x555+unsigned bgr:15;+unsigned alpha:1;// sometimes it is unused (pad)+};++typedef union+{+struct _COLOR bits;+struct _COLORx bitx;+u16 val;+} COLOR;++struct _COLOR32 { // ARGB+unsigned :3;+unsigned blue:5;+unsigned :3;+unsigned green:5;+unsigned :3;+unsigned red:5;+unsigned :7;+unsigned alpha:1;// sometimes it is unused (pad)+};++typedef union+{+struct _COLOR32 bits;+u32 val;+} COLOR32;++#define COLOR_16_32(w,i)\+/* doesnt matter who's 16bit who's 32bit */ \+i.bits.red = w.bits.red; \+i.bits.green = w.bits.green; \+i.bits.blue = w.bits.blue; \+i.bits.alpha = w.bits.alpha;+++++++/*+this structure is for Sprite description,+it holds flags & transformations for 1 sprite+(max 128 OBJs / screen)+ref: http://www.bottledlight.com/ds/index.php/Video/Sprites+*/++typedef struct+{+#ifdef WORDS_BIGENDIAN+// attr0+/* 0*/ unsigned Y:8;+/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal)+/*13*/ unsigned Depth:1; // (0: 16, 1: 256)+/*12*/ unsigned Mosaic:1; // (1: Enabled)+/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap)+/* 8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale)+// attr1+/* 0*/ signed X:9;+/*14*/ unsigned Size:2;+/*13*/ unsigned VFlip:1;+/*12*/ unsigned HFlip:1;+/* 9*/ unsigned RotScalIndex:3; // Rot/scale matrix index+// attr2+/* 0*/ unsigned TileIndex:10;+/*12*/ unsigned PaletteIndex:4;+/*10*/ unsigned Priority:2;+// attr3+unsigned attr3:16; +#else+// 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)+/*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)+// attr1+/* 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;+/*10*/unsigned Priority:2;+/*12*/unsigned PaletteIndex:4;+// attr3+unsigned attr3:16;+#endif+} _OAM_;++typedef struct+{+ u16 attr0;+ u16 attr1;+ u16 attr2;+ u16 attr3;+} OAM;++++typedef struct+{+ s16 x;+ s16 y;+} size;+++++/*+this structure holds information+for rendering.+*/++#define NB_PRIORITIES4+#define NB_BG4+typedef struct+{+u8 BGs[NB_BG], nbBGs;+u8 PixelsX[256];+// doh ! yoda says : 256 pixels we can have...+u16 nbPixelsX;+} itemsForPriority_t;+#define ARM9MEM_ABG0x06000000+#define ARM9MEM_BBG0x06200000+#define ARM9MEM_AOBJ0x06400000+#define ARM9MEM_BOBJ0x06600000++typedef struct _GPU GPU;++struct _GPU+{+// some structs are becoming redundant+// some functions too (no need to recopy some vars as it is done by MMU)+REG_DISPx * dispx_st;++DISPCAPCNT dispCapCnt;+BOOL LayersEnable[5];+itemsForPriority_t itemsForPriority[NB_PRIORITIES];+u8 sprWin[192][256];++#define BGBmpBB BG_bmp_ram+#define BGChBB BG_tile_ram++u32 BG_bmp_ram[4];+u32 BG_tile_ram[4];+u32 BG_map_ram[4];++u8 BGExtPalSlot[4];+u32 BGSize[4][2];++u8 core;++u8 dispMode;+u8 vramBlock;+u8 *VRAMaddr;++//FIFOfifo;++BOOL dispBG[4];+BOOL dispOBJ;++OAM * oam;+u32sprMem;+u8 sprBoundary;+u8 sprBMPBoundary;+u8 sprBMPMode;+u32 sprEnable;++u8 WIN0H0;+u8 WIN0H1;+u8 WIN0V0;+u8 WIN0V1;++u8 WIN1H0;+u8 WIN1H1;+u8 WIN1V0;+u8 WIN1V1;++u8 WININ0;+u8 WININ0_SPECIAL;+u8 WININ1;+u8 WININ1_SPECIAL;++u8 WINOUT;+u8 WINOUT_SPECIAL;+u8 WINOBJ;+u8 WINOBJ_SPECIAL;++u8 WIN0_ENABLED;+u8 WIN1_ENABLED;+u8 WINOBJ_ENABLED;++u16 BLDCNT;+u8BLDALPHA_EVA;+u8BLDALPHA_EVB;+u8BLDY_EVY;++u8MasterBrightMode;+u32 MasterBrightFactor;++BOOL (*setFinalColorSpr)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);+BOOL (*setFinalColorBck)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);+void (*spriteRender) (GPU * gpu, u16 l, u8 * dst, u8 * prioTab);+};+/*+// normally should have same addresses+static void REG_DISPx_pack_test(GPU * gpu)+{+REG_DISPx * r = gpu->dispx_st;+printf ("%08x %02x\n", r, (long)(&r->dispx_DISPCNT) - (long)r);+printf ("\t%02x\n", (long)(&r->dispA_DISPSTAT) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_VCOUNT) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_BGxCNT[0]) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_BGxOFS[0]) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_BG2PARMS) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_BG3PARMS) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_WINCNT) - (long)r);+printf ("\t%02x\n", (long)(&r->dispx_MISC) - (long)r);+printf ("\t%02x\n", (long)(&r->dispA_DISP3DCNT) - (long)r);+printf ("\t%02x\n", (long)(&r->dispA_DISPCAPCNT) - (long)r);+printf ("\t%02x\n", (long)(&r->dispA_DISPMMEMFIFO) - (long)r);+}+*/++extern u8 GPU_screen[4*256*192];+++GPU * GPU_Init(u8 l);+void GPU_Reset(GPU *g, u8 l);+void GPU_DeInit(GPU *);++void textBG(const GPU * gpu, u8 num, u8 * DST);//Draw text based background+void rotBG(GPU * gpu, u8 num, u8 * DST);+void extRotBG(GPU * gpu, u8 num, u8 * DST);+void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);+void sprite2D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);++extern const short sizeTab[4][4][2];+extern const size sprSizeTab[4][4];+extern const s8 mode2type[8][4];+extern void (*modeRender[8][4])(GPU * gpu, u8 num, u16 l, u8 * DST);++typedef struct {+GPU * gpu;+u16 offset;+} NDS_Screen;++extern NDS_Screen MainScreen;+extern NDS_Screen SubScreen;++int Screen_Init(int coreid);+void Screen_Reset(void);+void Screen_DeInit(void);++extern MMU_struct MMU;++++#define GFXCORE_DEFAULT -1+#define GFXCORE_DUMMY 0++#define GFXCORE_FULLSCREEN (1 << 0)++typedef struct+{+ int id; // ID number for core(see above defines)+ const char *Name; // Name of core+ int flags; // What features the core supports(full screen, etc.)+ int (*Init)(); // Initializes stuff related to core+ void (*DeInit)(); // Deinitializes stuff related to core+ void (*Resize)(int width, int height, BOOL fullscreen); // Resizes window or fullscreen+ void (*OnScreenText)(char *string, ...); // For handling save state messages, etc.+} GraphicsInterface_struct;++extern GraphicsInterface_struct GFXDummy;++void GPU_setVideoProp(GPU *, u32 p);+void GPU_setBGProp(GPU *, u16 num, u16 p);++void GPU_setBLDCNT(GPU *gpu, u16 v) ;+void GPU_setBLDALPHA(GPU *gpu, u16 v) ;+void GPU_setBLDY(GPU *gpu, u16 v) ;+void GPU_setMOSAIC(GPU *gpu, u16 v) ;+++void GPU_remove(GPU *, u8 num);+void GPU_addBack(GPU *, u8 num);++int GPU_ChangeGraphicsCore(int coreid);++void GPU_set_DISPCAPCNT(u32 val) ;+void GPU_ligne(NDS_Screen * screen, u16 l) ;+void GPU_setMasterBrightness (GPU *gpu, u16 val);++#define GPU_setWIN0_H(gpu, val) {gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF;}+#define GPU_setWIN0_H0(gpu, val) gpu->WIN0H0 = val+#define GPU_setWIN0_H1(gpu, val) gpu->WIN0H1 = val++#define GPU_setWIN0_V(gpu, val) {gpu->WIN0V0 = val >> 8; gpu->WIN0V1 = val&0xFF;}+#define GPU_setWIN0_V0(gpu, val) gpu->WIN0V0 = val+#define GPU_setWIN0_V1(gpu, val) gpu->WIN0V1 = val++#define GPU_setWIN1_H(gpu, val) {gpu->WIN1H0 = val >> 8; gpu->WIN1H1 = val&0xFF;}+#define GPU_setWIN1_H0(gpu, val) gpu->WIN1H0 = val+#define GPU_setWIN1_H1(gpu, val) gpu->WIN1H1 = val++#define GPU_setWIN1_V(gpu, val) {gpu->WIN1V0 = val >> 8; gpu->WIN1V1 = val&0xFF;}+#define GPU_setWIN1_V0(gpu, val) gpu->WIN1V0 = val+#define GPU_setWIN1_V1(gpu, val) gpu->WIN1V1 = val++#define GPU_setWININ(gpu, val) {gpu->WININ0=val&0x1F;\+gpu->WININ0_SPECIAL=(val>>5)&1;\+gpu->WININ1=(val>>8)&0x1F;\+gpu->WININ1_SPECIAL=(val>>13)&1;\+}+#define GPU_setWININ0(gpu, val) {gpu->WININ0 = val&0x1F; gpu->WININ0_SPECIAL = (val>>5)&1;}+#define GPU_setWININ1(gpu, val) {gpu->WININ1 = val&0x1F; gpu->WININ1_SPECIAL = (val>>5)&1;}++#define GPU_setWINOUT16(gpu, val) { gpu->WINOUT=val&0x1F;\+gpu->WINOUT_SPECIAL=(val>>5)&1;\+gpu->WINOBJ=(val>>8)&0x1F;\+gpu->WINOBJ_SPECIAL=(val>>13)&1;\+}+#define GPU_setWINOUT(gpu, val) {gpu->WINOUT = val&0x1F; gpu->WINOUT_SPECIAL = (val>>5)&1;}+#define GPU_setWINOBJ(gpu, val) {gpu->WINOBJ = val&0x1F; gpu->WINOBJ_SPECIAL = (val>>5)&1;}++// Blending+void SetupFinalPixelBlitter (GPU *gpu);+#define GPU_setBLDCNT_LOW(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF00) | val; SetupFinalPixelBlitter (gpu);}+#define GPU_setBLDCNT_HIGH(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF) | (val<<8); SetupFinalPixelBlitter (gpu);}+#define GPU_setBLDCNT(gpu, val) {gpu->BLDCNT = val; SetupFinalPixelBlitter (gpu);}++#define GPU_setBLDALPHA(gpu, val) {gpu->BLDALPHA_EVA = (val&0x1f) > 16 ? 16 : (val&0x1f);\+gpu->BLDALPHA_EVB = (val>>8&0x1f) > 16 ? 16 : (val>>8&0x1f);}+#define GPU_setBLDALPHA_EVA(gpu, val) {gpu->BLDALPHA_EVA = (val&0x1f) > 16 ? 16 : (val&0x1f);}+#define GPU_setBLDALPHA_EVB(gpu, val) {gpu->BLDALPHA_EVB = (val&0x1f) > 16 ? 16 : (val&0x1f);}++#define GPU_setBLDY_EVY(gpu, val) {gpu->BLDY_EVY = (val&0x1f) > 16 ? 16 : (val&0x1f);}++#define GPU_setBGxHOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxHOFS = (val & 0x1F)+#define GPU_setBGxVOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxVOFS = (val & 0x1F)++#endif+Modified: trunk/desmume/src/gfx3d.cpp===================================================================--- trunk/desmume/src/gfx3d.cpp2008-12-27 02:42:54 UTC (rev 1253)+++ trunk/desmume/src/gfx3d.cpp2008-12-27 03:49:18 UTC (rev 1254)@@ -1089,68 +1089,72 @@ return gxstat; } -#define NOPARAMS() \-for (;;) \-{\-switch (clCmd & 0xFF)\-{\-case 0x00:\-{\-if (clInd > 0)\-{\-clCmd >>= 8;\-clInd--;\-continue;\-}\-clCmd = 0;\-break;\-}\-case 0x11:\-{\-GFX_FIFOadd(&MMU.gfx_fifo);\-*(u32 *)(ARM9Mem.ARM9_REG + 0x444) = val;\-gfx3d_glPushMatrix();\-clCmd >>= 8;\-clInd--;\-continue;\-}\-case 0x15:\-{\-GFX_FIFOadd(&MMU.gfx_fifo);\-*(u32 *)(ARM9Mem.ARM9_REG + 0x454) = val;\-gfx3d_glLoadIdentity();\-clCmd >>= 8;\-clInd--;\-continue;\-}\-case 0x41:\-{\-GFX_FIFOadd(&MMU.gfx_fifo);\-*(u32 *)(ARM9Mem.ARM9_REG + 0x504) = val;\-gfx3d_glEnd();\-clCmd >>= 8;\-clInd--;\-continue;\-}\-}\-break;\+void NOPARAMS(u32 val)+{+for (;;)+{+switch (clCmd & 0xFF)+{+case 0x00:+{+if (clInd > 0)+{+clCmd >>= 8;+clInd--;+continue;+}+clCmd = 0;+break;+}+case 0x11:+{+GFX_FIFOadd(&MMU.gfx_fifo);+*(u32 *)(ARM9Mem.ARM9_REG + 0x444) = val;+gfx3d_glPushMatrix();+clCmd >>= 8;+clInd--;+continue;+}+case 0x15:+{+GFX_FIFOadd(&MMU.gfx_fifo);+*(u32 *)(ARM9Mem.ARM9_REG + 0x454) = val;+gfx3d_glLoadIdentity();+clCmd >>= 8;+clInd--;+continue;+}+case 0x41:+{+GFX_FIFOadd(&MMU.gfx_fifo);+*(u32 *)(ARM9Mem.ARM9_REG + 0x504) = val;+gfx3d_glEnd();+clCmd >>= 8;+clInd--;+continue;+}+}+break; }+} -#define SETCOUNTCOMMANDS() \-if (!clCmd) clInd = 0;\-else\-{\-u32 tmp_chk = 0xFF000000;\-for (int t = 4; t > 0; t--)\-{\-if ((clCmd & tmp_chk))\-{\-clInd = t;\-break;\-}\-tmp_chk >>= 8;\-}\+void SETCOUNTCOMMANDS()+{+if (!clCmd) clInd = 0;+else+{+u32 tmp_chk = 0xFF000000;+for (int t = 4; t > 0; t--)+{+if ((clCmd & tmp_chk))+{+clInd = t;+break;+}+tmp_chk >>= 8;+} }+} void gfx3d_Add_Command(u32 val) {@@ -1160,7 +1164,7 @@ if (val == 0) return; clCmd = val; SETCOUNTCOMMANDS();-NOPARAMS();+NOPARAMS(val); return; } @@ -1377,7 +1381,7 @@ return; } GFX_FIFOadd(&MMU.gfx_fifo);-NOPARAMS();+NOPARAMS(val); } void gfx3d_Add_Command_Direct(u32 cmd, u32 val)This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1438] trunk/desmume/src

From: <ric...@us...> - 2009-01-12 20:48:37

Revision: 1438 Author: riccardomDate: 2009-01-12 20:48:31 +0000 (Mon, 12 Jan 2009)Log Message:-----------Move stub mic implementation for not win32 platforms to a separate file.Modified Paths:-------------- trunk/desmume/src/Makefile.am trunk/desmume/src/mic.hAdded Paths:----------- trunk/desmume/src/mic.cppModified: trunk/desmume/src/Makefile.am===================================================================--- trunk/desmume/src/Makefile.am2009-01-12 17:53:01 UTC (rev 1437)+++ trunk/desmume/src/Makefile.am2009-01-12 20:48:31 UTC (rev 1438)@@ -45,7 +45,8 @@ utils/decrypt/crc.cpp utils/decrypt/crc.h utils/decrypt/decrypt.cpp \ utils/decrypt/decrypt.h utils/decrypt/header.cpp utils/decrypt/header.h \ addons.c addons.h \-addons/compactFlash.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp+addons/compactFlash.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp \+mic.cpp mic.h if HAVE_GDB_STUB libdesmume_a_SOURCES += gdbstub.h endifAdded: trunk/desmume/src/mic.cpp===================================================================--- trunk/desmume/src/mic.cpp (rev 0)+++ trunk/desmume/src/mic.cpp2009-01-12 20:48:31 UTC (rev 1438)@@ -0,0 +1,23 @@+#ifndef WIN32++#include "types.h"+#include "mic.h"++BOOL Mic_Init()+{+return TRUE;+}++void Mic_Reset()+{+}++void Mic_DeInit()+{+}++u8 Mic_ReadSample() {+return 0;+}++#endifModified: trunk/desmume/src/mic.h===================================================================--- trunk/desmume/src/mic.h2009-01-12 17:53:01 UTC (rev 1437)+++ trunk/desmume/src/mic.h2009-01-12 20:48:31 UTC (rev 1438)@@ -1,21 +1,9 @@ #ifndef MIC_H #define MIC_H -#ifdef WIN32- BOOL Mic_Init(); void Mic_Reset(); void Mic_DeInit(); u8 Mic_ReadSample(); -#else-/* TODO : mic support for other platforms */--BOOL Mic_Init() { return TRUE; }-void Mic_Reset() { }-void Mic_DeInit() { }-u8 Mic_ReadSample() { return 0; }- #endif--#endifThis was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1587] trunk/desmume/src

From: <ze...@us...> - 2009-02-02 22:16:20

Revision: 1587 Author: zeromusDate: 2009-02-02 22:09:09 +0000 (Mon, 02 Feb 2009)Log Message:-----------software rasterizer stub complete with terrible flat shaded tri rendererModified Paths:-------------- trunk/desmume/src/windows/DeSmuME_2005.vcproj trunk/desmume/src/windows/main.cppAdded Paths:----------- trunk/desmume/src/rasterize.cpp trunk/desmume/src/rasterize.hAdded: trunk/desmume/src/rasterize.cpp===================================================================--- trunk/desmume/src/rasterize.cpp (rev 0)+++ trunk/desmume/src/rasterize.cpp2009-02-02 22:09:09 UTC (rev 1587)@@ -0,0 +1,299 @@+/* Copyright (C) 2006 yopyop+ yop...@if...+ yopyop156.ifrance.com++Copyright 2009 DeSmuME team++ 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA+*/++#include "Rasterize.h"+#include "common.h"+#include "render3D.h"+#include "gfx3d.h"+#include <algorithm>++using std::min;+using std::max;++template<typename T> T min(T a, T b, T c) { return min(min(a,b),c); }+template<typename T> T max(T a, T b, T c) { return max(max(a,b),c); }+++static u16 screen[256*192];++void set_pixel(int x, int y, u16 color)+{+if(x<0 || y<0 || x>=256 || y>=192) return;+screen[y*256+x] = color | 0x8000;+}++void hline(int x, int y, int xe, u16 color)+{+for(int i=x;i<=xe;i++)+set_pixel(x,y,color);+}++//http://www.devmaster.net/forums/showthread.php?t=1884++int iround(float f) {+return (int)f; //lol+}++void triangle_from_devmaster(int x1, int y1, int x2, int y2, int x3, int y3, u16 color)+{+int desty = 0;+struct Vertex {+int x,y;+} v1, v2, v3;+v1.x = x1;+v1.y = y1;+v2.x = x2;+v2.y = y2;+v3.x = x3;+v3.y = y3;++ // 28.4 fixed-point coordinates+ const int Y1 = iround(16.0f * v1.y);+ const int Y2 = iround(16.0f * v2.y);+ const int Y3 = iround(16.0f * v3.y);++ const int X1 = iround(16.0f * v1.x);+ const int X2 = iround(16.0f * v2.x);+ const int X3 = iround(16.0f * v3.x);++ // Deltas+ const int DX12 = X1 - X2;+ const int DX23 = X2 - X3;+ const int DX31 = X3 - X1;++ const int DY12 = Y1 - Y2;+ const int DY23 = Y2 - Y3;+ const int DY31 = Y3 - Y1;++ // Fixed-point deltas+ const int FDX12 = DX12 << 4;+ const int FDX23 = DX23 << 4;+ const int FDX31 = DX31 << 4;++ const int FDY12 = DY12 << 4;+ const int FDY23 = DY23 << 4;+ const int FDY31 = DY31 << 4;++ // Bounding rectangle+ int minx = (min(X1, X2, X3) + 0xF) >> 4;+ int maxx = (max(X1, X2, X3) + 0xF) >> 4;+ int miny = (min(Y1, Y2, Y3) + 0xF) >> 4;+ int maxy = (max(Y1, Y2, Y3) + 0xF) >> 4;++ // Block size, standard 8x8 (must be power of two)+ const int q = 8;++ // Start in corner of 8x8 block+ minx &= ~(q - 1);+ miny &= ~(q - 1);++ //(char*&)colorBuffer += miny * stride;+desty = miny;++ // Half-edge constants+ int C1 = DY12 * X1 - DX12 * Y1;+ int C2 = DY23 * X2 - DX23 * Y2;+ int C3 = DY31 * X3 - DX31 * Y3;++ // Correct for fill convention+ if(DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++;+ if(DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++;+ if(DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++;++ // Loop through blocks+ for(int y = miny; y < maxy; y += q)+ {+ for(int x = minx; x < maxx; x += q)+ {+ // Corners of block+ int x0 = x << 4;+ int x1 = (x + q - 1) << 4;+ int y0 = y << 4;+ int y1 = (y + q - 1) << 4;++ // Evaluate half-space functions+ bool a00 = C1 + DX12 * y0 - DY12 * x0 > 0;+ bool a10 = C1 + DX12 * y0 - DY12 * x1 > 0;+ bool a01 = C1 + DX12 * y1 - DY12 * x0 > 0;+ bool a11 = C1 + DX12 * y1 - DY12 * x1 > 0;+ int a = (a00 << 0) | (a10 << 1) | (a01 << 2) | (a11 << 3);+ + bool b00 = C2 + DX23 * y0 - DY23 * x0 > 0;+ bool b10 = C2 + DX23 * y0 - DY23 * x1 > 0;+ bool b01 = C2 + DX23 * y1 - DY23 * x0 > 0;+ bool b11 = C2 + DX23 * y1 - DY23 * x1 > 0;+ int b = (b00 << 0) | (b10 << 1) | (b01 << 2) | (b11 << 3);+ + bool c00 = C3 + DX31 * y0 - DY31 * x0 > 0;+ bool c10 = C3 + DX31 * y0 - DY31 * x1 > 0;+ bool c01 = C3 + DX31 * y1 - DY31 * x0 > 0;+ bool c11 = C3 + DX31 * y1 - DY31 * x1 > 0;+ int c = (c00 << 0) | (c10 << 1) | (c01 << 2) | (c11 << 3);++ // Skip block when outside an edge+ if(a == 0x0 || b == 0x0 || c == 0x0) continue;++ //unsigned int *buffer = colorBuffer;+int _desty = desty;++ // Accept whole block when totally covered+ if(a == 0xF && b == 0xF && c == 0xF)+ {+ for(int iy = 0; iy < q; iy++)+ {+ for(int ix = x; ix < x + q; ix++)+ {+ //buffer[ix] = 0x00007F00;<< // Green+set_pixel(ix,_desty,color);+ }++ //(char*&)buffer += stride;+_desty++;++ }+ }+ else // Partially covered block+ {+ int CY1 = C1 + DX12 * y0 - DY12 * x0;+ int CY2 = C2 + DX23 * y0 - DY23 * x0;+ int CY3 = C3 + DX31 * y0 - DY31 * x0;++ for(int iy = y; iy < y + q; iy++)+ {+ int CX1 = CY1;+ int CX2 = CY2;+ int CX3 = CY3;++ for(int ix = x; ix < x + q; ix++)+ {+ if(CX1 > 0 && CX2 > 0 && CX3 > 0)+ {+ //buffer[ix] = 0x0000007F;<< // Blue+set_pixel(ix,_desty,color);+ }++ CX1 -= FDY12;+ CX2 -= FDY23;+ CX3 -= FDY31;+ }++ CY1 += FDX12;+ CY2 += FDX23;+ CY3 += FDX31;++ //(char*&)buffer += stride;+_desty ++;+ }+ }+ }++ //(char*&)colorBuffer += q * stride;+desty += q;+ }+}++static char Init(void)+{+return 1;+}++static void Reset() {}++static void Close() {}++static void VramReconfigureSignal() {}++static void GetLine(int line, u16* dst, u8* dstAlpha)+{+memcpy(dst,screen+(191-line)*256,512);+memset(dstAlpha,16,256);+}++static void GetLineCaptured(int line, u16* dst) {}++static void Render()+{+//transform verts and polys+//which order?+//A. clip+//B. backface cull+//C. transforms++memset(screen,0,256*192*2);++for(int i=0;i<gfx3d.vertlist->count;i++)+{+VERT &vert = gfx3d.vertlist->list[i];++//perspective division+vert.coord[0] = (vert.coord[0] + vert.coord[3]) / 2 / vert.coord[3];+vert.coord[1] = (vert.coord[1] + vert.coord[3]) / 2 / vert.coord[3];+vert.coord[2] = (vert.coord[2] + vert.coord[3]) / 2 / vert.coord[3];+vert.coord[3] = 1;++//transform to viewport. this is badly broken+vert.coord[0] = (vert.coord[0])*128;+vert.coord[1] = (vert.coord[1])*96;++int zzz=9;+}++++//iterate over gfx3d.polylist and gfx3d.vertlist+for(int i=0;i<gfx3d.polylist->count;i++) {+POLY *poly = &gfx3d.polylist->list[gfx3d.indexlist[i]];+int type = poly->type;+++if(type == 3) {+VERT* vert[3] = {+&gfx3d.vertlist->list[poly->vertIndexes[0]],+&gfx3d.vertlist->list[poly->vertIndexes[1]],+&gfx3d.vertlist->list[poly->vertIndexes[2]],+};+u16 color = vert[0]->color[0] | (vert[0]->color[1]<<5) | (vert[0]->color[2]<<10);+++triangle_from_devmaster(+vert[0]->coord[0],vert[0]->coord[1],+vert[1]->coord[0],vert[1]->coord[1],+vert[2]->coord[0],vert[2]->coord[1],+color);+}++}++}+++GPU3DInterface gpu3DRasterize = {+"SoftRasterizer",+Init,+Reset,+Close,+Render,+VramReconfigureSignal,+GetLine,+GetLineCaptured+};Added: trunk/desmume/src/rasterize.h===================================================================--- trunk/desmume/src/rasterize.h (rev 0)+++ trunk/desmume/src/rasterize.h2009-02-02 22:09:09 UTC (rev 1587)@@ -0,0 +1,31 @@+/* Copyright (C) 2006 yopyop+ yop...@if...+ yopyop156.ifrance.com++Copyright 2009 DeSmuME team++ 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA+*/++#ifndef _RASTERIZE_H_+#define _RASTERIZE_H_++#include "render3D.h"++extern GPU3DInterface gpu3DRasterize;++#endifModified: trunk/desmume/src/windows/DeSmuME_2005.vcproj===================================================================--- trunk/desmume/src/windows/DeSmuME_2005.vcproj2009-02-02 22:03:27 UTC (rev 1586)+++ trunk/desmume/src/windows/DeSmuME_2005.vcproj2009-02-02 22:09:09 UTC (rev 1587)@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++"-Version="8,00"+Version="8.00" Name="DeSmuME_VS2005" ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}" RootNamespace="DeSmuME"@@ -1057,6 +1057,14 @@ > </File> <File+RelativePath="..\rasterize.cpp"+>+</File>+<File+RelativePath="..\rasterize.h"+>+</File>+<File RelativePath="..\readwrite.cpp" > </File>Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2009-02-02 22:03:27 UTC (rev 1586)+++ trunk/desmume/src/windows/main.cpp2009-02-02 22:09:09 UTC (rev 1587)@@ -58,6 +58,7 @@ #include "FirmConfig.h" #include "AboutBox.h" #include "OGLRender.h"+#include "rasterize.h" #include "../gfx3d.h" #include "../render3D.h" #include "../gdbstub.h"@@ -185,6 +186,7 @@ GPU3DInterface *core3DList[] = { &gpu3DNull, &gpu3Dgl,+&gpu3DRasterize, NULL }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[2541] trunk/desmume/src

From: <ze...@us...> - 2009-07-12 03:52:04

Revision: 2541 Author: zeromusDate: 2009-07-12 03:52:02 +0000 (Sun, 12 Jul 2009)Log Message:-----------refactor save slot display; first example of hud operating in linuxModified Paths:-------------- trunk/desmume/src/GPU_osd.cpp trunk/desmume/src/saves.cpp trunk/desmume/src/saves.h trunk/desmume/src/windows/hotkey.cpp trunk/desmume/src/windows/main.cpp trunk/desmume/src/windows/main.hModified: trunk/desmume/src/GPU_osd.cpp===================================================================--- trunk/desmume/src/GPU_osd.cpp2009-07-12 03:43:28 UTC (rev 2540)+++ trunk/desmume/src/GPU_osd.cpp2009-07-12 03:52:02 UTC (rev 2541)@@ -33,7 +33,9 @@ #include "movie.h" #include "NDSSystem.h" #include "mic.h"+#include "saves.h" + OSDCLASS*osd = NULL; HudStruct Hud; @@ -169,16 +171,10 @@ static int yheight; static int xpos;-static int previousslot;+static int previousslot = 0; static int fadecounter; static char number[10]; -#ifdef WIN32-#include "main.h"-#else-int lastSaveState = 0;-#endif- static void DrawStateSlots(){ aggDraw.hud->lineWidth(1.0);@@ -422,4 +418,4 @@ void OSDCLASS::border(bool enabled) { //render51.setTextBoxBorder(enabled);-}\ No newline at end of file+}Modified: trunk/desmume/src/saves.cpp===================================================================--- trunk/desmume/src/saves.cpp2009-07-12 03:43:28 UTC (rev 2540)+++ trunk/desmume/src/saves.cpp2009-07-12 03:52:02 UTC (rev 2541)@@ -39,10 +39,12 @@ #include "readwrite.h" #include "gfx3d.h" #include "movie.h"+ #ifdef _MSC_VER #include "windows/main.h" #endif +int lastSaveState = 0;//Keeps track of last savestate used for quick save/load functions //void*v is actually a void** which will be indirected before reading //since this isnt supported right now, it is declared in here to make things compile@@ -481,6 +483,8 @@ struct stat sbuf; char filename[MAX_PATH]; +lastSaveState = num;//Set last savestate used+ #ifdef WIN32 GetFullPathNoExt(STATES, filename, MAX_PATH); #else@@ -511,6 +515,8 @@ { char filename[MAX_PATH]; + lastSaveState = num;//Set last savestate used+ #ifdef WIN32 GetFullPathNoExt(STATES, filename, MAX_PATH); #elseModified: trunk/desmume/src/saves.h===================================================================--- trunk/desmume/src/saves.h2009-07-12 03:43:28 UTC (rev 2540)+++ trunk/desmume/src/saves.h2009-07-12 03:52:02 UTC (rev 2541)@@ -27,6 +27,8 @@ #define SRAM_SIZE0x10000 #define NB_STATES 10 +extern int lastSaveState;+ typedef struct { BOOL exists;Modified: trunk/desmume/src/windows/hotkey.cpp===================================================================--- trunk/desmume/src/windows/hotkey.cpp2009-07-12 03:43:28 UTC (rev 2540)+++ trunk/desmume/src/windows/hotkey.cpp2009-07-12 03:52:02 UTC (rev 2541)@@ -152,7 +152,6 @@ else savestate_slot(num);//Savestate -lastSaveState = num;//Set last savestate used LoadSaveStateInfo(); } }Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2009-07-12 03:43:28 UTC (rev 2540)+++ trunk/desmume/src/windows/main.cpp2009-07-12 03:52:02 UTC (rev 2541)@@ -138,7 +138,6 @@ static BOOL OpenCore(const char* filename); -unsigned int lastSaveState = 0;//Keeps track of last savestate used for quick save/load functions //----Recent ROMs menu globals---------- vector<string> RecentRoms;//The list of recent ROM filenames const unsigned int MAX_RECENT_ROMS = 10;//To change the recent rom max, simply change this numberModified: trunk/desmume/src/windows/main.h===================================================================--- trunk/desmume/src/windows/main.h2009-07-12 03:43:28 UTC (rev 2540)+++ trunk/desmume/src/windows/main.h2009-07-12 03:52:02 UTC (rev 2541)@@ -7,7 +7,6 @@ extern volatile BOOL execute, paused; void NDS_Pause(); void NDS_UnPause();-extern unsigned int lastSaveState; void LoadSaveStateInfo(); void Display(); void Pause();This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[2576] trunk/desmume/src

From: <mta...@us...> - 2009-07-15 22:46:41

Revision: 2576 Author: mtabachenkoDate: 2009-07-15 22:46:33 +0000 (Wed, 15 Jul 2009)Log Message:-----------new gxFIFO:- fix for work with new emuloop;- add early implementation of pipeline;Modified Paths:-------------- trunk/desmume/src/FIFO.cpp trunk/desmume/src/FIFO.h trunk/desmume/src/MMU.cpp trunk/desmume/src/gfx3d.cppModified: trunk/desmume/src/FIFO.cpp===================================================================--- trunk/desmume/src/FIFO.cpp2009-07-15 21:57:23 UTC (rev 2575)+++ trunk/desmume/src/FIFO.cpp2009-07-15 22:46:33 UTC (rev 2576)@@ -137,8 +137,14 @@ } // ========================================================= GFX FIFO+GFX_PIPEgxPIPE; GFX_FIFOgxFIFO; +void GFX_PIPEclear()+{+gxPIPE.tail = 0;+}+ void GFX_FIFOclear() { u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);@@ -151,10 +157,31 @@ void GFX_FIFOsend(u8 cmd, u32 param) {-//INFO("GFX FIFO: Send GFX 3D cmd 0x%02X to FIFO - 0x%08X (%03i/%02X)\n", cmd, param, gxFIFO.tail, gxFIFO.tail); u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);-if (gxstat & 0x01000000) return;// full +if (gxFIFO.tail == 0)// FIFO empty+{+if (gxPIPE.tail < 4)// pipe not full+{+gxPIPE.cmd[gxPIPE.tail] = cmd;+gxPIPE.param[gxPIPE.tail] = param;+gxPIPE.tail++;+#ifdef USE_GEOMETRY_FIFO_EMULATION+gxstat |= 0x08000000;// set busy flag+T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);+#endif+NDS_RescheduleGXFIFO();+return;+}+}++//INFO("GFX FIFO: Send GFX 3D cmd 0x%02X to FIFO - 0x%08X (%03i/%02X)\n", cmd, param, gxFIFO.tail, gxFIFO.tail);+if (gxstat & 0x01000000)+{+//INFO("ERROR: gxFIFO is full\n");+return;// full+}+ gxstat &= 0xF000FFFF; gxFIFO.cmd[gxFIFO.tail] = cmd;@@ -175,47 +202,31 @@ #endif T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);-+ NDS_RescheduleGXFIFO(); } BOOL GFX_FIFOrecv(u8 *cmd, u32 *param) { u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);-#if 0-if (gxstat & 0xC0000000)++if (gxFIFO.tail == 0)// empty {-setIF(0, (1<<21));-//NDS_makeARM9Int(21);-}-#endif-if (gxFIFO.tail == 0)// empty-{ gxstat &= 0xF000FFFF; gxstat |= 0x06000000; T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);-if ((gxstat & 0x80000000))// empty+if ((gxstat & 0x80000000))// IRQ: empty { setIF(0, (1<<21));-//NDS_makeARM9Int(21); } return FALSE; } if (gxstat & 0x40000000)// IRQ: less half {-if (gxstat & 0x02000000) -setIF(0, (1<<21));-//NDS_makeARM9Int(21);+if (gxstat & 0x02000000) setIF(0, (1<<21)); } -if ((gxstat & 0x80000000))// IRQ: empty-{-if (gxstat & 0x04000000) -setIF(0, (1<<21));-//NDS_makeARM9Int(21);-}- gxstat &= 0xF000FFFF; *cmd = gxFIFO.cmd[0]; *param = gxFIFO.param[0];@@ -226,28 +237,81 @@ gxFIFO.param[i] = gxFIFO.param[i+1]; } -#ifdef USE_GEOMETRY_FIFO_EMULATION-gxstat |= 0x08000000;// set busy flag-#endif- gxstat |= (gxFIFO.tail << 16); if (gxFIFO.tail < 128) gxstat |= 0x02000000; +if (gxFIFO.tail == 0)// empty+gxstat |= 0x04000000;+else+gxstat |= 0x08000000;// set busy flag+ T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat); -NDS_RescheduleGXFIFO();- return TRUE; } +BOOL GFX_PIPErecv(u8 *cmd, u32 *param)+{+u8tmp_cmd = 0;+u32tmp_param = 0;+u32 gxstat = 0;++if (gxPIPE.tail > 0)+{+*cmd = gxPIPE.cmd[0];+*param = gxPIPE.param[0];+gxPIPE.tail--;+for (int i=0; i < gxPIPE.tail; i++)+{+gxPIPE.cmd[i] = gxPIPE.cmd[i+1];+gxPIPE.param[i] = gxPIPE.param[i+1];+}++if (gxPIPE.tail < 2) +{+if (GFX_FIFOrecv(&tmp_cmd, &tmp_param))+{+gxPIPE.cmd[gxPIPE.tail] = tmp_cmd;+gxPIPE.param[gxPIPE.tail] = tmp_param;+gxPIPE.tail++;+++if (GFX_FIFOrecv(&tmp_cmd, &tmp_param))+{+gxPIPE.cmd[gxPIPE.tail] = tmp_cmd;+gxPIPE.param[gxPIPE.tail] = tmp_param;+gxPIPE.tail++;+}+}+}++if (gxPIPE.tail == 0)+{+gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);+gxstat &= 0xF7FFFFFF;// clear busy flag+T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);+}+return (TRUE);+}+gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);+gxstat &= 0xF7FFFFFF;// clear busy flag+if ((gxstat & 0x80000000))// IRQ: empty+{+if (gxFIFO.tail == 0) setIF(0, (1<<21));+}+T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);+return FALSE;+}+ void GFX_FIFOcnt(u32 val) { u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600); //INFO("GFX FIFO: write context 0x%08X (prev 0x%08X) tail %i\n", val, gxstat, gxFIFO.tail); if (val & (1<<29))// clear? (homebrew) {+GFX_PIPEclear(); GFX_FIFOclear(); return; }@@ -258,7 +322,6 @@ /*if (gxstat & 0xC0000000) { setIF(0, (1<<21));-//NDS_makeARM9Int(21); }*/ } Modified: trunk/desmume/src/FIFO.h===================================================================--- trunk/desmume/src/FIFO.h2009-07-15 21:57:23 UTC (rev 2575)+++ trunk/desmume/src/FIFO.h2009-07-15 22:46:33 UTC (rev 2576)@@ -26,7 +26,7 @@ #ifndef FIFO_H #define FIFO_H -//#define USE_GEOMETRY_FIFO_EMULATION //enables new experimental gxFIFO+//#define USE_GEOMETRY_FIFO_EMULATION //enable gxFIFO emulation #include "types.h" @@ -47,16 +47,26 @@ //=================================================== GFX FIFO typedef struct {-u8cmd[261];-u32param[261];+u8cmd[257];+u32param[257]; u16tail;// tail } GFX_FIFO; +typedef struct+{+u8cmd[5];+u32param[5];++u8tail;+} GFX_PIPE;++extern GFX_PIPE gxPIPE; extern GFX_FIFO gxFIFO;+extern void GFX_PIPEclear(); extern void GFX_FIFOclear(); extern void GFX_FIFOsend(u8 cmd, u32 param);-extern BOOL GFX_FIFOrecv(u8 *cmd, u32 *param);+extern BOOL GFX_PIPErecv(u8 *cmd, u32 *param); extern void GFX_FIFOcnt(u32 val); //=================================================== Display memory FIFOModified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2009-07-15 21:57:23 UTC (rev 2575)+++ trunk/desmume/src/MMU.cpp2009-07-15 22:46:33 UTC (rev 2576)@@ -894,6 +894,7 @@ IPC_FIFOinit(ARMCPU_ARM9); IPC_FIFOinit(ARMCPU_ARM7);+GFX_PIPEclear(); GFX_FIFOclear(); DISP_FIFOinit(); @@ -951,6 +952,7 @@ IPC_FIFOinit(ARMCPU_ARM9); IPC_FIFOinit(ARMCPU_ARM7);+GFX_PIPEclear(); GFX_FIFOclear(); DISP_FIFOinit(); Modified: trunk/desmume/src/gfx3d.cpp===================================================================--- trunk/desmume/src/gfx3d.cpp2009-07-15 21:57:23 UTC (rev 2575)+++ trunk/desmume/src/gfx3d.cpp2009-07-15 22:46:33 UTC (rev 2576)@@ -61,10 +61,8 @@ static void gfx3d_doFlush(); #ifdef USE_GEOMETRY_FIFO_EMULATION-inline void GFX_DELAY(int x) { -MMU.gfx3dCycles = nds_timer + (2*x); NDS_RescheduleGXFIFO(); }-inline void GFX_DELAY_M2(int x) { -MMU.gfx3dCycles += (2*x); NDS_RescheduleGXFIFO(); }+#define GFX_DELAY(x) MMU.gfx3dCycles = nds_timer + (1*x);+#define GFX_DELAY_M2(x) MMU.gfx3dCycles += (1*x); #else #define GFX_DELAY(x) #define GFX_DELAY_M2(x)@@ -366,6 +364,7 @@ gfx3d.clearDepth = gfx3d_extendDepth_15_to_24(0x7FFF); +GFX_PIPEclear(); GFX_FIFOclear(); #ifdef USE_GEOMETRY_FIFO_EMULATION@@ -1528,8 +1527,9 @@ break; default: INFO("Unknown execute FIFO 3D command 0x%02X with param 0x%08X\n", cmd, param);-break;+return; }+NDS_RescheduleGXFIFO(); } void gfx3d_execute3D()@@ -1539,7 +1539,7 @@ if (isSwapBuffers) return; -if (GFX_FIFOrecv(&cmd, &param))+if (GFX_PIPErecv(&cmd, &param)) { gfx3d_execute(cmd, param); #if 0@@ -1631,6 +1631,7 @@ gfx3d.frameCtr++; #ifndef USE_GEOMETRY_FIFO_EMULATION+GFX_PIPEclear(); GFX_FIFOclear(); // reset clInd = 0;@@ -1718,12 +1719,14 @@ gfx3d_doFlush(); isSwapBuffers = false; GFX_DELAY(392);+NDS_RescheduleGXFIFO(); } #else //the 3d buffers are swapped when a vblank begins. //so, if we have a redraw pending, now is a safe time to do it if(!flushPending) {+GFX_PIPEclear(); GFX_FIFOclear(); return; }@@ -1748,11 +1751,10 @@ { memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedScreen)); memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedAlpha));+return; }-else-{-gpu3D->NDS_3D_Render();-}++gpu3D->NDS_3D_Render(); #else //if we are skipping 3d frames then the 3d rendering will get held up here. //but, as soon as we quit skipping frames, the held-up 3d frame will render@@ -2432,8 +2434,11 @@ { "GLPT", 4, 1, &PTind}, { "GLPC", 4, 4, PTcoords}, { "GLF9", 4, 1, &gxFIFO.tail},-{ "GLF9", 1, 261, &gxFIFO.cmd[0]},-{ "GLF9", 4, 261, &gxFIFO.param[0]},+{ "GLF9", 1, 257, &gxFIFO.cmd[0]},+{ "GLF9", 4, 257, &gxFIFO.param[0]},+{ "GLP9", 4, 1, &gxPIPE.tail},+{ "GLP9", 1, 5, &gxPIPE.cmd[0]},+{ "GLP9", 4, 5, &gxPIPE.param[0]}, { "GCOL", 1, 4, colorRGB}, { "GLCO", 4, 4, lightColor}, { "GLDI", 4, 4, lightDirection},This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[2634] trunk/desmume/src

From: <ze...@us...> - 2009-07-21 01:55:45

Revision: 2634 Author: zeromusDate: 2009-07-21 01:55:16 +0000 (Tue, 21 Jul 2009)Log Message:-----------win32: what's this..? is it..? could it be..? indeed, it is! a multicore optimization! now featuring all final display logic triple-buffered in another thread. offloads to another thread: rotation, color conversion, filter scaling, and directdraw buffer copy. this makes filter scaling effectively costless.Modified Paths:-------------- trunk/desmume/src/agg2d.h trunk/desmume/src/commandline.cpp trunk/desmume/src/commandline.h trunk/desmume/src/windows/main.cpp trunk/desmume/src/windows/video.hModified: trunk/desmume/src/agg2d.h===================================================================--- trunk/desmume/src/agg2d.h2009-07-21 00:08:52 UTC (rev 2633)+++ trunk/desmume/src/agg2d.h2009-07-21 01:55:16 UTC (rev 2634)@@ -400,6 +400,7 @@ unsigned width() const { return m_rbuf.width(); } unsigned height() const { return m_rbuf.height(); }+unsigned stride() const { return m_rbuf.stride(); } // Conversions //-----------------------Modified: trunk/desmume/src/commandline.cpp===================================================================--- trunk/desmume/src/commandline.cpp2009-07-21 00:08:52 UTC (rev 2633)+++ trunk/desmume/src/commandline.cpp2009-07-21 01:55:16 UTC (rev 2634)@@ -36,6 +36,7 @@ { load_slot = 0; arm9_gdb_port = arm7_gdb_port = 0;+single_core = 0; start_paused = FALSE; } @@ -63,6 +64,9 @@ { "start-paused", 0, 0, G_OPTION_ARG_NONE, &start_paused, "Indicates that emulation should start paused", "START_PAUSED"}, { "cflash-image", 0, 0, G_OPTION_ARG_FILENAME, &_cflash_image, "Requests cflash in gbaslot with fat image at this path", "CFLASH_IMAGE"}, { "cflash-path", 0, 0, G_OPTION_ARG_FILENAME, &_cflash_path, "Requests cflash in gbaslot with filesystem rooted at this path", "CFLASH_PATH"},+#ifdef _MSC_VER+{ "single-core", 0, 0, G_OPTION_ARG_NONE, &single_core, "Limit execution to use approximately only one core", "NUM_CORES"},+#endif #ifdef GDB_STUB { "arm9gdb", 0, 0, G_OPTION_ARG_INT, &arm9_gdb_port, "Enable the ARM9 GDB stub on the given port", "PORT_NUM"}, { "arm7gdb", 0, 0, G_OPTION_ARG_INT, &arm7_gdb_port, "Enable the ARM7 GDB stub on the given port", "PORT_NUM"},Modified: trunk/desmume/src/commandline.h===================================================================--- trunk/desmume/src/commandline.h2009-07-21 00:08:52 UTC (rev 2633)+++ trunk/desmume/src/commandline.h2009-07-21 01:55:16 UTC (rev 2634)@@ -41,6 +41,7 @@ std::string play_movie_file; std::string record_movie_file; int arm9_gdb_port, arm7_gdb_port;+int single_core; int start_paused; std::string cflash_image; std::string cflash_path;Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2009-07-21 00:08:52 UTC (rev 2633)+++ trunk/desmume/src/windows/main.cpp2009-07-21 01:55:16 UTC (rev 2634)@@ -715,7 +715,8 @@ } } -void Display()+//the directdraw final presentation portion of display, including rotating+static void DD_DoDisplay() { int res; memset(&ddsd, 0, sizeof(ddsd));@@ -785,6 +786,94 @@ } } +//tripple buffering logic+u16 displayBuffers[3][256*192*4];+int currDisplayBuffer=-1;+int newestDisplayBuffer=-2;+GMutex *display_mutex = NULL;+GThread *display_thread = NULL;++//does a single display work unit. only to be used from the display thread+static void DoDisplay()+{+osd->update();+DrawHUD();+video.filter();+DD_DoDisplay();+osd->clear();+}++void displayProc()+{+g_mutex_lock(display_mutex);++//find a buffer to display+int todo = newestDisplayBuffer;+bool alreadyDisplayed = (todo == currDisplayBuffer);++g_mutex_unlock(display_mutex);++//nothing to display. give up.+if(alreadyDisplayed) return;++//start displaying a new buffer+currDisplayBuffer = todo;++video.srcBuffer = (u8*)displayBuffers[currDisplayBuffer];++aggDraw.hud->attach(video.srcBuffer, 256, 384, 512);++DoDisplay();+}+++void displayThread(void*)+{+for(;;) {+displayProc();+Sleep(10); //don't be greedy and use a whole cpu core, but leave room for 60fps +}+}++void Display()+{+if(display_thread == NULL)+{+display_mutex = g_mutex_new();+display_thread = g_thread_create( (GThreadFunc)displayThread,+ NULL,+ TRUE,+ NULL);+}++g_mutex_lock(display_mutex);++//huh... i wonder if there is a less ugly way to do this+if(currDisplayBuffer == 0)+if(newestDisplayBuffer == 1)+newestDisplayBuffer = 2;+else newestDisplayBuffer = 1;+else if(currDisplayBuffer == 1)+if(newestDisplayBuffer == 2)+newestDisplayBuffer = 0;+else newestDisplayBuffer = 2;+else //if(currDisplayBuffer == 1)+if(newestDisplayBuffer == 0)+newestDisplayBuffer = 1;+else newestDisplayBuffer = 0;++memcpy(displayBuffers[newestDisplayBuffer],GPU_screen,256*192*4);++g_mutex_unlock(display_mutex);++//the no-multithreading codepath+//but based on my research, this runs just fine on a single core system due to the generous+//sleep in the display loop+//video.srcBuffer = (u8*)GPU_screen;+//doDisplay();+}++ void CheckMessages() { MSG msg;@@ -887,11 +976,7 @@ Hud.fps = fps; Hud.fps3d = fps3d; -osd->update();-DrawHUD();-video.filter(); Display();-osd->clear(); gfx3d.frameCtrRaw++; if(gfx3d.frameCtrRaw == 60) {@@ -1411,6 +1496,9 @@ return 1; } +if(cmdline.single_core)+SetProcessAffinityMask(GetCurrentProcess(),1);+ //sprintf(text, "%s", DESMUME_NAME_AND_VERSION); MainWindow = new WINCLASS(CLASSNAME, hAppInst); DWORD dwStyle = WS_CAPTION| WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;@@ -2651,9 +2739,7 @@ hdc = BeginPaint(hwnd, &ps); -osd->update(); Display();-osd->clear(); EndPaint(hwnd, &ps); }Modified: trunk/desmume/src/windows/video.h===================================================================--- trunk/desmume/src/windows/video.h2009-07-21 00:08:52 UTC (rev 2633)+++ trunk/desmume/src/windows/video.h2009-07-21 01:55:16 UTC (rev 2634)@@ -12,6 +12,7 @@ int currentfilter; +u8* srcBuffer; CACHE_ALIGN u8 filteredbuffer[4*256*192*4]; enum {@@ -53,7 +54,7 @@ u16* finalBuffer() const { if(currentfilter == NONE)-return (u16*)GPU_screen;+return (u16*)srcBuffer; else return (u16*)filteredbuffer; } @@ -62,7 +63,7 @@ src.Height = 384; src.Width = 256; src.Pitch = 512;-src.Surface = (u8*)GPU_screen;+src.Surface = (u8*)srcBuffer; dst.Height = 768; dst.Width = 512;This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[2955] trunk/desmume/src

From: <ze...@us...> - 2009-10-12 07:41:56

Revision: 2955 Author: zeromusDate: 2009-10-12 07:41:16 +0000 (Mon, 12 Oct 2009)Log Message:-----------spu: fix the ancient bug in looping adpcm sounds which slew performance. this is what made the adpcm caching option necessary as a workaround. so--get rid of adpcm caching.Modified Paths:-------------- trunk/desmume/src/NDSSystem.h trunk/desmume/src/SPU.cpp trunk/desmume/src/SPU.h trunk/desmume/src/windows/main.cpp trunk/desmume/src/windows/resources.rcModified: trunk/desmume/src/NDSSystem.h===================================================================--- trunk/desmume/src/NDSSystem.h2009-10-11 21:32:32 UTC (rev 2954)+++ trunk/desmume/src/NDSSystem.h2009-10-12 07:41:16 UTC (rev 2955)@@ -429,7 +429,6 @@ , DebugConsole(false) , single_core(true) , spuInterpolationMode(SPUInterpolation_Linear)-, spuAdpcmCache(false) , gfx3d_flushMode(0) , manualBackupType(0) {@@ -464,7 +463,6 @@ } wifi; SPUInterpolationMode spuInterpolationMode;-bool spuAdpcmCache; //this is a temporary hack until we straighten out the flushing logic and/or gxfifo int gfx3d_flushMode;Modified: trunk/desmume/src/SPU.cpp===================================================================--- trunk/desmume/src/SPU.cpp2009-10-11 21:32:32 UTC (rev 2954)+++ trunk/desmume/src/SPU.cpp2009-10-12 07:41:16 UTC (rev 2955)@@ -32,6 +32,8 @@ #define M_PI 3.1415926535897932386 #endif +#define K_ADPCM_LOOPING_RECOVERY_INDEX 99999+ #include "debug.h" #include "MMU.h" #include "SPU.h"@@ -106,157 +108,6 @@ ////////////////////////////////////////////////////////////////////////////// -class ADPCMCacheItem-{-public:-ADPCMCacheItem() -: raw_copy(NULL)-, decoded(NULL)-, next(NULL)-, prev(NULL)-, lockCount(0)-{}-~ADPCMCacheItem() {-delete[] raw_copy;-delete[] decoded;-}-void unlock() { -lockCount--;-}-void lock() { -lockCount++;-}-u32 addr;-s8* raw_copy; //for memcmp-u32 raw_len;-u32 decode_len;-s16* decoded; //s16 decoded samples-ADPCMCacheItem *next, *prev; //double linked list-int lockCount;-};--//notes on the cache:-//I am really unhappy with the ref counting. this needs to be automatic.-//We could do something better than a linear search through cache items, but it may not be worth it.-//Also we may need to rescan more often (every time a sample loops)-class ADPCMCache-{-public:-ADPCMCache()-: list_front(NULL)-, list_back(NULL)-, cache_size(0)-{}--ADPCMCacheItem *list_front, *list_back;--//this ought to be enough for anyone-static const u32 kMaxCacheSize = 8*1024*1024; -//this is not really precise, it is off by a constant factor-u32 cache_size;--void evict(const u32 target = kMaxCacheSize) {-//evicts old cache items until it is less than the max cache size-//this means we actually can exceed the cache by the size of the next item.-//if we really wanted to hold ourselves to it, we could evict to kMaxCacheSize-nextItemSize-while(cache_size > target)-{-ADPCMCacheItem *oldest = list_back;-while(oldest && oldest->lockCount>0) oldest = oldest->prev; //find an unlocked one-if(!oldest) -{-//nothing we can do, everything in the cache is locked. maybe we're leaking.-//just quit trying to evict-return;-}-list_remove(oldest);-cache_size -= oldest->raw_len*2;-//printf("evicting! totalsize:%d\n",cache_size);-delete oldest;-}-}--//DO NOT USE THIS METHOD WITHOUT MAKING SURE YOU HAVE -//FREED THE CURRENT ADPCMCacheItem FIRST!-//we should do this with some kind of smart pointers, but i am too lazy-ADPCMCacheItem* scan(channel_struct *chan)-{-u32 addr = chan->addr;-s8* raw = chan->buf8;-u32 raw_len = chan->totlength * 4;-for(ADPCMCacheItem* curr = list_front;curr;curr=curr->next)-{-if(curr->addr != addr) continue;-if(curr->raw_len != raw_len) continue;-if(memcmp(curr->raw_copy,raw,raw_len)) -{-//we found a cached item for the current address, but the data is stale.-//for a variety of complicated reasons, we need to throw it out right this instant.-list_remove(curr);-delete curr;-break;-}--curr->lock();-list_remove(curr);-list_push_front(curr);-return curr;-}--//item was not found. recruit an existing one (the oldest), or create a new one-evict(); //reduce the size of the cache if necessary-ADPCMCacheItem* newitem = new ADPCMCacheItem();-newitem->lock();-newitem->addr = addr;-newitem->raw_len = raw_len;-newitem->raw_copy = new s8[raw_len];-memcpy(newitem->raw_copy,chan->buf8,raw_len);-u32 decode_len = newitem->decode_len = raw_len*2;-cache_size += newitem->decode_len;-newitem->decoded = new s16[decode_len];--int index = chan->buf8[2] & 0x7F;-s16 pcm16b = (s16)((chan->buf8[1] << 8) | chan->buf8[0]);-s16 pcm16b_last = pcm16b;--for(u32 i = 8; i < decode_len; i++)- {- const u32 shift = (i&1)<<2;- const u32 data4bit = (((u32)chan->buf8[i >> 1]) >> shift);-- const s32 diff = precalcdifftbl[index][data4bit & 0xF];- index = precalcindextbl[index][data4bit & 0x7];-- pcm16b_last = pcm16b;- pcm16b = MinMax(pcm16b+diff, -0x8000, 0x7FFF);-newitem->decoded[i] = pcm16b;- }--//printf("new cacheitem! totalsize:%d\n",cache_size);-list_push_front(newitem);-return newitem;-}--void list_remove(ADPCMCacheItem* item) {-if(item->next) item->next->prev = item->prev;-if(item->prev) item->prev->next = item->next;-if(item == list_front) list_front = item->next;-if(item == list_back) list_back = item->prev;-}--void list_push_front(ADPCMCacheItem* item)-{-item->next = list_front;-if(list_front) list_front->prev = item;-else list_back = item;-item->prev = NULL;-list_front = item;-}--} adpcmCache;--//////////////////////////////////////////////////////////////////////////////- int SPU_ChangeSoundCore(int coreid, int buffersize) { int i;@@ -380,9 +231,6 @@ //todo - check success? } -//keep the cache tidy-adpcmCache.evict(0);- // Reset Registers for (i = 0x400; i < 0x51D; i++) T1WriteByte(MMU.ARM7_REG, i, 0);@@ -395,12 +243,6 @@ memset(sndbuf,0,bufsize*2*4); memset(outbuf,0,bufsize*2*2); -for(int i = 0; i < 16; i++)-{-if(channels[i].cacheItem) -channels[i].cacheItem->unlock();-}- memset((void *)channels, 0, sizeof(channel_struct) * 16); for(int i = 0; i < 16; i++)@@ -425,11 +267,6 @@ { if(sndbuf) delete[] sndbuf; if(outbuf) delete[] outbuf;-for(int i = 0; i < 16; i++)-{-if(channels[i].cacheItem) -channels[i].cacheItem->unlock();-} } void SPU_DeInit(void)@@ -484,13 +321,9 @@ thischan.index = thischan.buf8[2] & 0x7F; thischan.lastsampcnt = 7; thischan.sampcnt = 8;+thischan.loop_index = K_ADPCM_LOOPING_RECOVERY_INDEX; //thischan.loopstart = thischan.loopstart << 3; //thischan.length = (thischan.length << 3) + thischan.loopstart;-if(thischan.cacheItem) thischan.cacheItem->unlock();-thischan.cacheItem = NULL;-if(CommonSettings.spuAdpcmCache)-if(this != SPU_core)-thischan.cacheItem = adpcmCache.scan(&thischan); break; } case 3: // PSG@@ -701,10 +534,10 @@ *data = (s32)chan->buf8[loc] << 8; } -template<SPUInterpolationMode INTERPOLATE_MODE, bool ADPCM_CACHED> static FORCEINLINE void Fetch16BitData(const channel_struct * const chan, s32 *data)+template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void Fetch16BitData(const channel_struct * const chan, s32 *data) {-const s16* const buf16 = ADPCM_CACHED ? chan->cacheItem->decoded : chan->buf16;-const int shift = ADPCM_CACHED ? 3 : 1;+const s16* const buf16 = chan->buf16;+const int shift = 1; if(INTERPOLATE_MODE != SPUInterpolation_None) { u32 loc = sputrunc(chan->sampcnt);@@ -720,13 +553,8 @@ *data = (s32)buf16[sputrunc(chan->sampcnt)]; } -template<SPUInterpolationMode INTERPOLATE_MODE, bool ADPCM_CACHED> static FORCEINLINE void FetchADPCMData(channel_struct * const chan, s32 * const data)+template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void FetchADPCMData(channel_struct * const chan, s32 * const data) {-if(ADPCM_CACHED)-{-return Fetch16BitData<INTERPOLATE_MODE,true>(chan, data);-}- // No sense decoding, just return the last sample if (chan->lastsampcnt != sputrunc(chan->sampcnt)){ @@ -741,6 +569,12 @@ chan->pcm16b_last = chan->pcm16b; chan->pcm16b = MinMax(chan->pcm16b+diff, -0x8000, 0x7FFF);++if(i == (chan->loopstart<<3)) {+if(chan->loop_index != K_ADPCM_LOOPING_RECOVERY_INDEX) printf("over-snagging\n");+chan->loop_pcm16b = chan->pcm16b;+chan->loop_index = chan->index;+} } chan->lastsampcnt = sputrunc(chan->sampcnt);@@ -851,10 +685,19 @@ { while (chan->sampcnt > chan->double_totlength_shifted) chan->sampcnt -= chan->double_totlength_shifted - (double)(chan->loopstart << 3);-//chan->sampcnt = (double)(chan->loopstart << 3);-chan->pcm16b = (s16)((chan->buf8[1] << 8) | chan->buf8[0]);-chan->index = chan->buf8[2] & 0x7F;-chan->lastsampcnt = 7;++if(chan->loop_index == K_ADPCM_LOOPING_RECOVERY_INDEX)+{+chan->pcm16b = (s16)((chan->buf8[1] << 8) | chan->buf8[0]);+chan->index = chan->buf8[2] & 0x7F;+chan->lastsampcnt = 7;+}+else+{+chan->pcm16b = chan->loop_pcm16b;+chan->index = chan->loop_index;+chan->lastsampcnt = (chan->loopstart << 3);+} } else {@@ -876,8 +719,8 @@ } } -template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE, int CHANNELS, bool CACHED> -FORCEINLINE static void _____SPU_ChanUpdate(SPU_struct* const SPU, channel_struct* const chan)+template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE, int CHANNELS> +FORCEINLINE static void ____SPU_ChanUpdate(SPU_struct* const SPU, channel_struct* const chan) { for (; SPU->bufpos < SPU->buflength; SPU->bufpos++) {@@ -887,8 +730,8 @@ switch(FORMAT) { case 0: Fetch8BitData<INTERPOLATE_MODE>(chan, &data); break;-case 1: Fetch16BitData<INTERPOLATE_MODE,false>(chan, &data); break;-case 2: FetchADPCMData<INTERPOLATE_MODE,CACHED>(chan, &data); break;+case 1: Fetch16BitData<INTERPOLATE_MODE>(chan, &data); break;+case 2: FetchADPCMData<INTERPOLATE_MODE>(chan, &data); break; case 3: FetchPSGData(chan, &data); break; } SPU_Mix<CHANNELS>(SPU, chan, data);@@ -902,14 +745,6 @@ } } -template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE, int CHANNELS> -FORCEINLINE static void ____SPU_ChanUpdate(SPU_struct* const SPU, channel_struct* const chan)-{-if(FORMAT == 2 && chan->cacheItem)-_____SPU_ChanUpdate<FORMAT,INTERPOLATE_MODE,CHANNELS,true>(SPU,chan);-else _____SPU_ChanUpdate<FORMAT,INTERPOLATE_MODE,CHANNELS,false>(SPU,chan);-}- template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE> FORCEINLINE static void ___SPU_ChanUpdate(const bool actuallyMix, SPU_struct* const SPU, channel_struct* const chan) {@@ -1238,7 +1073,7 @@ void spu_savestate(EMUFILE* os) { //version-write32le(2,os);+write32le(3,os); SPU_struct *spu = SPU_core; @@ -1297,7 +1132,7 @@ read32le(&chan.length,is); chan.totlength = chan.length + chan.loopstart; chan.double_totlength_shifted = (double)(chan.totlength << format_shift[chan.format]);-if(version != 1)+if(version >= 2) { read64le(&temp64,is); chan.sampcnt = u64_to_double(temp64); read64le(&temp64,is); chan.sampinc = u64_to_double(temp64);@@ -1314,31 +1149,20 @@ read16le(&chan.x,is); read16le(&chan.psgnoise_last,is); +//hopefully trigger a recovery of the adpcm looping system+chan.loop_index = K_ADPCM_LOOPING_RECOVERY_INDEX;+ //fixup the pointers which we had are supposed to keep cached chan.buf8 = (s8*)&MMU.MMU_MEM[1][(chan.addr>>20)&0xFF][(chan.addr & MMU.MMU_MASK[1][(chan.addr >> 20) & 0xFF])]; } -if(version==2) {+if(version>=2) { read64le(&temp64,is); samples = u64_to_double(temp64); } //copy the core spu (the more accurate) to the user spu if(SPU_user) {-for(int i=0;i<16;i++)-{-channel_struct &chan = SPU_user->channels[i];-if(chan.cacheItem) chan.cacheItem->unlock();-}- memcpy(SPU_user->channels,SPU_core->channels,sizeof(SPU_core->channels));--if(CommonSettings.spuAdpcmCache)-for(int i=0;i<16;i++)-{-channel_struct &chan = SPU_user->channels[i];-if(chan.format == 2)-chan.cacheItem = adpcmCache.scan(&chan);-} } return true;Modified: trunk/desmume/src/SPU.h===================================================================--- trunk/desmume/src/SPU.h2009-10-11 21:32:32 UTC (rev 2954)+++ trunk/desmume/src/SPU.h2009-10-12 07:41:16 UTC (rev 2955)@@ -68,12 +68,9 @@ extern SoundInterface_struct SNDFile; extern int SPU_currentCoreNum; -class ADPCMCacheItem;- struct channel_struct { channel_struct()-: cacheItem(NULL) {} u32 num; u8 vol;@@ -99,10 +96,11 @@ // ADPCM specific u32 lastsampcnt; s16 pcm16b, pcm16b_last;+ s16 loop_pcm16b; int index;+ int loop_index; u16 x; s16 psgnoise_last;- ADPCMCacheItem *cacheItem; } ; class SPU_structModified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2009-10-11 21:32:32 UTC (rev 2954)+++ trunk/desmume/src/windows/main.cpp2009-10-12 07:41:16 UTC (rev 2955)@@ -2151,7 +2151,6 @@ sndcoretype = GetPrivateProfileInt("Sound","SoundCore2", SNDCORE_DIRECTX, IniName); sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize", 735 * 4, IniName); CommonSettings.spuInterpolationMode = (SPUInterpolationMode)GetPrivateProfileInt("Sound","SPUInterpolation", 1, IniName);-CommonSettings.spuAdpcmCache = GetPrivateProfileInt("Sound","SPUAdpcmCache",0,IniName)!=0; EnterCriticalSection(&win_execute_sync); int spu_ret = SPU_ChangeSoundCore(sndcoretype, sndbuffersize);@@ -4816,9 +4815,6 @@ SendDlgItemMessage(hDlg, IDC_SPU_INTERPOLATION_CB, CB_ADDSTRING, 0, (LPARAM)"Cosine (slowest, sounds best)"); SendDlgItemMessage(hDlg, IDC_SPU_INTERPOLATION_CB, CB_SETCURSEL, (int)CommonSettings.spuInterpolationMode, 0); -//setup cache setting-CheckDlgButton(hDlg, IDC_SPU_CACHE, CommonSettings.spuAdpcmCache?BST_CHECKED:BST_UNCHECKED );- // Setup Sound Buffer Size Edit Text sprintf(tempstr, "%d", sndbuffersize); SetDlgItemText(hDlg, IDC_SOUNDBUFFERET, tempstr);@@ -4880,10 +4876,6 @@ CommonSettings.spuInterpolationMode = (SPUInterpolationMode)SendDlgItemMessage(hDlg, IDC_SPU_INTERPOLATION_CB, CB_GETCURSEL, 0, 0); WritePrivateProfileInt("Sound","SPUInterpolation",(int)CommonSettings.spuInterpolationMode, IniName); -//write cache setting-CommonSettings.spuAdpcmCache = IsDlgButtonChecked(hDlg, IDC_SPU_CACHE) != 0;-WritePrivateProfileInt("Sound","SPUAdpcmCache",CommonSettings.spuAdpcmCache?1:0, IniName);- return TRUE; } case IDCANCEL:Modified: trunk/desmume/src/windows/resources.rc===================================================================--- trunk/desmume/src/windows/resources.rc2009-10-11 21:32:32 UTC (rev 2954)+++ trunk/desmume/src/windows/resources.rc2009-10-12 07:41:16 UTC (rev 2955)@@ -52,7 +52,7 @@ 

[Desmume-cvs] SF.net SVN: desmume:[3034] trunk/desmume/src

From: <ni...@us...> - 2009-11-08 17:04:17

Revision: 3034 Author: nitsujaDate: 2009-11-08 17:04:07 +0000 (Sun, 08 Nov 2009)Log Message:-----------add some things to maybe help debug sound quality issues (developer option to record user SPU to WAV, define the sample rate 44100 in a single place, printout on audio buffer clear)Modified Paths:-------------- trunk/desmume/src/SPU.cpp trunk/desmume/src/SPU.h trunk/desmume/src/metaspu/SndOut.h trunk/desmume/src/windows/aviout.cpp trunk/desmume/src/windows/hotkey.cpp trunk/desmume/src/windows/main.cpp trunk/desmume/src/windows/main.h trunk/desmume/src/windows/resource.h trunk/desmume/src/windows/resources.rc trunk/desmume/src/windows/snddx.cppModified: trunk/desmume/src/SPU.cpp===================================================================--- trunk/desmume/src/SPU.cpp2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/SPU.cpp2009-11-08 17:04:07 UTC (rev 3034)@@ -318,7 +318,7 @@ static FORCEINLINE void adjust_channel_timer(channel_struct *chan) {-chan->sampinc = (((double)ARM7_CLOCK) / (44100 * 2)) / (double)(0x10000 - chan->timer);+chan->sampinc = (((double)ARM7_CLOCK) / (DESMUME_SAMPLE_RATE * 2)) / (double)(0x10000 - chan->timer); } void SPU_struct::KeyOn(int channel)@@ -870,7 +870,7 @@ static const int dots_per_clock = 6; static const int dots_per_hline = 355; static const double time_per_hline = (double)1.0/((double)ARM7_CLOCK/dots_per_clock/dots_per_hline);-static const double samples_per_hline = time_per_hline * 44100;+static const double samples_per_hline = time_per_hline * DESMUME_SAMPLE_RATE; int spu_core_samples = 0; void SPU_Emulate_core() {@@ -910,6 +910,7 @@ samplesOutput = (SPU_MixAudio(mix,SPU_user,audiosize), audiosize); SNDCore->UpdateAudio(SPU_user->outbuf, samplesOutput);+WAV_WavSoundUpdate(SPU_user->outbuf, samplesOutput, WAVMODE_USER); } } @@ -940,7 +941,7 @@ int SNDDummyInit(int buffersize) { return 0; } void SNDDummyDeInit() {} void SNDDummyUpdateAudio(s16 *buffer, u32 num_samples) { }-u32 SNDDummyGetAudioSpace() { return 740; }+u32 SNDDummyGetAudioSpace() { return DESMUME_SAMPLE_RATE/60 + 5; } void SNDDummyMuteAudio() {} void SNDDummyUnMuteAudio() {} void SNDDummySetVolume(int volume) {}@@ -992,7 +993,7 @@ fmt.chunk.size = 16; // we'll fix this at the end fmt.compress = 1; // PCM fmt.numchan = 2; // Stereo-fmt.rate = 44100;+fmt.rate = DESMUME_SAMPLE_RATE; fmt.bitspersample = 16; fmt.blockalign = fmt.bitspersample / 8 * fmt.numchan; fmt.bytespersec = fmt.rate * fmt.blockalign;@@ -1044,26 +1045,33 @@ wavWriter.close(); } -bool WAV_Begin(const char* fname)+bool WAV_Begin(const char* fname, WAVMode mode) { WAV_End(); if(!wavWriter.open(fname)) return false; +if(mode == WAVMODE_ANY)+mode = WAVMODE_CORE;+wavWriter.mode = mode;+ driver->USR_InfoMessage("WAV recording started."); return true; } -bool WAV_IsRecording()+bool WAV_IsRecording(WAVMode mode) {-return wavWriter.isRecording();+if(wavWriter.mode == mode || mode == WAVMODE_ANY)+return wavWriter.isRecording();+return false; } -void WAV_WavSoundUpdate(void* soundData, int numSamples)+void WAV_WavSoundUpdate(void* soundData, int numSamples, WAVMode mode) {-wavWriter.update(soundData, numSamples);+if(wavWriter.mode == mode || mode == WAVMODE_ANY)+wavWriter.update(soundData, numSamples); } Modified: trunk/desmume/src/SPU.h===================================================================--- trunk/desmume/src/SPU.h2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/SPU.h2009-11-08 17:04:07 UTC (rev 3034)@@ -149,6 +149,13 @@ void spu_savestate(EMUFILE* os); bool spu_loadstate(EMUFILE* is, int size); +enum WAVMode+{+WAVMODE_ANY = -1,+WAVMODE_CORE = 0,+WAVMODE_USER = 1+};+ class WavWriter { public:@@ -157,14 +164,19 @@ void close(); void update(void* soundData, int numSamples); bool isRecording() const;+WAVMode mode; private: FILE *spufp; }; - void WAV_End();-bool WAV_Begin(const char* fname);-bool WAV_IsRecording();-void WAV_WavSoundUpdate(void* soundData, int numSamples);+bool WAV_Begin(const char* fname, WAVMode mode=WAVMODE_CORE);+bool WAV_IsRecording(WAVMode mode=WAVMODE_ANY);+void WAV_WavSoundUpdate(void* soundData, int numSamples, WAVMode mode=WAVMODE_CORE); +// we should make this configurable eventually+// but at least defining it somewhere is probably a step in the right direction+#define DESMUME_SAMPLE_RATE 44100+//#define DESMUME_SAMPLE_RATE 48000+ #endifModified: trunk/desmume/src/metaspu/SndOut.h===================================================================--- trunk/desmume/src/metaspu/SndOut.h2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/metaspu/SndOut.h2009-11-08 17:04:07 UTC (rev 3034)@@ -80,8 +80,11 @@ // is too problematic. :) //this is hardcoded differently for metaspu //edit - zeromus 23-oct-2009-//static const int SampleRate = 48000;-static const int SampleRate = 44100;+////static const int SampleRate = 48000;+//static const int SampleRate = 44100;+//edit - nitsuja: make it use the global sample rate define+#include "..\SPU.h"+static const int SampleRate = DESMUME_SAMPLE_RATE; extern int FindOutputModuleById( const wchar_t* omodid ); Modified: trunk/desmume/src/windows/aviout.cpp===================================================================--- trunk/desmume/src/windows/aviout.cpp2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/windows/aviout.cpp2009-11-08 17:04:07 UTC (rev 3034)@@ -26,6 +26,7 @@ #include "gfx3d.h" #include "aviout.h" #include "../GPU_osd.h"+#include "../SPU.h" #include <assert.h> #include <vfw.h>@@ -80,7 +81,7 @@ longtBytes, ByteBuffer; -u8audio_buffer[44100*2*2]; // 1 second buffer+u8audio_buffer[DESMUME_SAMPLE_RATE*2*2]; // 1 second buffer intaudio_buffer_pos; } *avi_file = NULL; @@ -365,10 +366,10 @@ WAVEFORMATEX wf; wf.cbSize = sizeof(WAVEFORMATEX);-wf.nAvgBytesPerSec = 44100 * 4;+wf.nAvgBytesPerSec = DESMUME_SAMPLE_RATE * 4; wf.nBlockAlign = 4; wf.nChannels = 2;-wf.nSamplesPerSec = 44100;+wf.nSamplesPerSec = DESMUME_SAMPLE_RATE; wf.wBitsPerSample = 16; wf.wFormatTag = WAVE_FORMAT_PCM; Modified: trunk/desmume/src/windows/hotkey.cpp===================================================================--- trunk/desmume/src/windows/hotkey.cpp2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/windows/hotkey.cpp2009-11-08 17:04:07 UTC (rev 3034)@@ -238,7 +238,7 @@ void HK_Reset(int, bool justPressed) {ResetGame();} void HK_RecordAVI(int, bool justPressed) { if (AVI_IsRecording()) AviEnd(); else AviRecordTo(); }-void HK_RecordWAV(int, bool justPressed) { if (WAV_IsRecording()) WavEnd(); else WavRecordTo(); }+void HK_RecordWAV(int, bool justPressed) { if (WAV_IsRecording()) WavEnd(); else WavRecordTo(WAVMODE_CORE); } void HK_ToggleFrame(int, bool justPressed) {CommonSettings.hud.FrameCounterDisplay ^= true;} void HK_ToggleFPS(int, bool justPressed) {CommonSettings.hud.FpsDisplay ^= true;}Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/windows/main.cpp2009-11-08 17:04:07 UTC (rev 3034)@@ -140,6 +140,10 @@ #endif +#ifndef PUBLIC_RELEASE+#define DEVELOPER_MENU_ITEMS+#endif+ const int kGapNone = 0; const int kGapBorder = 5; const int kGapNDS = 64; // extremely tilted (but some games seem to use this value)@@ -269,7 +273,7 @@ /*__declspec(thread)*/ bool inFrameBoundary = false; static int sndcoretype=SNDCORE_DIRECTX;-static int sndbuffersize=735*8;+static int sndbuffersize=DESMUME_SAMPLE_RATE*8/60; static int snd_synchmode=0; static int snd_synchmethod=0; int sndvolume=100;@@ -1481,7 +1485,7 @@ Lock lock; NDS_exec<false>(); //SPU_Emulate_user();-win_sound_samplecounter = 735;+win_sound_samplecounter = DESMUME_SAMPLE_RATE/60; } inFrameBoundary = true; DRV_AviVideoUpdate((u16*)GPU_screen);@@ -1844,6 +1848,12 @@ ResetSaveStateTimes(); +#ifndef DEVELOPER_MENU_ITEMS+// menu items that are only useful for desmume developers (maybe)+HMENU fileMenu = GetSubMenu(mainMenu, 0);+DeleteMenu(fileMenu, IDM_FILE_RECORDUSERSPUWAV, MF_BYCOMMAND);+#endif+ return 1; } @@ -2450,7 +2460,7 @@ #endif LOG("Init sound core\n"); sndcoretype = GetPrivateProfileInt("Sound","SoundCore2", SNDCORE_DIRECTX, IniName);-sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize2", 735*8, IniName);+sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize2", DESMUME_SAMPLE_RATE*8/60, IniName); CommonSettings.spuInterpolationMode = (SPUInterpolationMode)GetPrivateProfileInt("Sound","SPUInterpolation", 1, IniName); EnterCriticalSection(&win_execute_sync);@@ -3019,7 +3029,7 @@ } //Shows an Open File menu and starts recording an WAV-void WavRecordTo()+void WavRecordTo(int wavmode) { NDS_Pause(); @@ -3061,7 +3071,7 @@ if(GetSaveFileName(&ofn)) {-WAV_Begin(szChoice);+WAV_Begin(szChoice, (WAVMode)wavmode); } NDS_UnPause();@@ -3462,6 +3472,9 @@ DesEnableMenuItem(mainMenu, IDM_CHEATS_LIST, romloaded); DesEnableMenuItem(mainMenu, IDM_CHEATS_SEARCH, romloaded); //DesEnableMenuItem(mainMenu, IDM_WIFISETTINGS, romloaded);+#ifdef DEVELOPER_MENU_ITEMS+DesEnableMenuItem(mainMenu, IDM_FILE_RECORDUSERSPUWAV, romloaded && !WAV_IsRecording());+#endif DesEnableMenuItem(mainMenu, IDM_RECORD_MOVIE, (romloaded /*&& movieMode == MOVIEMODE_INACTIVE*/)); DesEnableMenuItem(mainMenu, IDM_PLAY_MOVIE, (romloaded /*&& movieMode == MOVIEMODE_INACTIVE*/));@@ -4098,8 +4111,16 @@ if (WAV_IsRecording()) WAV_End(); else-WavRecordTo();+WavRecordTo(WAVMODE_CORE); break;+#ifdef DEVELOPER_MENU_ITEMS+case IDM_FILE_RECORDUSERSPUWAV:+if (WAV_IsRecording())+WAV_End();+else+WavRecordTo(WAVMODE_USER);+break;+#endif case IDC_STATEREWINDING: if(staterewindingenabled) staterewindingenabled = false; else staterewindingenabled = true;Modified: trunk/desmume/src/windows/main.h===================================================================--- trunk/desmume/src/windows/main.h2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/windows/main.h2009-11-08 17:04:07 UTC (rev 3034)@@ -16,7 +16,7 @@ void ResetGame();//Resets game (for the menu item & hotkey void AviRecordTo(); void AviEnd();-void WavRecordTo();+void WavRecordTo(int wavmode); void WavEnd(); extern bool frameCounterDisplay;Modified: trunk/desmume/src/windows/resource.h===================================================================--- trunk/desmume/src/windows/resource.h2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/windows/resource.h2009-11-08 17:04:07 UTC (rev 3034)@@ -694,6 +694,7 @@ #define IDM_SCREENSEP_COLORWHITE 40023 #define IDM_SCREENSEP_COLORGRAY 40024 #define IDM_SCREENSEP_COLORBLACK 40025+#define IDM_FILE_RECORDUSERSPUWAV 40026 #define ID_FILE_RECENTROM 40034 #define IDC_SAVETYPE7 40037 #define IDM_DEFSIZE 40038Modified: trunk/desmume/src/windows/resources.rc===================================================================--- trunk/desmume/src/windows/resources.rc2009-11-08 15:50:12 UTC (rev 3033)+++ trunk/desmume/src/windows/resources.rc2009-11-08 17:04:07 UTC (rev 3034)@@ -3845,6 +3845,8 @@ 

[Desmume-cvs] SF.net SVN: desmume:[3758] trunk/desmume/src

From: <ze...@us...> - 2010-08-31 23:12:27

Revision: 3758 Author: zeromusDate: 2010-08-31 23:12:20 +0000 (Tue, 31 Aug 2010)Log Message:-----------fix load average calculators (has been broken for a long time) and add an arm7 load average. calculating that may be useless for practically everyone, later I may remove it or make it optionalModified Paths:-------------- trunk/desmume/src/GPU_osd.cpp trunk/desmume/src/GPU_osd.h trunk/desmume/src/NDSSystem.cpp trunk/desmume/src/NDSSystem.h trunk/desmume/src/windows/main.cppModified: trunk/desmume/src/GPU_osd.cpp===================================================================--- trunk/desmume/src/GPU_osd.cpp2010-08-30 06:30:57 UTC (rev 3757)+++ trunk/desmume/src/GPU_osd.cpp2010-08-31 23:12:20 UTC (rev 3758)@@ -528,7 +528,7 @@ if (CommonSettings.hud.FpsDisplay) {-osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d (%02d%%)%s", Hud.fps, Hud.fps3d, Hud.arm9load, driver->EMU_IsEmulationPaused() ? " (paused)" : "");+osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d (%02d%%/%02d%%)%s", Hud.fps, Hud.fps3d, Hud.cpuload[0], Hud.cpuload[1], driver->EMU_IsEmulationPaused() ? " (paused)" : ""); } if (CommonSettings.hud.FrameCounterDisplay) Modified: trunk/desmume/src/GPU_osd.h===================================================================--- trunk/desmume/src/GPU_osd.h2010-08-30 06:30:57 UTC (rev 3757)+++ trunk/desmume/src/GPU_osd.h2010-08-31 23:12:20 UTC (rev 3758)@@ -58,7 +58,7 @@ { fps = 0; fps3d = 0;-arm9load = 0;+cpuload[0] = cpuload[1] = 0; cpuloopIterationCount = 0; clicked = false; }@@ -76,7 +76,7 @@ HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; } void reset(); -int fps, fps3d, arm9load, cpuloopIterationCount;+int fps, fps3d, cpuload[2], cpuloopIterationCount; bool clicked; }; Modified: trunk/desmume/src/NDSSystem.cpp===================================================================--- trunk/desmume/src/NDSSystem.cpp2010-08-30 06:30:57 UTC (rev 3757)+++ trunk/desmume/src/NDSSystem.cpp2010-08-31 23:12:20 UTC (rev 3758)@@ -1522,10 +1522,12 @@ triggerDma(EDMAMode_VBlank); //tracking for arm9 load average-nds.runCycleCollector[nds.idleFrameCounter] = 1120380-nds.idleCycles;+nds.runCycleCollector[0][nds.idleFrameCounter] = 1120380-nds.idleCycles[0];+nds.runCycleCollector[1][nds.idleFrameCounter] = 1120380-nds.idleCycles[1]; nds.idleFrameCounter++; nds.idleFrameCounter &= 15;-nds.idleCycles = 0;+nds.idleCycles[0] = 0;+nds.idleCycles[1] = 0; } static void execHardware_hstart_vcount()@@ -1866,7 +1868,7 @@ { s32 temp = arm9; arm9 = min(s32next, arm9 + kIrqWait);-nds.idleCycles += arm9-temp;+nds.idleCycles[0] += arm9-temp; if (gxFIFO.size < 255) nds.freezeBus = FALSE; } }@@ -1882,7 +1884,9 @@ } else {+s32 temp = arm7; arm7 = min(s32next, arm7 + kIrqWait);+nds.idleCycles[1] += arm7-temp; if(arm7 == s32next) { nds_timer = nds_timer_base + minarmtime<doarm9,false>(arm9,arm7);@@ -2014,9 +2018,17 @@ #endif //if we were waiting for an irq, don't wait too long:-//let's re-analyze it after this hardware event-if(NDS_ARM9.waitIRQ) nds_arm9_timer = nds_timer;-if(NDS_ARM7.waitIRQ) nds_arm7_timer = nds_timer;+//let's re-analyze it after this hardware event (this rolls back a big burst of irq waiting which may have been interrupted by a resynch)+if(NDS_ARM9.waitIRQ)+{+nds.idleCycles[0] -= (s32)(nds_arm9_timer-nds_timer);+nds_arm9_timer = nds_timer;+}+if(NDS_ARM7.waitIRQ)+{+nds.idleCycles[1] -= (s32)(nds_arm7_timer-nds_timer);+nds_arm7_timer = nds_timer;+} } } Modified: trunk/desmume/src/NDSSystem.h===================================================================--- trunk/desmume/src/NDSSystem.h2010-08-30 06:30:57 UTC (rev 3757)+++ trunk/desmume/src/NDSSystem.h2010-08-31 23:12:20 UTC (rev 3758)@@ -186,8 +186,8 @@ //it was perhaps a mistake to put it here. //it is far less important than the above. //maybe I should move it.-s32 idleCycles;-s32 runCycleCollector[16];+s32 idleCycles[2];+s32 runCycleCollector[2][16]; s32 idleFrameCounter; s32 cpuloopIterationCount; //counts the number of times during a frame that a reschedule happened Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2010-08-30 06:30:57 UTC (rev 3757)+++ trunk/desmume/src/windows/main.cpp2010-08-31 23:12:20 UTC (rev 3758)@@ -1829,11 +1829,27 @@ if(nds.idleFrameCounter==0 || oneSecond) { //calculate a 16 frame arm9 load average-int load = 0;-for(int i=0;i<16;i++)-load = load/8 + nds.runCycleCollector[(i+nds.idleFrameCounter)&15]*7/8;-load = std::min(100,std::max(0,(int)(load*100/1120380)));-Hud.arm9load = load;+for(int cpu=0;cpu<2;cpu++)+{+int load = 0;+//printf("%d: ",cpu);+for(int i=0;i<16;i++)+{+//blend together a few frames to keep low-framerate games from having a jittering load average+//(they will tend to work 100% for a frame and then sleep for a while)+//4 frames should handle even the slowest of games+s32 sample = +nds.runCycleCollector[cpu][(i+0+nds.idleFrameCounter)&15]++nds.runCycleCollector[cpu][(i+1+nds.idleFrameCounter)&15]++nds.runCycleCollector[cpu][(i+2+nds.idleFrameCounter)&15]++nds.runCycleCollector[cpu][(i+3+nds.idleFrameCounter)&15];+sample /= 4;+load = load/8 + sample*7/8;+}+//printf("\n");+load = std::min(100,std::max(0,(int)(load*100/1120380)));+Hud.cpuload[cpu] = load;+} } Hud.cpuloopIterationCount = nds.cpuloopIterationCount;@@ -3644,7 +3660,7 @@ memcpy(&str[titlelen+1], &MMU.CART_ROM[12], 6); str[titlelen+1+6] = '\0'; TextOut(hMemDC, 8, 384 + 14 * (twolinever ? 3:2), str, strlen(str)); -sprintf(str, "FPS: %i/%i (%02d%%) | %s", mainLoopData.fps, mainLoopData.fps3d, Hud.arm9load, paused ? "Paused":"Running");+sprintf(str, "FPS: %i/%i (%02d%%/%02d%%) | %s", mainLoopData.fps, mainLoopData.fps3d, Hud.cpuload[0], Hud.cpuload[1], paused ? "Paused":"Running"); TextOut(hMemDC, 8, 384 + 14 * (twolinever ? 4:3), str, strlen(str)); sprintf(str, "3D Render: %s", core3DList[cur3DCore]->name);This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[3891] trunk/desmume/src

From: <go...@us...> - 2010-12-22 11:30:21

Revision: 3891 Author: gochaDate: 2010-12-22 11:30:15 +0000 (Wed, 22 Dec 2010)Log Message:-----------rasterizer: add workaround for line poly. However, it's commented out since it's incomplete and also causes another glitch.Modified Paths:-------------- trunk/desmume/src/OGLRender.cpp trunk/desmume/src/rasterize.cppModified: trunk/desmume/src/OGLRender.cpp===================================================================--- trunk/desmume/src/OGLRender.cpp2010-12-20 13:10:12 UTC (rev 3890)+++ trunk/desmume/src/OGLRender.cpp2010-12-22 11:30:15 UTC (rev 3891)@@ -818,9 +818,8 @@ } // "Workaround" for line poly-static bool isLinePoly(int listIndex)+static bool isLinePoly(POLY *poly) {-POLY *poly = &gfx3d.polylist->list[gfx3d.indexlist.list[listIndex]]; int type = poly->type; VERT *vert1, *vert2; @@ -952,9 +951,8 @@ float alpha = poly->getAlpha()/31.0f; if(wireframe) alpha = 1.0;-bool linePoly = isLinePoly(i); -if (linePoly)+if (isLinePoly(poly)) glBegin(GL_LINE_LOOP); else if (type == 4) glBegin(GL_QUADS);Modified: trunk/desmume/src/rasterize.cpp===================================================================--- trunk/desmume/src/rasterize.cpp2010-12-20 13:10:12 UTC (rev 3890)+++ trunk/desmume/src/rasterize.cpp2010-12-22 11:30:15 UTC (rev 3891)@@ -223,17 +223,31 @@ Y = Ceil28_4((fixed28_4)verts[Top]->y); int YEnd = Ceil28_4((fixed28_4)verts[Bottom]->y); Height = YEnd - Y;+X = Ceil28_4((fixed28_4)verts[Top]->x);+int XEnd = Ceil28_4((fixed28_4)verts[Bottom]->x);+int Width = XEnd - X; // can be negative -if(Height)+// even if Height == 0, give some info for horizontal line poly+if(Height != 0 || Width != 0) { long dN = long(verts[Bottom]->y - verts[Top]->y); long dM = long(verts[Bottom]->x - verts[Top]->x);+if (dN != 0)+{+long InitialNumerator = (long)(dM*16*Y - dM*verts[Top]->y + dN*verts[Top]->x - 1 + dN*16);+FloorDivMod(InitialNumerator,dN*16,X,ErrorTerm,failure);+FloorDivMod(dM*16,dN*16,XStep,Numerator,failure);+Denominator = dN*16;+}+else+{+XStep = Width;+Numerator = 0;+ErrorTerm = 0;+Denominator = 1;+failure = false;+} -long InitialNumerator = (long)(dM*16*Y - dM*verts[Top]->y + dN*verts[Top]->x - 1 + dN*16);-FloorDivMod(InitialNumerator,dN*16,X,ErrorTerm,failure);-FloorDivMod(dM*16,dN*16,XStep,Numerator,failure);-Denominator = dN*16;- float YPrestep = Fixed28_4ToFloat((fixed28_4)(Y*16 - verts[Top]->y)); float XPrestep = Fixed28_4ToFloat((fixed28_4)(X*16 - verts[Top]->x)); @@ -296,6 +310,7 @@ } } +// TODO: wire-frame struct PolyAttr { u32 val;@@ -692,6 +707,22 @@ int XStart = pLeft->X; int width = pRight->X - XStart; +// workaround for vertical/slant line poly+// it seems to cause another issue though+//if (width == 0)+//{+//int leftWidth = pLeft->XStep;+//if (pLeft->ErrorTerm + pLeft->Numerator >= pLeft->Denominator)+//leftWidth++;+//int rightWidth = pRight->XStep;+//if (pRight->ErrorTerm + pRight->Numerator >= pRight->Denominator)+//rightWidth++;+//width = max(1, min(abs(leftWidth), abs(rightWidth)));+ //+//if (XStart + width > 256)+//width = max(0, 256 - XStart);+//}+ //these are the starting values, taken from the left edge float invw = pLeft->invw.curr; float u = pLeft->u.curr;@@ -763,13 +794,22 @@ bool first=true; static int runctr=0; runctr++;++//HACK: special handling for horizontal line poly+//Instead of line, this will cause other notable issue.+//if (left->Height == 0 && right->Height == 0)+//{+//bool draw = (!SLI || (left->Y & SLI_MASK) == SLI_VALUE);+//if(draw) drawscanline(left,right);+//}+ while(Height--) { bool draw = (!SLI || (left->Y & SLI_MASK) == SLI_VALUE); if(draw) drawscanline(left,right); const int xl = left->X; const int xr = right->X; const int y = left->Y;-left->Step(); +left->Step(); right->Step(); if(!RENDERER && _debug_thisPoly)This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[3963] trunk/desmume/src

From: <ze...@us...> - 2011-04-02 18:39:32

Revision: 3963 Author: zeromusDate: 2011-04-02 18:39:26 +0000 (Sat, 02 Apr 2011)Log Message:-----------fix bug in rasterizer linehack rendering, add 3d config option since it still breaks hotel dusk, and make nocash debug messages always show up, even with no #define DEVELOPER.Modified Paths:-------------- trunk/desmume/src/NDSSystem.h trunk/desmume/src/gfx3d.cpp trunk/desmume/src/rasterize.cpp trunk/desmume/src/thumb_instructions.cpp trunk/desmume/src/windows/main.cpp trunk/desmume/src/windows/resource.h trunk/desmume/src/windows/resources.rcModified: trunk/desmume/src/NDSSystem.h===================================================================--- trunk/desmume/src/NDSSystem.h2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/NDSSystem.h2011-04-02 18:39:26 UTC (rev 3963)@@ -472,6 +472,7 @@ , GFX3D_EdgeMark(true) , GFX3D_Fog(true) , GFX3D_Texture(true)+, GFX3D_LineHack(true) , GFX3D_Zelda_Shadow_Depth_Hack(0) , UseExtBIOS(false) , SWIFromBIOS(false)@@ -512,6 +513,7 @@ bool GFX3D_EdgeMark; bool GFX3D_Fog; bool GFX3D_Texture;+bool GFX3D_LineHack; int GFX3D_Zelda_Shadow_Depth_Hack; bool UseExtBIOS;Modified: trunk/desmume/src/gfx3d.cpp===================================================================--- trunk/desmume/src/gfx3d.cpp2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/gfx3d.cpp2011-04-02 18:39:26 UTC (rev 3963)@@ -2818,6 +2818,8 @@ // "Workaround" for line poly bool gfx3d_IsLinePoly(POLY *poly) {+if(!CommonSettings.GFX3D_LineHack) return false;+ int type = poly->type; VERT *vert1, *vert2; Modified: trunk/desmume/src/rasterize.cpp===================================================================--- trunk/desmume/src/rasterize.cpp2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/rasterize.cpp2011-04-02 18:39:26 UTC (rev 3963)@@ -817,7 +817,7 @@ runctr++; //HACK: special handling for horizontal line poly-if (lineHack && left->Height == 0 && right->Height == 0)+if (lineHack && left->Height == 0 && right->Height == 0 && left->Y<192 && left->Y>=0) { bool draw = (!SLI || (left->Y & SLI_MASK) == SLI_VALUE); if(draw) drawscanline(left,right,lineHack);Modified: trunk/desmume/src/thumb_instructions.cpp===================================================================--- trunk/desmume/src/thumb_instructions.cpp2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/thumb_instructions.cpp2011-04-02 18:39:26 UTC (rev 3963)@@ -1066,7 +1066,6 @@ TEMPLATE static u32 FASTCALL OP_B_UNCOND(const u32 i) {-#ifdef DEVELOPER //nocash message detection const u16 last = _MMU_read16<PROCNUM,MMU_AT_DEBUG>(cpu->instruct_adr-2); const u16 next = _MMU_read16<PROCNUM,MMU_AT_DEBUG>(cpu->instruct_adr+2);@@ -1075,7 +1074,6 @@ { NocashMessage(cpu); }-#endif cpu->R[15] += (SIGNEEXT_IMM11(i)<<1); cpu->next_instruction = cpu->R[15];Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/windows/main.cpp2011-04-02 18:39:26 UTC (rev 3963)@@ -2884,7 +2884,7 @@ CommonSettings.GFX3D_EdgeMark = GetPrivateProfileBool("3D", "EnableEdgeMark", 1, IniName); CommonSettings.GFX3D_Fog = GetPrivateProfileBool("3D", "EnableFog", 1, IniName); CommonSettings.GFX3D_Texture = GetPrivateProfileBool("3D", "EnableTexture", 1, IniName);-//CommonSettings.gfx3d_flushMode = GetPrivateProfileInt("3D", "AlternateFlush", 0, IniName);+CommonSettings.GFX3D_LineHack = GetPrivateProfileBool("3D", "EnableLineHack", 1, IniName); Change3DCoreWithFallbackAndSave(cur3DCore); #ifdef BETA_VERSION@@ -5626,6 +5626,7 @@ CheckDlgButton(hw,IDC_3DSETTINGS_EDGEMARK,CommonSettings.GFX3D_EdgeMark); CheckDlgButton(hw,IDC_3DSETTINGS_FOG,CommonSettings.GFX3D_Fog); CheckDlgButton(hw,IDC_3DSETTINGS_TEXTURE,CommonSettings.GFX3D_Texture);+CheckDlgButton(hw,IDC_3DSETTINGS_LINEHACK, CommonSettings.GFX3D_LineHack); SetDlgItemInt (hw,IDC_ZELDA_SHADOW_DEPTH_HACK,CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack,FALSE); //CheckDlgButton(hw,IDC_ALTERNATEFLUSH,CommonSettings.gfx3d_flushMode); @@ -5647,6 +5648,7 @@ CommonSettings.GFX3D_EdgeMark = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_EDGEMARK); CommonSettings.GFX3D_Fog = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_FOG); CommonSettings.GFX3D_Texture = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_TEXTURE);+CommonSettings.GFX3D_LineHack = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_LINEHACK); CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack = GetDlgItemInt(hw,IDC_ZELDA_SHADOW_DEPTH_HACK,NULL,FALSE); Change3DCoreWithFallbackAndSave(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE)));@@ -5655,7 +5657,7 @@ WritePrivateProfileBool("3D", "EnableFog", CommonSettings.GFX3D_Fog, IniName); WritePrivateProfileBool("3D", "EnableTexture", CommonSettings.GFX3D_Texture, IniName); WritePrivateProfileInt ("3D", "ZeldaShadowDepthHack", CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack, IniName);-//CommonSettings.gfx3d_flushMode = (IsDlgButtonChecked(hw,IDC_ALTERNATEFLUSH) == BST_CHECKED)?1:0;+WritePrivateProfileInt ("3D", "EnableLineHack", CommonSettings.GFX3D_LineHack, IniName); //WritePrivateProfileInt("3D", "AlternateFlush", CommonSettings.gfx3d_flushMode, IniName); } case IDCANCEL:Modified: trunk/desmume/src/windows/resource.h===================================================================--- trunk/desmume/src/windows/resource.h2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/windows/resource.h2011-04-02 18:39:26 UTC (rev 3963)@@ -709,6 +709,7 @@ #define ID_LABEL_HK4 4468 #define IDC_GI_ICON 4469 #define ID_LABEL_HK5 4469+#define IDC_3DSETTINGS_LINEHACK 4469 #define IDC_GI_TITLE 4470 #define ID_LABEL_HK6 4470 #define IDC_GI_TITLEEN 4471@@ -791,6 +792,7 @@ #define IDC_IOREG 6001 #define ID_LABEL_ZELDA_SHADOW_DEPTH_HACK 9000 #define IDC_ZELDA_SHADOW_DEPTH_HACK 9001+#define ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2 9003 #define IDD_CHEAT_ADD_XX_CODE 10005 #define IDD_GBASLOT_GUITARGRIP 10009 #define IDD_GBASLOT_PIANO 10010Modified: trunk/desmume/src/windows/resources.rc===================================================================--- trunk/desmume/src/windows/resources.rc2011-03-28 09:27:44 UTC (rev 3962)+++ trunk/desmume/src/windows/resources.rc2011-04-02 18:39:26 UTC (rev 3963)@@ -114,7 +114,7 @@ 

[Desmume-cvs] SF.net SVN: desmume:[4219] trunk/desmume/src

From: <ze...@us...> - 2012-03-20 01:18:10

Revision: 4219 Author: zeromusDate: 2012-03-20 01:18:01 +0000 (Tue, 20 Mar 2012)Log Message:-----------core-add ldrex and strex instructions to armModified Paths:-------------- trunk/desmume/src/Disassembler.cpp trunk/desmume/src/arm_instructions.cpp trunk/desmume/src/instruction_tabdef.incModified: trunk/desmume/src/Disassembler.cpp===================================================================--- trunk/desmume/src/Disassembler.cpp2012-03-19 00:56:12 UTC (rev 4218)+++ trunk/desmume/src/Disassembler.cpp2012-03-20 01:18:01 UTC (rev 4219)@@ -2133,6 +2133,11 @@ sprintf(txt, "LDR%s %s, [%s, -#%X]", Condition[CONDITION(i)], Registre[REG_POS(i,12)], Registre[REG_POS(i,16)], (int)(i&0x7FF)); return txt;} +static char * OP_LDREX(u32 adr, u32 i, char * txt)+{+sprintf(txt, "LDREX%s %s, [%s]", Condition[CONDITION(i)], Registre[REG_POS(i,12)], Registre[REG_POS(i,16)]);+return txt;}+ static char * OP_LDR_P_LSL_IMM_OFF(u32 adr, u32 i, char * txt) { LDRSTR_LSL_IMM(LDR, "", "", "]");@@ -2442,6 +2447,11 @@ sprintf(txt, "STR%s %s, [%s, -#%X]", Condition[CONDITION(i)], Registre[REG_POS(i,12)], Registre[REG_POS(i,16)], (int)(i&0x7FF)); return txt;} +static char * OP_STREX(u32 adr, u32 i, char * txt)+{+ sprintf(txt, "STREX%s %s, %s, [%s]", Condition[CONDITION(i)], Registre[REG_POS(i,12)], Registre[REG_POS(i,0)], Registre[REG_POS(i,16)]);+return txt;}+ static char * OP_STR_P_LSL_IMM_OFF(u32 adr, u32 i, char * txt) { LDRSTR_LSL_IMM(STR, "", "", "]");Modified: trunk/desmume/src/arm_instructions.cpp===================================================================--- trunk/desmume/src/arm_instructions.cpp2012-03-19 00:56:12 UTC (rev 4218)+++ trunk/desmume/src/arm_instructions.cpp2012-03-20 01:18:01 UTC (rev 4219)@@ -3726,6 +3726,13 @@ OP_LDR(3, 5); } +TEMPLATE static u32 FASTCALL OP_LDREX(const u32 i)+{+u32 adr = cpu->R[REG_POS(i,16)];+cpu->R[REG_POS(i,12)] = ROR(READ32(cpu->mem_if->data, adr), 8*(adr&3));+return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_READ>(3,adr);+}+ TEMPLATE static u32 FASTCALL OP_LDR_P_LSL_IMM_OFF(const u32 i) { LSL_IMM; @@ -4216,6 +4223,15 @@ return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_WRITE>(2,adr); } +TEMPLATE static u32 FASTCALL OP_STREX(const u32 i)+{+u32 adr = cpu->R[REG_POS(i,16)];+WRITE32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,0)]);+cpu->R[REG_POS(i,12)] = 0;++return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_WRITE>(2,adr);+}+ TEMPLATE static u32 FASTCALL OP_STR_P_LSL_IMM_OFF(const u32 i) { LSL_IMM; Modified: trunk/desmume/src/instruction_tabdef.inc===================================================================--- trunk/desmume/src/instruction_tabdef.inc2012-03-19 00:56:12 UTC (rev 4218)+++ trunk/desmume/src/instruction_tabdef.inc2012-03-20 01:18:01 UTC (rev 4219)@@ -20,4102 +20,4102 @@ /* 0XX000X0 */ -/* 0000 0000 0000 */ TABDECL( OP_AND_LSL_IMM), -/* 0000 0000 0001 */ TABDECL( OP_AND_LSL_REG), -/* 0000 0000 0010 */ TABDECL( OP_AND_LSR_IMM), -/* 0000 0000 0011 */ TABDECL( OP_AND_LSR_REG), -/* 0000 0000 0100 */ TABDECL( OP_AND_ASR_IMM), -/* 0000 0000 0101 */ TABDECL( OP_AND_ASR_REG), -/* 0000 0000 0110 */ TABDECL( OP_AND_ROR_IMM), -/* 0000 0000 0111 */ TABDECL( OP_AND_ROR_REG), -/* 0000 0000 1000 */ TABDECL( OP_AND_LSL_IMM), -/* 0000 0000 1001 */ TABDECL( OP_MUL), -/* 0000 0000 1010 */ TABDECL( OP_AND_LSR_IMM), -/* 0000 0000 1011 */ TABDECL( OP_STRH_POS_INDE_M_REG_OFF), -/* 0000 0000 1100 */ TABDECL( OP_AND_ASR_IMM), -/* 0000 0000 1101 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 0000 1110 */ TABDECL( OP_AND_ROR_IMM), -/* 0000 0000 1111 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 0001 0000 */ TABDECL( OP_AND_S_LSL_IMM), -/* 0000 0001 0001 */ TABDECL( OP_AND_S_LSL_REG), -/* 0000 0001 0010 */ TABDECL( OP_AND_S_LSR_IMM), -/* 0000 0001 0011 */ TABDECL( OP_AND_S_LSR_REG), -/* 0000 0001 0100 */ TABDECL( OP_AND_S_ASR_IMM), -/* 0000 0001 0101 */ TABDECL( OP_AND_S_ASR_REG), -/* 0000 0001 0110 */ TABDECL( OP_AND_S_ROR_IMM), -/* 0000 0001 0111 */ TABDECL( OP_AND_S_ROR_REG), -/* 0000 0001 1000 */ TABDECL( OP_AND_S_LSL_IMM), -/* 0000 0001 1001 */ TABDECL( OP_MUL_S), -/* 0000 0001 1010 */ TABDECL( OP_AND_S_LSR_IMM), -/* 0000 0001 1011 */ TABDECL( OP_LDRH_POS_INDE_M_REG_OFF), -/* 0000 0001 1100 */ TABDECL( OP_AND_S_ASR_IMM), -/* 0000 0001 1101 */ TABDECL( OP_LDRSB_POS_INDE_M_REG_OFF),-/* 0000 0001 1110 */ TABDECL( OP_AND_S_ROR_IMM), -/* 0000 0001 1111 */ TABDECL( OP_LDRSH_POS_INDE_M_REG_OFF),-/* 0000 0010 0000 */ TABDECL( OP_EOR_LSL_IMM), -/* 0000 0010 0001 */ TABDECL( OP_EOR_LSL_REG), -/* 0000 0010 0010 */ TABDECL( OP_EOR_LSR_IMM), -/* 0000 0010 0011 */ TABDECL( OP_EOR_LSR_REG), -/* 0000 0010 0100 */ TABDECL( OP_EOR_ASR_IMM), -/* 0000 0010 0101 */ TABDECL( OP_EOR_ASR_REG), -/* 0000 0010 0110 */ TABDECL( OP_EOR_ROR_IMM), -/* 0000 0010 0111 */ TABDECL( OP_EOR_ROR_REG), -/* 0000 0010 1000 */ TABDECL( OP_EOR_LSL_IMM), -/* 0000 0010 1001 */ TABDECL( OP_MLA), -/* 0000 0010 1010 */ TABDECL( OP_EOR_LSR_IMM), // OOO OOO1 O 1010-/* 0000 0010 1011 */ TABDECL( OP_UND), -/* 0000 0010 1100 */ TABDECL( OP_EOR_ASR_IMM), -/* 0000 0010 1101 */ TABDECL( OP_UND), -/* 0000 0010 1110 */ TABDECL( OP_EOR_ROR_IMM), -/* 0000 0010 1111 */ TABDECL( OP_UND), -/* 0000 0011 0000 */ TABDECL( OP_EOR_S_LSL_IMM), -/* 0000 0011 0001 */ TABDECL( OP_EOR_S_LSL_REG), -/* 0000 0011 0010 */ TABDECL( OP_EOR_S_LSR_IMM), -/* 0000 0011 0011 */ TABDECL( OP_EOR_S_LSR_REG), -/* 0000 0011 0100 */ TABDECL( OP_EOR_S_ASR_IMM), -/* 0000 0011 0101 */ TABDECL( OP_EOR_S_ASR_REG), -/* 0000 0011 0110 */ TABDECL( OP_EOR_S_ROR_IMM), -/* 0000 0011 0111 */ TABDECL( OP_EOR_S_ROR_REG), -/* 0000 0011 1000 */ TABDECL( OP_EOR_S_LSL_IMM), -/* 0000 0011 1001 */ TABDECL( OP_MLA_S), -/* 0000 0011 1010 */ TABDECL( OP_EOR_S_LSR_IMM), -/* 0000 0011 1011 */ TABDECL( OP_UND), -/* 0000 0011 1100 */ TABDECL( OP_EOR_S_ASR_IMM), -/* 0000 0011 1101 */ TABDECL( OP_UND), -/* 0000 0011 1110 */ TABDECL( OP_EOR_S_ROR_IMM), -/* 0000 0011 1111 */ TABDECL( OP_UND), -/* 0000 0100 0000 */ TABDECL( OP_SUB_LSL_IMM), -/* 0000 0100 0001 */ TABDECL( OP_SUB_LSL_REG), -/* 0000 0100 0010 */ TABDECL( OP_SUB_LSR_IMM), -/* 0000 0100 0011 */ TABDECL( OP_SUB_LSR_REG), -/* 0000 0100 0100 */ TABDECL( OP_SUB_ASR_IMM), -/* 0000 0100 0101 */ TABDECL( OP_SUB_ASR_REG), -/* 0000 0100 0110 */ TABDECL( OP_SUB_ROR_IMM), -/* 0000 0100 0111 */ TABDECL( OP_SUB_ROR_REG), -/* 0000 0100 1000 */ TABDECL( OP_SUB_LSL_IMM), -/* 0000 0100 1001 */ TABDECL( OP_UND), -/* 0000 0100 1010 */ TABDECL( OP_SUB_LSR_IMM), // OOO OO1O O 1010-/* 0000 0100 1011 */ TABDECL( OP_STRH_POS_INDE_M_IMM_OFF), -/* 0000 0100 1100 */ TABDECL( OP_SUB_ASR_IMM), -/* 0000 0100 1101 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 0100 1110 */ TABDECL( OP_SUB_ROR_IMM), -/* 0000 0100 1111 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 0101 0000 */ TABDECL( OP_SUB_S_LSL_IMM), -/* 0000 0101 0001 */ TABDECL( OP_SUB_S_LSL_REG), -/* 0000 0101 0010 */ TABDECL( OP_SUB_S_LSR_IMM), -/* 0000 0101 0011 */ TABDECL( OP_SUB_S_LSR_REG), -/* 0000 0101 0100 */ TABDECL( OP_SUB_S_ASR_IMM), -/* 0000 0101 0101 */ TABDECL( OP_SUB_S_ASR_REG), -/* 0000 0101 0110 */ TABDECL( OP_SUB_S_ROR_IMM), -/* 0000 0101 0111 */ TABDECL( OP_SUB_S_ROR_REG), -/* 0000 0101 1000 */ TABDECL( OP_SUB_S_LSL_IMM), -/* 0000 0101 1001 */ TABDECL( OP_UND), -/* 0000 0101 1010 */ TABDECL( OP_SUB_S_LSR_IMM), -/* 0000 0101 1011 */ TABDECL( OP_LDRH_POS_INDE_M_IMM_OFF), -/* 0000 0101 1100 */ TABDECL( OP_SUB_S_ASR_IMM), -/* 0000 0101 1101 */ TABDECL( OP_LDRSB_POS_INDE_M_IMM_OFF),-/* 0000 0101 1110 */ TABDECL( OP_SUB_S_ROR_IMM), -/* 0000 0101 1111 */ TABDECL( OP_LDRSH_POS_INDE_M_IMM_OFF),-/* 0000 0110 0000 */ TABDECL( OP_RSB_LSL_IMM), -/* 0000 0110 0001 */ TABDECL( OP_RSB_LSL_REG), -/* 0000 0110 0010 */ TABDECL( OP_RSB_LSR_IMM), -/* 0000 0110 0011 */ TABDECL( OP_RSB_LSR_REG), -/* 0000 0110 0100 */ TABDECL( OP_RSB_ASR_IMM), -/* 0000 0110 0101 */ TABDECL( OP_RSB_ASR_REG), -/* 0000 0110 0110 */ TABDECL( OP_RSB_ROR_IMM), -/* 0000 0110 0111 */ TABDECL( OP_RSB_ROR_REG), -/* 0000 0110 1000 */ TABDECL( OP_RSB_LSL_IMM), -/* 0000 0110 1001 */ TABDECL( OP_UND), -/* 0000 0110 1010 */ TABDECL( OP_RSB_LSR_IMM), // OOO OO11 O 1010-/* 0000 0110 1011 */ TABDECL( OP_UND), -/* 0000 0110 1100 */ TABDECL( OP_RSB_ASR_IMM), -/* 0000 0110 1101 */ TABDECL( OP_UND), -/* 0000 0110 1110 */ TABDECL( OP_RSB_ROR_IMM), -/* 0000 0110 1111 */ TABDECL( OP_UND), -/* 0000 0111 0000 */ TABDECL( OP_RSB_S_LSL_IMM), -/* 0000 0111 0001 */ TABDECL( OP_RSB_S_LSL_REG), -/* 0000 0111 0010 */ TABDECL( OP_RSB_S_LSR_IMM), -/* 0000 0111 0011 */ TABDECL( OP_RSB_S_LSR_REG), -/* 0000 0111 0100 */ TABDECL( OP_RSB_S_ASR_IMM), -/* 0000 0111 0101 */ TABDECL( OP_RSB_S_ASR_REG), -/* 0000 0111 0110 */ TABDECL( OP_RSB_S_ROR_IMM), -/* 0000 0111 0111 */ TABDECL( OP_RSB_S_ROR_REG), -/* 0000 0111 1000 */ TABDECL( OP_RSB_S_LSL_IMM), -/* 0000 0111 1001 */ TABDECL( OP_UND), -/* 0000 0111 1010 */ TABDECL( OP_RSB_S_LSR_IMM), -/* 0000 0111 1011 */ TABDECL( OP_UND), -/* 0000 0111 1100 */ TABDECL( OP_RSB_S_ASR_IMM), -/* 0000 0111 1101 */ TABDECL( OP_UND), -/* 0000 0111 1110 */ TABDECL( OP_RSB_S_ROR_IMM), -/* 0000 0111 1111 */ TABDECL( OP_UND), -/* 0000 1000 0000 */ TABDECL( OP_ADD_LSL_IMM), -/* 0000 1000 0001 */ TABDECL( OP_ADD_LSL_REG), -/* 0000 1000 0010 */ TABDECL( OP_ADD_LSR_IMM), -/* 0000 1000 0011 */ TABDECL( OP_ADD_LSR_REG), -/* 0000 1000 0100 */ TABDECL( OP_ADD_ASR_IMM), -/* 0000 1000 0101 */ TABDECL( OP_ADD_ASR_REG), -/* 0000 1000 0110 */ TABDECL( OP_ADD_ROR_IMM), -/* 0000 1000 0111 */ TABDECL( OP_ADD_ROR_REG), -/* 0000 1000 1000 */ TABDECL( OP_ADD_LSL_IMM), -/* 0000 1000 1001 */ TABDECL( OP_UMULL), -/* 0000 1000 1010 */ TABDECL( OP_ADD_LSR_IMM), // OOO O10O O 1010-/* 0000 1000 1011 */ TABDECL( OP_STRH_POS_INDE_P_REG_OFF), -/* 0000 1000 1100 */ TABDECL( OP_ADD_ASR_IMM), -/* 0000 1000 1101 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 1000 1110 */ TABDECL( OP_ADD_ROR_IMM), -/* 0000 1000 1111 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 1001 0000 */ TABDECL( OP_ADD_S_LSL_IMM), -/* 0000 1001 0001 */ TABDECL( OP_ADD_S_LSL_REG), -/* 0000 1001 0010 */ TABDECL( OP_ADD_S_LSR_IMM), -/* 0000 1001 0011 */ TABDECL( OP_ADD_S_LSR_REG), -/* 0000 1001 0100 */ TABDECL( OP_ADD_S_ASR_IMM), -/* 0000 1001 0101 */ TABDECL( OP_ADD_S_ASR_REG), -/* 0000 1001 0110 */ TABDECL( OP_ADD_S_ROR_IMM), -/* 0000 1001 0111 */ TABDECL( OP_ADD_S_ROR_REG), -/* 0000 1001 1000 */ TABDECL( OP_ADD_S_LSL_IMM), -/* 0000 1001 1001 */ TABDECL( OP_UMULL_S), -/* 0000 1001 1010 */ TABDECL( OP_ADD_S_LSR_IMM), -/* 0000 1001 1011 */ TABDECL( OP_LDRH_POS_INDE_P_REG_OFF), -/* 0000 1001 1100 */ TABDECL( OP_ADD_S_ASR_IMM), -/* 0000 1001 1101 */ TABDECL( OP_LDRSB_POS_INDE_P_REG_OFF),-/* 0000 1001 1110 */ TABDECL( OP_ADD_S_ROR_IMM), -/* 0000 1001 1111 */ TABDECL( OP_LDRSH_POS_INDE_P_REG_OFF),-/* 0000 1010 0000 */ TABDECL( OP_ADC_LSL_IMM), -/* 0000 1010 0001 */ TABDECL( OP_ADC_LSL_REG), -/* 0000 1010 0010 */ TABDECL( OP_ADC_LSR_IMM), -/* 0000 1010 0011 */ TABDECL( OP_ADC_LSR_REG), -/* 0000 1010 0100 */ TABDECL( OP_ADC_ASR_IMM), -/* 0000 1010 0101 */ TABDECL( OP_ADC_ASR_REG), -/* 0000 1010 0110 */ TABDECL( OP_ADC_ROR_IMM), -/* 0000 1010 0111 */ TABDECL( OP_ADC_ROR_REG), -/* 0000 1010 1000 */ TABDECL( OP_ADC_LSL_IMM), -/* 0000 1010 1001 */ TABDECL( OP_UMLAL), -/* 0000 1010 1010 */ TABDECL( OP_ADC_LSR_IMM), // OOO O101 O 1010-/* 0000 1010 1011 */ TABDECL( OP_UND), -/* 0000 1010 1100 */ TABDECL( OP_ADC_ASR_IMM), -/* 0000 1010 1101 */ TABDECL( OP_UND), -/* 0000 1010 1110 */ TABDECL( OP_ADC_ROR_IMM), -/* 0000 1010 1111 */ TABDECL( OP_UND), -/* 0000 1011 0000 */ TABDECL( OP_ADC_S_LSL_IMM), -/* 0000 1011 0001 */ TABDECL( OP_ADC_S_LSL_REG), -/* 0000 1011 0010 */ TABDECL( OP_ADC_S_LSR_IMM), -/* 0000 1011 0011 */ TABDECL( OP_ADC_S_LSR_REG), -/* 0000 1011 0100 */ TABDECL( OP_ADC_S_ASR_IMM), -/* 0000 1011 0101 */ TABDECL( OP_ADC_S_ASR_REG), -/* 0000 1011 0110 */ TABDECL( OP_ADC_S_ROR_IMM), -/* 0000 1011 0111 */ TABDECL( OP_ADC_S_ROR_REG), -/* 0000 1011 1000 */ TABDECL( OP_ADC_S_LSL_IMM), -/* 0000 1011 1001 */ TABDECL( OP_UMLAL_S), -/* 0000 1011 1010 */ TABDECL( OP_ADC_S_LSR_IMM), -/* 0000 1011 1011 */ TABDECL( OP_UND), -/* 0000 1011 1100 */ TABDECL( OP_ADC_S_ASR_IMM), -/* 0000 1011 1101 */ TABDECL( OP_UND), -/* 0000 1011 1110 */ TABDECL( OP_ADC_S_ROR_IMM), -/* 0000 1011 1111 */ TABDECL( OP_UND), -/* 0000 1100 0000 */ TABDECL( OP_SBC_LSL_IMM), -/* 0000 1100 0001 */ TABDECL( OP_SBC_LSL_REG), -/* 0000 1100 0010 */ TABDECL( OP_SBC_LSR_IMM), -/* 0000 1100 0011 */ TABDECL( OP_SBC_LSR_REG), -/* 0000 1100 0100 */ TABDECL( OP_SBC_ASR_IMM), -/* 0000 1100 0101 */ TABDECL( OP_SBC_ASR_REG), -/* 0000 1100 0110 */ TABDECL( OP_SBC_ROR_IMM), -/* 0000 1100 0111 */ TABDECL( OP_SBC_ROR_REG), -/* 0000 1100 1000 */ TABDECL( OP_SBC_LSL_IMM), -/* 0000 1100 1001 */ TABDECL( OP_SMULL), -/* 0000 1100 1010 */ TABDECL( OP_SBC_LSR_IMM), // OOO O11O O 1010-/* 0000 1100 1011 */ TABDECL( OP_STRH_POS_INDE_P_IMM_OFF), -/* 0000 1100 1100 */ TABDECL( OP_SBC_ASR_IMM), -/* 0000 1100 1101 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 1100 1110 */ TABDECL( OP_SBC_ROR_IMM), -/* 0000 1100 1111 */ TABDECL( OP_LDRD_STRD_POST_INDEX),-/* 0000 1101 0000 */ TABDECL( OP_SBC_S_LSL_IMM), -/* 0000 1101 0001 */ TABDECL( OP_SBC_S_LSL_REG), -/* 0000 1101 0010 */ TABDECL( OP_SBC_S_LSR_IMM), -/* 0000 1101 0011 */ TABDECL( OP_SBC_S_LSR_REG), -/* 0000 1101 0100 */ TABDECL( OP_SBC_S_ASR_IMM), -/* 0000 1101 0101 */ TABDECL( OP_SBC_S_ASR_REG), -/* 0000 1101 0110 */ TABDECL( OP_SBC_S_ROR_IMM), -/* 0000 1101 0111 */ TABDECL( OP_SBC_S_ROR_REG), -/* 0000 1101 1000 */ TABDECL( OP_SBC_S_LSL_IMM), -/* 0000 1101 1001 */ TABDECL( OP_SMULL_S), -/* 0000 1101 1010 */ TABDECL( OP_SBC_S_LSR_IMM), -/* 0000 1101 1011 */ TABDECL( OP_LDRH_POS_INDE_P_IMM_OFF), -/* 0000 1101 1100 */ TABDECL( OP_SBC_S_ASR_IMM), -/* 0000 1101 1101 */ TABDECL( OP_LDRSB_POS_INDE_P_IMM_OFF),-/* 0000 1101 1110 */ TABDECL( OP_SBC_S_ROR_IMM), -/* 0000 1101 1111 */ TABDECL( OP_LDRSH_POS_INDE_P_IMM_OFF),-/* 0000 1110 0000 */ TABDECL( OP_RSC_LSL_IMM), -/* 0000 1110 0001 */ TABDECL( OP_RSC_LSL_REG), -/* 0000 1110 0010 */ TABDECL( OP_RSC_LSR_IMM), -/* 0000 1110 0011 */ TABDECL( OP_RSC_LSR_REG), -/* 0000 1110 0100 */ TABDECL( OP_RSC_ASR_IMM), -/* 0000 1110 0101 */ TABDECL( OP_RSC_ASR_REG), -/* 0000 1110 0110 */ TABDECL( OP_RSC_ROR_IMM), -/* 0000 1110 0111 */ TABDECL( OP_RSC_ROR_REG), -/* 0000 1110 1000 */ TABDECL( OP_RSC_LSL_IMM), -/* 0000 1110 1001 */ TABDECL( OP_SMLAL), -/* 0000 1110 1010 */ TABDECL( OP_RSC_LSR_IMM), // OOO O111 O 1010-/* 0000 1110 1011 */ TABDECL( OP_UND), -/* 0000 1110 1100 */ TABDECL( OP_RSC_ASR_IMM), -/* 0000 1110 1101 */ TABDECL( OP_UND), -/* 0000 1110 1110 */ TABDECL( OP_RSC_ROR_IMM), -/* 0000 1110 1111 */ TABDECL( OP_UND), -/* 0000 1111 0000 */ TABDECL( OP_RSC_S_LSL_IMM), -/* 0000 1111 0001 */ TABDECL( OP_RSC_S_LSL_REG), -/* 0000 1111 0010 */ TABDECL( OP_RSC_S_LSR_IMM), -/* 0000 1111 0011 */ TABDECL( OP_RSC_S_LSR_REG), -/* 0000 1111 0100 */ TABDECL( OP_RSC_S_ASR_IMM), -/* 0000 1111 0101 */ TABDECL( OP_RSC_S_ASR_REG), -/* 0000 1111 0110 */ TABDECL( OP_RSC_S_ROR_IMM), -/* 0000 1111 0111 */ TABDECL( OP_RSC_S_ROR_REG), -/* 0000 1111 1000 */ TABDECL( OP_RSC_S_LSL_IMM), -/* 0000 1111 1001 */ TABDECL( OP_SMLAL_S), -/* 0000 1111 1010 */ TABDECL( OP_RSC_S_LSR_IMM), -/* 0000 1111 1011 */ TABDECL( OP_UND), -/* 0000 1111 1100 */ TABDECL( OP_RSC_S_ASR_IMM), -/* 0000 1111 1101 */ TABDECL( OP_UND), -/* 0000 1111 1110 */ TABDECL( OP_RSC_S_ROR_IMM), -/* 0000 1111 1111 */ TABDECL( OP_UND), -/* 0001 0000 0000 */ TABDECL( OP_MRS_CPSR), -/* 0001 0000 0001 */ TABDECL( OP_UND), -/* 0001 0000 0010 */ TABDECL( OP_UND), -/* 0001 0000 0011 */ TABDECL( OP_UND), -/* 0001 0000 0100 */ TABDECL( OP_UND), -/* 0001 0000 0101 */ TABDECL( OP_QADD), -/* 0001 0000 0110 */ TABDECL( OP_UND), -/* 0001 0000 0111 */ TABDECL( OP_UND), -/* 0001 0000 1000 */ TABDECL( OP_SMLA_B_B), -/* 0001 0000 1001 */ TABDECL( OP_SWP), -/* 0001 0000 1010 */ TABDECL( OP_SMLA_T_B), -/* 0001 0000 1011 */ TABDECL( OP_STRH_M_REG_OFF), -/* 0001 0000 1100 */ TABDECL( OP_SMLA_B_T), -/* 0001 0000 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0000 1110 */ TABDECL( OP_SMLA_T_T), -/* 0001 0000 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0001 0000 */ TABDECL( OP_TST_LSL_IMM), -/* 0001 0001 0001 */ TABDECL( OP_TST_LSL_REG), -/* 0001 0001 0010 */ TABDECL( OP_TST_LSR_IMM), -/* 0001 0001 0011 */ TABDECL( OP_TST_LSR_REG), -/* 0001 0001 0100 */ TABDECL( OP_TST_ASR_IMM), -/* 0001 0001 0101 */ TABDECL( OP_TST_ASR_REG), -/* 0001 0001 0110 */ TABDECL( OP_TST_ROR_IMM), -/* 0001 0001 0111 */ TABDECL( OP_TST_ROR_REG), -/* 0001 0001 1000 */ TABDECL( OP_TST_LSL_IMM), -/* 0001 0001 1001 */ TABDECL( OP_UND), -/* 0001 0001 1010 */ TABDECL( OP_TST_LSR_IMM), // OOO 100O 1 1010-/* 0001 0001 1011 */ TABDECL( OP_LDRH_M_REG_OFF), -/* 0001 0001 1100 */ TABDECL( OP_TST_ASR_IMM), -/* 0001 0001 1101 */ TABDECL( OP_LDRSB_M_REG_OFF),-/* 0001 0001 1110 */ TABDECL( OP_TST_ROR_IMM), -/* 0001 0001 1111 */ TABDECL( OP_LDRSH_M_REG_OFF),-/* 0001 0010 0000 */ TABDECL( OP_MSR_CPSR), -/* 0001 0010 0001 */ TABDECL( OP_BX), -/* 0001 0010 0010 */ TABDECL( OP_UND), -/* 0001 0010 0011 */ TABDECL( OP_BLX_REG), -/* 0001 0010 0100 */ TABDECL( OP_UND), -/* 0001 0010 0101 */ TABDECL( OP_QSUB), -/* 0001 0010 0110 */ TABDECL( OP_UND), -/* 0001 0010 0111 */ TABDECL( OP_BKPT), -/* 0001 0010 1000 */ TABDECL( OP_SMLAW_B), -/* 0001 0010 1001 */ TABDECL( OP_UND), -/* 0001 0010 1010 */ TABDECL( OP_SMULW_B), -/* 0001 0010 1011 */ TABDECL( OP_STRH_PRE_INDE_M_REG_OFF), -/* 0001 0010 1100 */ TABDECL( OP_SMLAW_T), -/* 0001 0010 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0010 1110 */ TABDECL( OP_SMULW_T), -/* 0001 0010 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0011 0000 */ TABDECL( OP_TEQ_LSL_IMM), -/* 0001 0011 0001 */ TABDECL( OP_TEQ_LSL_REG), -/* 0001 0011 0010 */ TABDECL( OP_TEQ_LSR_IMM), -/* 0001 0011 0011 */ TABDECL( OP_TEQ_LSR_REG), -/* 0001 0011 0100 */ TABDECL( OP_TEQ_ASR_IMM), -/* 0001 0011 0101 */ TABDECL( OP_TEQ_ASR_REG), -/* 0001 0011 0110 */ TABDECL( OP_TEQ_ROR_IMM), -/* 0001 0011 0111 */ TABDECL( OP_TEQ_ROR_REG), -/* 0001 0011 1000 */ TABDECL( OP_TEQ_LSL_IMM), -/* 0001 0011 1001 */ TABDECL( OP_UND), -/* 0001 0011 1010 */ TABDECL( OP_TEQ_LSR_IMM), // OOO 1001 1 1010-/* 0001 0011 1011 */ TABDECL( OP_LDRH_PRE_INDE_M_REG_OFF), -/* 0001 0011 1100 */ TABDECL( OP_TEQ_ASR_IMM), -/* 0001 0011 1101 */ TABDECL( OP_LDRSB_PRE_INDE_M_REG_OFF), -/* 0001 0011 1110 */ TABDECL( OP_TEQ_ROR_IMM), -/* 0001 0011 1111 */ TABDECL( OP_LDRSH_PRE_INDE_M_REG_OFF), -/* 0001 0100 0000 */ TABDECL( OP_MRS_SPSR), -/* 0001 0100 0001 */ TABDECL( OP_UND), -/* 0001 0100 0010 */ TABDECL( OP_UND), -/* 0001 0100 0011 */ TABDECL( OP_UND), -/* 0001 0100 0100 */ TABDECL( OP_UND), -/* 0001 0100 0101 */ TABDECL( OP_QDADD), -/* 0001 0100 0110 */ TABDECL( OP_UND), -/* 0001 0100 0111 */ TABDECL( OP_UND), -/* 0001 0100 1000 */ TABDECL( OP_SMLAL_B_B), -/* 0001 0100 1001 */ TABDECL( OP_SWPB), -/* 0001 0100 1010 */ TABDECL( OP_SMLAL_T_B), -/* 0001 0100 1011 */ TABDECL( OP_STRH_M_IMM_OFF), -/* 0001 0100 1100 */ TABDECL( OP_SMLAL_B_T), -/* 0001 0100 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0100 1110 */ TABDECL( OP_SMLAL_T_T), -/* 0001 0100 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0101 0000 */ TABDECL( OP_CMP_LSL_IMM), -/* 0001 0101 0001 */ TABDECL( OP_CMP_LSL_REG), -/* 0001 0101 0010 */ TABDECL( OP_CMP_LSR_IMM), -/* 0001 0101 0011 */ TABDECL( OP_CMP_LSR_REG), -/* 0001 0101 0100 */ TABDECL( OP_CMP_ASR_IMM), -/* 0001 0101 0101 */ TABDECL( OP_CMP_ASR_REG), -/* 0001 0101 0110 */ TABDECL( OP_CMP_ROR_IMM), -/* 0001 0101 0111 */ TABDECL( OP_CMP_ROR_REG), -/* 0001 0101 1000 */ TABDECL( OP_CMP_LSL_IMM), -/* 0001 0101 1001 */ TABDECL( OP_UND), -/* 0001 0101 1010 */ TABDECL( OP_CMP_LSR_IMM), // OOO 1O1O 1 1010-/* 0001 0101 1011 */ TABDECL( OP_LDRH_M_IMM_OFF), -/* 0001 0101 1100 */ TABDECL( OP_CMP_ASR_IMM), -/* 0001 0101 1101 */ TABDECL( OP_LDRSB_M_IMM_OFF),-/* 0001 0101 1110 */ TABDECL( OP_CMP_ROR_IMM), -/* 0001 0101 1111 */ TABDECL( OP_LDRSH_M_IMM_OFF),-/* 0001 0110 0000 */ TABDECL( OP_MSR_SPSR), -/* 0001 0110 0001 */ TABDECL( OP_CLZ), -/* 0001 0110 0010 */ TABDECL( OP_UND), -/* 0001 0110 0011 */ TABDECL( OP_UND), -/* 0001 0110 0100 */ TABDECL( OP_UND), -/* 0001 0110 0101 */ TABDECL( OP_QDSUB), -/* 0001 0110 0110 */ TABDECL( OP_UND), -/* 0001 0110 0111 */ TABDECL( OP_UND), -/* 0001 0110 1000 */ TABDECL( OP_SMUL_B_B), -/* 0001 0110 1001 */ TABDECL( OP_UND), -/* 0001 0110 1010 */ TABDECL( OP_SMUL_T_B), -/* 0001 0110 1011 */ TABDECL( OP_STRH_PRE_INDE_M_IMM_OFF), -/* 0001 0110 1100 */ TABDECL( OP_SMUL_B_T), -/* 0001 0110 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0110 1110 */ TABDECL( OP_SMUL_T_T), -/* 0001 0110 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 0111 0000 */ TABDECL( OP_CMN_LSL_IMM), -/* 0001 0111 0001 */ TABDECL( OP_CMN_LSL_REG), -/* 0001 0111 0010 */ TABDECL( OP_CMN_LSR_IMM), -/* 0001 0111 0011 */ TABDECL( OP_CMN_LSR_REG), -/* 0001 0111 0100 */ TABDECL( OP_CMN_ASR_IMM), -/* 0001 0111 0101 */ TABDECL( OP_CMN_ASR_REG), -/* 0001 0111 0110 */ TABDECL( OP_CMN_ROR_IMM), -/* 0001 0111 0111 */ TABDECL( OP_CMN_ROR_REG), -/* 0001 0111 1000 */ TABDECL( OP_CMN_LSL_IMM), -/* 0001 0111 1001 */ TABDECL( OP_UND), -/* 0001 0111 1010 */ TABDECL( OP_CMN_LSR_IMM), // OOO 1O11 1 1010-/* 0001 0111 1011 */ TABDECL( OP_LDRH_PRE_INDE_M_IMM_OFF), -/* 0001 0111 1100 */ TABDECL( OP_CMN_ASR_IMM), -/* 0001 0111 1101 */ TABDECL( OP_LDRSB_PRE_INDE_M_IMM_OFF), -/* 0001 0111 1110 */ TABDECL( OP_CMN_ROR_IMM), -/* 0001 0111 1111 */ TABDECL( OP_LDRSH_PRE_INDE_M_IMM_OFF), -/* 0001 1000 0000 */ TABDECL( OP_ORR_LSL_IMM), -/* 0001 1000 0001 */ TABDECL( OP_ORR_LSL_REG), -/* 0001 1000 0010 */ TABDECL( OP_ORR_LSR_IMM), -/* 0001 1000 0011 */ TABDECL( OP_ORR_LSR_REG), -/* 0001 1000 0100 */ TABDECL( OP_ORR_ASR_IMM), -/* 0001 1000 0101 */ TABDECL( OP_ORR_ASR_REG), -/* 0001 1000 0110 */ TABDECL( OP_ORR_ROR_IMM), -/* 0001 1000 0111 */ TABDECL( OP_ORR_ROR_REG), -/* 0001 1000 1000 */ TABDECL( OP_ORR_LSL_IMM), -/* 0001 1000 1001 */ TABDECL( OP_UND), -/* 0001 1000 1010 */ TABDECL( OP_ORR_LSR_IMM), // OOO 110O O 1010-/* 0001 1000 1011 */ TABDECL( OP_STRH_P_REG_OFF), -/* 0001 1000 1100 */ TABDECL( OP_ORR_ASR_IMM), -/* 0001 1000 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1000 1110 */ TABDECL( OP_ORR_ROR_IMM), -/* 0001 1000 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1001 0000 */ TABDECL( OP_ORR_S_LSL_IMM), -/* 0001 1001 0001 */ TABDECL( OP_ORR_S_LSL_REG), -/* 0001 1001 0010 */ TABDECL( OP_ORR_S_LSR_IMM), -/* 0001 1001 0011 */ TABDECL( OP_ORR_S_LSR_REG), -/* 0001 1001 0100 */ TABDECL( OP_ORR_S_ASR_IMM), -/* 0001 1001 0101 */ TABDECL( OP_ORR_S_ASR_REG), -/* 0001 1001 0110 */ TABDECL( OP_ORR_S_ROR_IMM), -/* 0001 1001 0111 */ TABDECL( OP_ORR_S_ROR_REG), -/* 0001 1001 1000 */ TABDECL( OP_ORR_S_LSL_IMM), -/* 0001 1001 1001 */ TABDECL( OP_UND), -/* 0001 1001 1010 */ TABDECL( OP_ORR_S_LSR_IMM), -/* 0001 1001 1011 */ TABDECL( OP_LDRH_P_REG_OFF), -/* 0001 1001 1100 */ TABDECL( OP_ORR_S_ASR_IMM), -/* 0001 1001 1101 */ TABDECL( OP_LDRSB_P_REG_OFF),-/* 0001 1001 1110 */ TABDECL( OP_ORR_S_ROR_IMM), -/* 0001 1001 1111 */ TABDECL( OP_LDRSH_P_REG_OFF),-/* 0001 1010 0000 */ TABDECL( OP_MOV_LSL_IMM), -/* 0001 1010 0001 */ TABDECL( OP_MOV_LSL_REG), -/* 0001 1010 0010 */ TABDECL( OP_MOV_LSR_IMM), -/* 0001 1010 0011 */ TABDECL( OP_MOV_LSR_REG), -/* 0001 1010 0100 */ TABDECL( OP_MOV_ASR_IMM), -/* 0001 1010 0101 */ TABDECL( OP_MOV_ASR_REG), -/* 0001 1010 0110 */ TABDECL( OP_MOV_ROR_IMM), -/* 0001 1010 0111 */ TABDECL( OP_MOV_ROR_REG), -/* 0001 1010 1000 */ TABDECL( OP_MOV_LSL_IMM), -/* 0001 1010 1001 */ TABDECL( OP_UND), -/* 0001 1010 1010 */ TABDECL( OP_MOV_LSR_IMM), // OOO 1101 O 1010-/* 0001 1010 1011 */ TABDECL( OP_STRH_PRE_INDE_P_REG_OFF), -/* 0001 1010 1100 */ TABDECL( OP_MOV_ASR_IMM), -/* 0001 1010 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1010 1110 */ TABDECL( OP_MOV_ROR_IMM), -/* 0001 1010 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1011 0000 */ TABDECL( OP_MOV_S_LSL_IMM), -/* 0001 1011 0001 */ TABDECL( OP_MOV_S_LSL_REG), -/* 0001 1011 0010 */ TABDECL( OP_MOV_S_LSR_IMM), -/* 0001 1011 0011 */ TABDECL( OP_MOV_S_LSR_REG), -/* 0001 1011 0100 */ TABDECL( OP_MOV_S_ASR_IMM), -/* 0001 1011 0101 */ TABDECL( OP_MOV_S_ASR_REG), -/* 0001 1011 0110 */ TABDECL( OP_MOV_S_ROR_IMM), -/* 0001 1011 0111 */ TABDECL( OP_MOV_S_ROR_REG), -/* 0001 1011 1000 */ TABDECL( OP_MOV_S_LSL_IMM), -/* 0001 1011 1001 */ TABDECL( OP_UND), -/* 0001 1011 1010 */ TABDECL( OP_MOV_S_LSR_IMM), -/* 0001 1011 1011 */ TABDECL( OP_LDRH_PRE_INDE_P_REG_OFF), -/* 0001 1011 1100 */ TABDECL( OP_MOV_S_ASR_IMM), -/* 0001 1011 1101 */ TABDECL( OP_LDRSB_PRE_INDE_P_REG_OFF),-/* 0001 1011 1110 */ TABDECL( OP_MOV_S_ROR_IMM), -/* 0001 1011 1111 */ TABDECL( OP_LDRSH_PRE_INDE_P_REG_OFF),-/* 0001 1100 0000 */ TABDECL( OP_BIC_LSL_IMM), -/* 0001 1100 0001 */ TABDECL( OP_BIC_LSL_REG), -/* 0001 1100 0010 */ TABDECL( OP_BIC_LSR_IMM), -/* 0001 1100 0011 */ TABDECL( OP_BIC_LSR_REG), -/* 0001 1100 0100 */ TABDECL( OP_BIC_ASR_IMM), -/* 0001 1100 0101 */ TABDECL( OP_BIC_ASR_REG), -/* 0001 1100 0110 */ TABDECL( OP_BIC_ROR_IMM), -/* 0001 1100 0111 */ TABDECL( OP_BIC_ROR_REG), -/* 0001 1100 1000 */ TABDECL( OP_BIC_LSL_IMM), -/* 0001 1100 1001 */ TABDECL( OP_UND), -/* 0001 1100 1010 */ TABDECL( OP_BIC_LSR_IMM), // OOO 111O O 1010-/* 0001 1100 1011 */ TABDECL( OP_STRH_P_IMM_OFF), -/* 0001 1100 1100 */ TABDECL( OP_BIC_ASR_IMM), -/* 0001 1100 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1100 1110 */ TABDECL( OP_BIC_ROR_IMM), -/* 0001 1100 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1101 0000 */ TABDECL( OP_BIC_S_LSL_IMM), -/* 0001 1101 0001 */ TABDECL( OP_BIC_S_LSL_REG), -/* 0001 1101 0010 */ TABDECL( OP_BIC_S_LSR_IMM), -/* 0001 1101 0011 */ TABDECL( OP_BIC_S_LSR_REG), -/* 0001 1101 0100 */ TABDECL( OP_BIC_S_ASR_IMM), -/* 0001 1101 0101 */ TABDECL( OP_BIC_S_ASR_REG), -/* 0001 1101 0110 */ TABDECL( OP_BIC_S_ROR_IMM), -/* 0001 1101 0111 */ TABDECL( OP_BIC_S_ROR_REG), -/* 0001 1101 1000 */ TABDECL( OP_BIC_S_LSL_IMM), -/* 0001 1101 1001 */ TABDECL( OP_UND), -/* 0001 1101 1010 */ TABDECL( OP_BIC_S_LSR_IMM), -/* 0001 1101 1011 */ TABDECL( OP_LDRH_P_IMM_OFF), -/* 0001 1101 1100 */ TABDECL( OP_BIC_S_ASR_IMM), -/* 0001 1101 1101 */ TABDECL( OP_LDRSB_P_IMM_OFF),-/* 0001 1101 1110 */ TABDECL( OP_BIC_S_ROR_IMM), -/* 0001 1101 1111 */ TABDECL( OP_LDRSH_P_IMM_OFF),-/* 0001 1110 0000 */ TABDECL( OP_MVN_LSL_IMM), -/* 0001 1110 0001 */ TABDECL( OP_MVN_LSL_REG), -/* 0001 1110 0010 */ TABDECL( OP_MVN_LSR_IMM), -/* 0001 1110 0011 */ TABDECL( OP_MVN_LSR_REG), -/* 0001 1110 0100 */ TABDECL( OP_MVN_ASR_IMM), -/* 0001 1110 0101 */ TABDECL( OP_MVN_ASR_REG), -/* 0001 1110 0110 */ TABDECL( OP_MVN_ROR_IMM), -/* 0001 1110 0111 */ TABDECL( OP_MVN_ROR_REG), -/* 0001 1110 1000 */ TABDECL( OP_MVN_LSL_IMM), -/* 0001 1110 1001 */ TABDECL( OP_UND), -/* 0001 1110 1010 */ TABDECL( OP_MVN_LSR_IMM), // OOO 1111 O 1010-/* 0001 1110 1011 */ TABDECL( OP_STRH_PRE_INDE_P_IMM_OFF), -/* 0001 1110 1100 */ TABDECL( OP_MVN_ASR_IMM), -/* 0001 1110 1101 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1110 1110 */ TABDECL( OP_MVN_ROR_IMM), -/* 0001 1110 1111 */ TABDECL( OP_LDRD_STRD_OFFSET_PRE_INDEX),-/* 0001 1111 0000 */ TABDECL( OP_MVN_S_LSL_IMM), -/* 0001 1111 0001 */ TABDECL( OP_MVN_S_LSL_REG), -/* 0001 1111 0010 */ TABDECL( OP_MVN_S_LSR_IMM), -/* 0001 1111 0011 */ TABDECL( OP_MVN_S_LSR_REG), -/* 0001 1111 0100 */ TABDECL( OP_MVN_S_ASR_IMM), -/* 0001 1111 0101 */ TABDECL( OP_MVN_S_ASR_REG), -/* 0001 1111 0110 */ TABDECL( OP_MVN_S_ROR_IMM), -/* 0001 1111 0111 */ TABDECL( OP_MVN_S_ROR_REG), -/* 0001 1111 1000 */ TABDECL( OP_MVN_S_LSL_IMM), -/* 0001 1111 1001 */ TABDECL( OP_UND), -/* 0001 1111 1010 */ TABDECL( OP_MVN_S_LSR_IMM), -/* 0001 1111 1011 */ TABDECL( OP_LDRH_PRE_INDE_P_IMM_OFF), -/* 0001 1111 1100 */ TABDECL( OP_MVN_S_ASR_IMM), -/* 0001 1111 1101 */ TABDECL( OP_LDRSB_PRE_INDE_P_IMM_OFF),-/* 0001 1111 1110 */ TABDECL( OP_MVN_S_ROR_IMM), -/* 0001 1111 1111 */ TABDECL( OP_LDRSH_PRE_INDE_P_IMM_OFF),-/* 0010 0000 0000 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0001 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0010 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0011 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0100 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0101 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0110 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 0111 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1000 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1001 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1010 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1011 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1100 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1101 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1110 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0000 1111 */ TABDECL( OP_AND_IMM_VAL), -/* 0010 0001 0000 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0001 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0010 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0011 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0100 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0101 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0110 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 0111 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1000 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1001 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1010 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1011 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1100 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1101 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1110 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0001 1111 */ TABDECL( OP_AND_S_IMM_VAL), -/* 0010 0010 0000 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0001 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0010 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0011 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0100 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0101 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0110 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 0111 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1000 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1001 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1010 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1011 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1100 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1101 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1110 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0010 1111 */ TABDECL( OP_EOR_IMM_VAL), -/* 0010 0011 0000 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0001 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0010 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0011 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0100 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0101 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0110 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 0111 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1000 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1001 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1010 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1011 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1100 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1101 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1110 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0011 1111 */ TABDECL( OP_EOR_S_IMM_VAL), -/* 0010 0100 0000 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0001 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0010 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0011 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0100 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0101 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0110 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 0111 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1000 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1001 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1010 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1011 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1100 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1101 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1110 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0100 1111 */ TABDECL( OP_SUB_IMM_VAL), -/* 0010 0101 0000 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0001 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0010 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0011 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0100 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0101 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0110 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 0111 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1000 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1001 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1010 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1011 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1100 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1101 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1110 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0101 1111 */ TABDECL( OP_SUB_S_IMM_VAL), -/* 0010 0110 0000 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0001 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0010 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0011 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0100 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0101 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0110 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 0111 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1000 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1001 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1010 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1011 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1100 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1101 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1110 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0110 1111 */ TABDECL( OP_RSB_IMM_VAL), -/* 0010 0111 0000 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0001 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0010 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0011 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0100 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0101 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0110 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 0111 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1000 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1001 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1010 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1011 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1100 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1101 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1110 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 0111 1111 */ TABDECL( OP_RSB_S_IMM_VAL), -/* 0010 1000 0000 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0001 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0010 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0011 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0100 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0101 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0110 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 0111 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1000 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1001 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1010 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1011 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1100 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1101 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1110 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1000 1111 */ TABDECL( OP_ADD_IMM_VAL), -/* 0010 1001 0000 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0001 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0010 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0011 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0100 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0101 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0110 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 0111 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1000 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1001 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1010 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1011 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1100 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1101 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1110 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1001 1111 */ TABDECL( OP_ADD_S_IMM_VAL), -/* 0010 1010 0000 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0001 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0010 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0011 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0100 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0101 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0110 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 0111 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1000 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1001 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1010 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1011 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1100 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1101 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1110 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1010 1111 */ TABDECL( OP_ADC_IMM_VAL), -/* 0010 1011 0000 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0001 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0010 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0011 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0100 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0101 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0110 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 0111 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1000 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1001 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1010 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1011 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1100 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1101 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1110 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1011 1111 */ TABDECL( OP_ADC_S_IMM_VAL), -/* 0010 1100 0000 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0001 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0010 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0011 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0100 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0101 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0110 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 0111 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1000 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1001 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1010 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1011 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1100 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1101 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1110 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1100 1111 */ TABDECL( OP_SBC_IMM_VAL), -/* 0010 1101 0000 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0001 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0010 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0011 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0100 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0101 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0110 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 0111 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1000 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1001 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1010 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1011 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1100 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1101 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1110 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1101 1111 */ TABDECL( OP_SBC_S_IMM_VAL), -/* 0010 1110 0000 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0001 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0010 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0011 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0100 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0101 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0110 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 0111 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1000 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1001 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1010 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1011 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1100 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1101 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1110 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1110 1111 */ TABDECL( OP_RSC_IMM_VAL), -/* 0010 1111 0000 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0001 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0010 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0011 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0100 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0101 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0110 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 0111 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1000 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1001 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1010 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1011 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1100 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1101 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1110 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0010 1111 1111 */ TABDECL( OP_RSC_S_IMM_VAL), -/* 0011 0000 0000 */ TABDECL( OP_UND), -/* 0011 0000 0001 */ TABDECL( OP_UND), -/* 0011 0000 0010 */ TABDECL( OP_UND), -/* 0011 0000 0011 */ TABDECL( OP_UND), -/* 0011 0000 0100 */ TABDECL( OP_UND), -/* 0011 0000 0101 */ TABDECL( OP_UND), -/* 0011 0000 0110 */ TABDECL( OP_UND), -/* 0011 0000 0111 */ TABDECL( OP_UND), -/* 0011 0000 1000 */ TABDECL( OP_UND), -/* 0011 0000 1001 */ TABDECL( OP_UND), -/* 0011 0000 1010 */ TABDECL( OP_UND), -/* 0011 0000 1011 */ TABDECL( OP_UND), -/* 0011 0000 1100 */ TABDECL( OP_UND), -/* 0011 0000 1101 */ TABDECL( OP_UND), -/* 0011 0000 1110 */ TABDECL( OP_UND), -/* 0011 0000 1111 */ TABDECL( OP_UND), -/* 0011 0001 0000 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0001 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0010 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0011 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0100 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0101 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0110 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 0111 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1000 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1001 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1010 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1011 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1100 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1101 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1110 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0001 1111 */ TABDECL( OP_TST_IMM_VAL), -/* 0011 0010 0000 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0001 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0010 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0011 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0100 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0101 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0110 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 0111 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1000 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1001 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1010 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1011 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1100 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1101 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1110 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0010 1111 */ TABDECL( OP_MSR_CPSR_IMM_VAL), -/* 0011 0011 0000 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0001 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0010 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0011 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0100 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0101 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0110 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 0111 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1000 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1001 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1010 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1011 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1100 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1101 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1110 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0011 1111 */ TABDECL( OP_TEQ_IMM_VAL), -/* 0011 0100 0000 */ TABDECL( OP_UND), -/* 0011 0100 0001 */ TABDECL( OP_UND), -/* 0011 0100 0010 */ TABDECL( OP_UND), -/* 0011 0100 0011 */ TABDECL( OP_UND), -/* 0011 0100 0100 */ TABDECL( OP_UND), -/* 0011 0100 0101 */ TABDECL( OP_UND), -/* 0011 0100 0110 */ TABDECL( OP_UND), -/* 0011 0100 0111 */ TABDECL( OP_UND), -/* 0011 0100 1000 */ TABDECL( OP_UND), -/* 0011 0100 1001 */ TABDECL( OP_UND), -/* 0011 0100 1010 */ TABDECL( OP_UND), -/* 0011 0100 1011 */ TABDECL( OP_UND), -/* 0011 0100 1100 */ TABDECL( OP_UND), -/* 0011 0100 1101 */ TABDECL( OP_UND), -/* 0011 0100 1110 */ TABDECL( OP_UND), -/* 0011 0100 1111 */ TABDECL( OP_UND), -/* 0011 0101 0000 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0001 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0010 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0011 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0100 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0101 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0110 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 0111 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1000 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1001 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1010 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1011 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1100 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1101 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1110 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0101 1111 */ TABDECL( OP_CMP_IMM_VAL), -/* 0011 0110 0000 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0001 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0010 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0011 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0100 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0101 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0110 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 0111 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1000 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1001 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1010 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1011 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1100 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1101 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1110 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0110 1111 */ TABDECL( OP_MSR_SPSR_IMM_VAL), -/* 0011 0111 0000 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0001 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0010 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0011 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0100 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0101 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0110 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 0111 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1000 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1001 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1010 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1011 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1100 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1101 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1110 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 0111 1111 */ TABDECL( OP_CMN_IMM_VAL), -/* 0011 1000 0000 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0001 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0010 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0011 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0100 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0101 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0110 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 0111 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1000 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1001 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1010 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1011 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1100 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1101 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1110 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1000 1111 */ TABDECL( OP_ORR_IMM_VAL), -/* 0011 1001 0000 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0001 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0010 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0011 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0100 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0101 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0110 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 0111 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1000 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1001 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1010 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1011 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1100 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1101 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1110 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1001 1111 */ TABDECL( OP_ORR_S_IMM_VAL), -/* 0011 1010 0000 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0001 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0010 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0011 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0100 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0101 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0110 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 0111 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1000 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1001 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1010 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1011 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1100 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1101 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1110 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1010 1111 */ TABDECL( OP_MOV_IMM_VAL), -/* 0011 1011 0000 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0001 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0010 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0011 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0100 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0101 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0110 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 0111 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1000 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1001 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1010 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1011 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1100 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1101 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1110 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1011 1111 */ TABDECL( OP_MOV_S_IMM_VAL), -/* 0011 1100 0000 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0001 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0010 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0011 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0100 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0101 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0110 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 0111 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1000 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1001 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1010 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1011 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1100 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1101 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1110 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1100 1111 */ TABDECL( OP_BIC_IMM_VAL), -/* 0011 1101 0000 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0001 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0010 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0011 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0100 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0101 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0110 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 0111 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1000 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1001 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1010 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1011 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1100 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1101 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1110 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1101 1111 */ TABDECL( OP_BIC_S_IMM_VAL), -/* 0011 1110 0000 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0001 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0010 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0011 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0100 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0101 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0110 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 0111 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1000 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1001 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1010 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1011 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1100 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1101 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1110 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1110 1111 */ TABDECL( OP_MVN_IMM_VAL), -/* 0011 1111 0000 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0001 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0010 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0011 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0100 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0101 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0110 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 0111 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 1000 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 1001 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 1010 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 1011 */ TABDECL( OP_MVN_S_IMM_VAL), -/* 0011 1111 1100 */ TABDECL( OP_MVN_S_IMM_VAL... [truncated message content]

[Desmume-cvs] SF.net SVN: desmume:[4222] trunk/desmume/src

From: <ze...@us...> - 2012-03-29 23:03:12

Revision: 4222 Author: zeromusDate: 2012-03-29 23:03:06 +0000 (Thu, 29 Mar 2012)Log Message:-----------core-switch some hardcoded PROCNUM checks in opcode handlers to checks against the arm architecture version, which is what they really wereModified Paths:-------------- trunk/desmume/src/arm_instructions.cpp trunk/desmume/src/armcpu.cpp trunk/desmume/src/armcpu.h trunk/desmume/src/thumb_instructions.cppModified: trunk/desmume/src/arm_instructions.cpp===================================================================--- trunk/desmume/src/arm_instructions.cpp2012-03-29 22:45:05 UTC (rev 4221)+++ trunk/desmume/src/arm_instructions.cpp2012-03-29 23:03:06 UTC (rev 4222)@@ -3653,7 +3653,7 @@ \ if(REG_POS(i,12)==15) \ { \-if (PROCNUM == 0) \+if (cpu->LDTBit) \ { \ cpu->CPSR.bits.T = BIT0(cpu->R[15]); \ cpu->R[15] &= 0xFFFFFFFE; \@@ -3675,7 +3675,7 @@ \ if(REG_POS(i,12)==15) \ { \-if (PROCNUM == 0) \+if (cpu->LDTBit) \ { \ cpu->CPSR.bits.T = BIT0(cpu->R[15]); \ cpu->R[15] &= 0xFFFFFFFE; \@@ -3698,7 +3698,7 @@ \ if(REG_POS(i,12)==15) \ { \-if (PROCNUM == 0) \+if (cpu->LDTBit) \ { \ cpu->CPSR.bits.T = BIT0(cpu->R[15]); \ cpu->R[15] &= 0xFFFFFFFE; \@@ -4860,7 +4860,7 @@ //T Bit = value[0] //else //pc = value AND 0xFFFFFFFC-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -4904,7 +4904,7 @@ start += 4; c += MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(start); u32 tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -4928,7 +4928,7 @@ if(BIT15(i)) { u32 tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -4970,7 +4970,7 @@ { start -= 4; u32 tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -5027,7 +5027,7 @@ if(BIT15(i)) { u32 tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -5079,7 +5079,7 @@ start += 4; c += MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(start); tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -5113,7 +5113,7 @@ if(BIT15(i)) { u32 tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp); registres[15] = tmp & 0xFFFFFFFE;@@ -5163,11 +5163,10 @@ u32 tmp; start -= 4; tmp = READ32(cpu->mem_if->data, start);-if (PROCNUM == 0)+if (cpu->LDTBit) { cpu->CPSR.bits.T = BIT0(tmp);-registres[15] = tmp & 0xFFFFFFFE;-}+registres[15] = tmp & 0xFFFFFFFE;} else registres[15] = tmp & 0xFFFFFFFC; cpu->next_instruction = registres[15];Modified: trunk/desmume/src/armcpu.cpp===================================================================--- trunk/desmume/src/armcpu.cpp2012-03-29 22:45:05 UTC (rev 4221)+++ trunk/desmume/src/armcpu.cpp2012-03-29 23:03:06 UTC (rev 4222)@@ -215,7 +215,7 @@ void armcpu_init(armcpu_t *armcpu, u32 adr) {-armcpu->LDTBit = (armcpu->proc_ID==0); //Si ARM9 utiliser le syte v5 pour le load+armcpu->LDTBit = (armcpu->proc_ID==0); //arm9 is ARMv5 style. this should be renamed, or more likely, all references to this should poll a function to return an architecture level enum armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0); armcpu->waitIRQ = FALSE; armcpu->halt_IE_and_IF = FALSE;Modified: trunk/desmume/src/armcpu.h===================================================================--- trunk/desmume/src/armcpu.h2012-03-29 22:45:05 UTC (rev 4221)+++ trunk/desmume/src/armcpu.h2012-03-29 23:03:06 UTC (rev 4222)@@ -203,7 +203,7 @@ armcp_t *coproc[16]; u32 intVector;-u8 LDTBit; //1 : ARMv5 style 0 : non ARMv5+u8 LDTBit; //1 : ARMv5 style 0 : non ARMv5 (earlier) BOOL waitIRQ; BOOL halt_IE_and_IF; //the cpu is halted, waiting for IE&IF to signal something u8 intrWaitARM_state;Modified: trunk/desmume/src/thumb_instructions.cpp===================================================================--- trunk/desmume/src/thumb_instructions.cpp2012-03-29 22:45:05 UTC (rev 4221)+++ trunk/desmume/src/thumb_instructions.cpp2012-03-29 23:03:06 UTC (rev 4222)@@ -637,7 +637,7 @@ //In earlier versions of the architecture, the value of the C flag was UNPREDICTABLE //after a MUL instruction. -if (PROCNUM == 1)// ARM4T 1S + mI, m = 3+if (!cpu->LDTBit)// ARM4T 1S + mI, m = 3 return 4; MUL_Mxx_END_THUMB(1);@@ -909,7 +909,7 @@ v = READ32(cpu->mem_if->data, adr); c += MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(adr);-if(PROCNUM==0)+if(cpu->LDTBit) cpu->CPSR.bits.T = BIT0(v); cpu->R[15] = v & 0xFFFFFFFE;This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[5068] trunk/desmume/src

From: <rog...@us...> - 2015-01-10 02:04:34

Revision: 5068 http://sourceforge.net/p/desmume/code/5068Author: rogermanDate: 2015-01-10 02:04:18 +0000 (Sat, 10 Jan 2015)Log Message:-----------Core:- Do a massive cleanup of the #include and header structure.- Remove a lot of unnecessary dependencies in the headers.- Make headers responsible for including what they need for themselves. This makes the headers more independent of where they are in the #include order.- Relocate some structs/classes to more logical locations.- Clean up some platform-specific #ifdef stuff.Modified Paths:-------------- trunk/desmume/src/FIFO.cpp trunk/desmume/src/GPU.cpp trunk/desmume/src/GPU.h trunk/desmume/src/GPU_osd.cpp trunk/desmume/src/MMU.cpp trunk/desmume/src/MMU.h trunk/desmume/src/NDSSystem.cpp trunk/desmume/src/NDSSystem.h trunk/desmume/src/OGLRender.cpp trunk/desmume/src/SPU.cpp trunk/desmume/src/SPU.h trunk/desmume/src/addons/slot1_none.cpp trunk/desmume/src/addons/slot1_r4.cpp trunk/desmume/src/addons/slot1_retail_auto.cpp trunk/desmume/src/addons/slot1_retail_mcrom.cpp trunk/desmume/src/addons/slot1_retail_mcrom_debug.cpp trunk/desmume/src/addons/slot1_retail_nand.cpp trunk/desmume/src/addons/slot1comp_mc.cpp trunk/desmume/src/addons/slot1comp_mc.h trunk/desmume/src/addons/slot1comp_protocol.cpp trunk/desmume/src/addons/slot1comp_protocol.h trunk/desmume/src/addons/slot1comp_rom.cpp trunk/desmume/src/addons/slot1comp_rom.h trunk/desmume/src/addons/slot2_auto.cpp trunk/desmume/src/addons/slot2_expMemory.cpp trunk/desmume/src/addons/slot2_gbagame.cpp trunk/desmume/src/addons/slot2_mpcf.cpp trunk/desmume/src/addons/slot2_paddle.cpp trunk/desmume/src/addons/slot2_passme.cpp trunk/desmume/src/arm_instructions.cpp trunk/desmume/src/arm_jit.cpp trunk/desmume/src/armcpu.cpp trunk/desmume/src/armcpu.h trunk/desmume/src/bios.cpp trunk/desmume/src/bios.h trunk/desmume/src/cheatSystem.cpp trunk/desmume/src/cheatSystem.h trunk/desmume/src/cli/main.cpp trunk/desmume/src/cocoa/cocoa_cheat.h trunk/desmume/src/cocoa/cocoa_cheat.mm trunk/desmume/src/cocoa/cocoa_core.mm trunk/desmume/src/cocoa/cocoa_firmware.mm trunk/desmume/src/cocoa/cocoa_output.mm trunk/desmume/src/cocoa/cocoa_rom.mm trunk/desmume/src/cocoa/mic_ext.cpp trunk/desmume/src/cocoa/openemu/NDSGameCore.mm trunk/desmume/src/common.cpp trunk/desmume/src/common.h trunk/desmume/src/cp15.cpp trunk/desmume/src/cp15.h trunk/desmume/src/debug.h trunk/desmume/src/driver.cpp trunk/desmume/src/driver.h trunk/desmume/src/encrypt.cpp trunk/desmume/src/filter/videofilter.h trunk/desmume/src/firmware.cpp trunk/desmume/src/firmware.h trunk/desmume/src/gdbstub/gdbstub.cpp trunk/desmume/src/gdbstub/gdbstub_internal.h trunk/desmume/src/gdbstub.h trunk/desmume/src/gfx3d.cpp trunk/desmume/src/gfx3d.h trunk/desmume/src/gtk/dTool.h trunk/desmume/src/gtk/dToolsList.cpp trunk/desmume/src/gtk/desmume.cpp trunk/desmume/src/gtk/main.cpp trunk/desmume/src/gtk/tools/ioregsView.cpp trunk/desmume/src/instructions.h trunk/desmume/src/lua-engine.cpp trunk/desmume/src/lua-engine.h trunk/desmume/src/mc.cpp trunk/desmume/src/mc.h trunk/desmume/src/metaspu/SndOut.cpp trunk/desmume/src/metaspu/SndOut.h trunk/desmume/src/metaspu/Timestretcher.cpp trunk/desmume/src/metaspu/metaspu.cpp trunk/desmume/src/metaspu/metaspu.h trunk/desmume/src/mic.h trunk/desmume/src/movie.cpp trunk/desmume/src/movie.h trunk/desmume/src/path.h trunk/desmume/src/rasterize.cpp trunk/desmume/src/readwrite.cpp trunk/desmume/src/readwrite.h trunk/desmume/src/render3D.cpp trunk/desmume/src/saves.cpp trunk/desmume/src/slot1.h trunk/desmume/src/slot2.cpp trunk/desmume/src/slot2.h trunk/desmume/src/texcache.cpp trunk/desmume/src/texcache.h trunk/desmume/src/thumb_instructions.cpp trunk/desmume/src/types.h trunk/desmume/src/utils/advanscene.cpp trunk/desmume/src/utils/advanscene.h trunk/desmume/src/utils/decrypt/crc.h trunk/desmume/src/utils/decrypt/decrypt.cpp trunk/desmume/src/utils/decrypt/decrypt.h trunk/desmume/src/utils/emufat.cpp trunk/desmume/src/utils/emufat.h trunk/desmume/src/utils/vfat.cpp trunk/desmume/src/wifi.cpp trunk/desmume/src/wifi.h trunk/desmume/src/windows/AboutBox.cpp trunk/desmume/src/windows/AboutBox.h trunk/desmume/src/windows/CWindow.cpp trunk/desmume/src/windows/CWindow.h trunk/desmume/src/windows/FEX_Interface.cpp trunk/desmume/src/windows/FEX_Interface.h trunk/desmume/src/windows/FirmConfig.cpp trunk/desmume/src/windows/IORegView.cpp trunk/desmume/src/windows/IORegView.h trunk/desmume/src/windows/OpenArchive.cpp trunk/desmume/src/windows/aviout.cpp trunk/desmume/src/windows/aviout.h trunk/desmume/src/windows/cheatsWin.cpp trunk/desmume/src/windows/cheatsWin.h trunk/desmume/src/windows/colorctrl.cpp trunk/desmume/src/windows/colorctrl.h trunk/desmume/src/windows/console.cpp trunk/desmume/src/windows/disView.cpp trunk/desmume/src/windows/disView.h trunk/desmume/src/windows/fsnitroView.cpp trunk/desmume/src/windows/fsnitroView.h trunk/desmume/src/windows/gbaslot_config.cpp trunk/desmume/src/windows/gbaslot_config.h trunk/desmume/src/windows/ginfo.cpp trunk/desmume/src/windows/ginfo.h trunk/desmume/src/windows/hotkey.cpp trunk/desmume/src/windows/hotkey.h trunk/desmume/src/windows/importSave.cpp trunk/desmume/src/windows/importSave.h trunk/desmume/src/windows/inputdx.cpp trunk/desmume/src/windows/inputdx.h trunk/desmume/src/windows/lightView.cpp trunk/desmume/src/windows/lightView.h trunk/desmume/src/windows/luaconsole.cpp trunk/desmume/src/windows/main.cpp trunk/desmume/src/windows/main.h trunk/desmume/src/windows/mapView.cpp trunk/desmume/src/windows/mapView.h trunk/desmume/src/windows/matrixView.cpp trunk/desmume/src/windows/matrixView.h trunk/desmume/src/windows/memView.cpp trunk/desmume/src/windows/memView.h trunk/desmume/src/windows/mic.cpp trunk/desmume/src/windows/oamView.cpp trunk/desmume/src/windows/oamView.h trunk/desmume/src/windows/palView.cpp trunk/desmume/src/windows/palView.h trunk/desmume/src/windows/pathsettings.h trunk/desmume/src/windows/ram_search.cpp trunk/desmume/src/windows/ram_search.h trunk/desmume/src/windows/ramwatch.cpp trunk/desmume/src/windows/recentroms.cpp trunk/desmume/src/windows/recentroms.h trunk/desmume/src/windows/replay.cpp trunk/desmume/src/windows/replay.h trunk/desmume/src/windows/slot1_config.cpp trunk/desmume/src/windows/slot1_config.h trunk/desmume/src/windows/snddx.cpp trunk/desmume/src/windows/snddx.h trunk/desmume/src/windows/sndxa2.cpp trunk/desmume/src/windows/sndxa2.h trunk/desmume/src/windows/soundView.cpp trunk/desmume/src/windows/soundView.h trunk/desmume/src/windows/throttle.cpp trunk/desmume/src/windows/tileView.cpp trunk/desmume/src/windows/tileView.h trunk/desmume/src/windows/winutil.hModified: trunk/desmume/src/FIFO.cpp===================================================================--- trunk/desmume/src/FIFO.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/FIFO.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,7 +1,7 @@ /* Copyright 2006 yopyop Copyright 2007 shash-Copyright 2007-2012 DeSmuME team+Copyright 2007-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,11 +18,14 @@ */ #include "FIFO.h"+ #include <string.h>+ #include "armcpu.h" #include "debug.h" #include "mem.h" #include "MMU.h"+#include "registers.h" #include "NDSSystem.h" #include "gfx3d.h" Modified: trunk/desmume/src/GPU.cpp===================================================================--- trunk/desmume/src/GPU.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/GPU.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -2,7 +2,7 @@ Copyright (C) 2006 yopyop Copyright (C) 2006-2007 Theo Berkau Copyright (C) 2007 shash-Copyright (C) 2008-2013 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,21 +18,26 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include "GPU.h" +#include <assert.h>+#include <stdlib.h>+#include <string.h> #include <algorithm>-#include <string.h>-#include <stdlib.h>-#include <assert.h> #include <iostream>+ #include "MMU.h"-#include "GPU.h"+#include "FIFO.h" #include "debug.h" #include "render3D.h"+#include "registers.h" #include "gfx3d.h" #include "debug.h" #include "GPU_osd.h" #include "NDSSystem.h" #include "readwrite.h"+#include "matrix.h"+#include "emufile.h" #ifdef FASTBUILD #undef FORCEINLINE@@ -2739,6 +2744,16 @@ } } +u32 GPU::getHOFS(int bg)+{+return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxHOFS,0) & 0x1FF;+}++u32 GPU::getVOFS(int bg)+{+return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxVOFS,0) & 0x1FF;+}+ void gpu_SetRotateScreen(u16 angle) { gpu_angle = angle;Modified: trunk/desmume/src/GPU.h===================================================================--- trunk/desmume/src/GPU.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/GPU.h2015-01-10 02:04:18 UTC (rev 5068)@@ -2,7 +2,7 @@ Copyright (C) 2006 yopyop Copyright (C) 2006-2007 Theo Berkau Copyright (C) 2007 shash-Copyright (C) 2009-2012 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -22,13 +22,13 @@ #define GPU_H #include <stdio.h>-#include "mem.h"-#include "common.h"-#include "registers.h"-#include "FIFO.h"-#include "MMU.h" #include <iosfwd> +#include "types.h"++class EMUFILE;+struct MMU_struct;+ //#undef FORCEINLINE //#define FORCEINLINE @@ -783,8 +783,8 @@ updateBLDALPHA(); } -u32 getHOFS(int bg) { return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxHOFS,0) & 0x1FF; }-u32 getVOFS(int bg) { return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxVOFS,0) & 0x1FF; }+u32 getHOFS(int bg);+u32 getVOFS(int bg); typedef u8 TBlendTable[32][32]; TBlendTable *blendTable;Modified: trunk/desmume/src/GPU_osd.cpp===================================================================--- trunk/desmume/src/GPU_osd.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/GPU_osd.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop-Copyright (C) 2006-2011 DeSmuME team+Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -17,6 +17,7 @@ */ #include "GPU_osd.h"+#include "driver.h" #include "GPU.h" #include "mem.h" #include <string.h> //mem funcsModified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/MMU.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -23,13 +23,16 @@ #include <assert.h> #include <sstream> +#include "armcpu.h" #include "common.h" #include "debug.h"+#include "driver.h" #include "NDSSystem.h" #include "cp15.h" #include "wifi.h" #include "registers.h" #include "render3D.h"+#include "FIFO.h" #include "gfx3d.h" #include "rtc.h" #include "mc.h"@@ -41,6 +44,8 @@ #include "MMU_timing.h" #include "firmware.h" #include "encrypt.h"+#include "GPU.h"+#include "SPU.h" #ifdef DO_ASSERT_UNALIGNED #define ASSERT_UNALIGNED(x) assert(x)@@ -1259,7 +1264,30 @@ NDS_makeIrq(PROCNUM, IRQ_BIT_GC_TRANSFER_COMPLETE); } +void GC_Command::print()+{+GCLOG("%02X%02X%02X%02X%02X%02X%02X%02X\n",bytes[0],bytes[1],bytes[2],bytes[3],bytes[4],bytes[5],bytes[6],bytes[7]);+} +void GC_Command::toCryptoBuffer(u32 buf[2])+{+u8 temp[8] = { bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0] };+buf[0] = T1ReadLong(temp,0);+buf[1] = T1ReadLong(temp,4);+}++void GC_Command::fromCryptoBuffer(u32 buf[2])+{+bytes[7] = (buf[0]>>0)&0xFF;+bytes[6] = (buf[0]>>8)&0xFF;+bytes[5] = (buf[0]>>16)&0xFF;+bytes[4] = (buf[0]>>24)&0xFF;+bytes[3] = (buf[1]>>0)&0xFF;+bytes[2] = (buf[1]>>8)&0xFF;+bytes[1] = (buf[1]>>16)&0xFF;+bytes[0] = (buf[1]>>24)&0xFF;+}+ template<int PROCNUM> void FASTCALL MMU_writeToGCControl(u32 val) {@@ -2057,6 +2085,11 @@ return temp; } +bool MMU_struct_new::is_dma(const u32 adr)+{+return adr >= _REG_DMA_CONTROL_MIN && adr <= _REG_DMA_CONTROL_MAX;+}+ MMU_struct_new::MMU_struct_new() { for(int i=0;i<2;i++)@@ -2066,6 +2099,36 @@ } } +void DivController::savestate(EMUFILE* os)+{+write8le(&mode,os);+write8le(&busy,os);+write8le(&div0,os);+}++bool DivController::loadstate(EMUFILE* is, int version)+{+int ret = 1;+ret &= read8le(&mode,is);+ret &= read8le(&busy,is);+ret &= read8le(&div0,is);+return ret==1;+}++void SqrtController::savestate(EMUFILE* os)+{+write8le(&mode,os);+write8le(&busy,os);+}++bool SqrtController::loadstate(EMUFILE* is, int version)+{+int ret=1;+ret &= read8le(&mode,is);+ret &= read8le(&busy,is);+return ret==1;+}+ bool DmaController::loadstate(EMUFILE* f) { u32 version;Modified: trunk/desmume/src/MMU.h===================================================================--- trunk/desmume/src/MMU.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/MMU.h2015-01-10 02:04:18 UTC (rev 5068)@@ -20,14 +20,10 @@ #ifndef MMU_H #define MMU_H -#include "FIFO.h"-#include "mem.h"-#include "registers.h"-#include "mc.h"-#include "bits.h"-#include "readwrite.h" #include "debug.h" #include "firmware.h"+#include "mc.h"+#include "mem.h" #ifdef HAVE_LUA #include "lua-engine.h"@@ -41,9 +37,10 @@ #define ARMCPU_ARM9 0 #define ARMPROC (PROCNUM ? NDS_ARM7:NDS_ARM9) +class EMUFILE;+ typedef const u8 TWaitState; - enum EDMAMode { EDMAMode_Immediate = 0,@@ -152,20 +149,8 @@ mode = val&3; //todo - do we clear the div0 flag here or is that strictly done by the divider unit? }-void savestate(EMUFILE* os)-{-write8le(&mode,os);-write8le(&busy,os);-write8le(&div0,os);-}-bool loadstate(EMUFILE* is, int version)-{-int ret = 1;-ret &= read8le(&mode,is);-ret &= read8le(&busy,is);-ret &= read8le(&div0,is);-return ret==1;-}+void savestate(EMUFILE* os);+bool loadstate(EMUFILE* is, int version); }; class SqrtController@@ -178,18 +163,8 @@ u8 mode, busy; u16 read16() { return mode|(busy<<15); } void write16(u16 val) { mode = val&1; }-void savestate(EMUFILE* os)-{-write8le(&mode,os);-write8le(&busy,os);-}-bool loadstate(EMUFILE* is, int version)-{-int ret=1;-ret &= read8le(&mode,is);-ret &= read8le(&busy,is);-return ret==1;-}+void savestate(EMUFILE* os);+bool loadstate(EMUFILE* is, int version); }; @@ -324,27 +299,10 @@ struct GC_Command { u8 bytes[8];-void print()-{-GCLOG("%02X%02X%02X%02X%02X%02X%02X%02X\n",bytes[0],bytes[1],bytes[2],bytes[3],bytes[4],bytes[5],bytes[6],bytes[7]);-}-void toCryptoBuffer(u32 buf[2])-{-u8 temp[8] = { bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0] };-buf[0] = T1ReadLong(temp,0);-buf[1] = T1ReadLong(temp,4);-}-void fromCryptoBuffer(u32 buf[2])-{-bytes[7] = (buf[0]>>0)&0xFF;-bytes[6] = (buf[0]>>8)&0xFF;-bytes[5] = (buf[0]>>16)&0xFF;-bytes[4] = (buf[0]>>24)&0xFF;-bytes[3] = (buf[1]>>0)&0xFF;-bytes[2] = (buf[1]>>8)&0xFF;-bytes[1] = (buf[1]>>16)&0xFF;-bytes[0] = (buf[1]>>24)&0xFF;-}++void print();+void toCryptoBuffer(u32 buf[2]);+void fromCryptoBuffer(u32 buf[2]); }; //should rather be known as GCBUS controller, or somesuch@@ -506,14 +464,15 @@ void write_dma(const int proc, const int size, const u32 adr, const u32 val); u32 read_dma(const int proc, const int size, const u32 adr);-bool is_dma(const u32 adr) { return adr >= _REG_DMA_CONTROL_MIN && adr <= _REG_DMA_CONTROL_MAX; }+bool is_dma(const u32 adr); }; extern MMU_struct MMU; extern MMU_struct_new MMU_new; -typedef struct {+struct armcpu_memory_iface+{ /** the 32 bit instruction prefetch */ u32 FASTCALL (*prefetch32)( void *data, u32 adr); @@ -535,7 +494,7 @@ void FASTCALL (*write32)( void *data, u32 adr, u32 val); void *data;-} armcpu_memory_iface;+}; void MMU_Init(void);Modified: trunk/desmume/src/NDSSystem.cpp===================================================================--- trunk/desmume/src/NDSSystem.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/NDSSystem.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -16,34 +16,44 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include "NDSSystem.h"+ #include <string.h> #include <stdlib.h> #include <algorithm> #include <math.h> #include <zlib.h> +#include "utils/decrypt/decrypt.h"+#include "utils/decrypt/crc.h"+#include "utils/advanscene.h"+#include "utils/task.h"+ #include "common.h"-#include "NDSSystem.h"+#include "armcpu.h" #include "render3D.h" #include "MMU.h" #include "ROMReader.h" #include "gfx3d.h"-#include "utils/decrypt/decrypt.h"-#include "utils/decrypt/crc.h"-#include "utils/advanscene.h"+#include "GPU.h" #include "cp15.h" #include "bios.h" #include "debug.h" #include "cheatSystem.h" #include "movie.h" #include "Disassembler.h"+#include "FIFO.h" #include "readwrite.h"+#include "registers.h" #include "debug.h"+#include "driver.h" #include "firmware.h" #include "version.h" #include "path.h" #include "slot1.h" #include "slot2.h"+#include "SPU.h"+#include "wifi.h" //int xxctr=0; //#define LOG_ARM9@@ -100,6 +110,16 @@ #endif } +int NDS_GetCPUCoreCount()+{+return getOnlineCores();+}++void NDS_SetupDefaultFirmware()+{+NDS_FillDefaultFirmwareConfigData(&CommonSettings.fw_config);+}+ void NDS_RunAdvansceneAutoImport() { if(CommonSettings.run_advanscene_import != "")@@ -545,6 +565,16 @@ } } +bool GameInfo::isDSiEnhanced()+{+return _isDSiEnhanced;+}++bool GameInfo::isHomebrew()+{+return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221));+}+ static int rom_init_path(const char *filename, const char *physicalName, const char *logicalFilename) { u32type = ROM_NDS;@@ -2828,7 +2858,14 @@ } } +void NDS_swapScreen()+{+u16 tmp = MainScreen.offset;+MainScreen.offset = SubScreen.offset;+SubScreen.offset = tmp;+} + void emu_halt() { //printf("halting emu: ARM9 PC=%08X/%08X, ARM7 PC=%08X/%08X\n", NDS_ARM9.R[15], NDS_ARM9.instruct_adr, NDS_ARM7.R[15], NDS_ARM7.instruct_adr); execute = false;Modified: trunk/desmume/src/NDSSystem.h===================================================================--- trunk/desmume/src/NDSSystem.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/NDSSystem.h2015-01-10 02:04:18 UTC (rev 5068)@@ -20,24 +20,14 @@ #define NDSSYSTEM_H #include <string.h>-#include "armcpu.h"-#include "MMU.h"-#include "driver.h"-#include "GPU.h"-#include "SPU.h"-#include "mem.h"-#include "wifi.h"-#include "emufile.h"-#include "firmware.h"+#include <string>+ #include "types.h"-#include "utils/task.h" -#include <string>+class BaseDriver;+class CFIRMWARE;+class EMUFILE; -#if defined(HOST_WINDOWS) && !defined(DESMUME_QT)-#include "pathsettings.h"-#endif- template<typename Type> struct buttonstruct { union {@@ -81,7 +71,8 @@ #define NDS_FW_LANG_CHI 6 #define NDS_FW_LANG_RES 7 -extern CFIRMWARE*firmware;+extern BaseDriver *driver;+extern CFIRMWARE *firmware; #define DSGBA_LOADER_SIZE 512 enum@@ -363,8 +354,8 @@ void closeROM(); u32 readROM(u32 pos); void populate();-bool isDSiEnhanced() { return _isDSiEnhanced; };-bool isHomebrew() { return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221)); }+bool isDSiEnhanced();+bool isHomebrew(); bool hasRomBanner(); };@@ -470,19 +461,15 @@ void NDS_debug_continue(); void NDS_debug_step(); -void execHardware_doAllDma(EDMAMode modeNum);+int NDS_GetCPUCoreCount();+void NDS_SetupDefaultFirmware(); +//void execHardware_doAllDma(EDMAMode modeNum);+ template<bool FORCE> void NDS_exec(s32 nb = 560190<<1); extern int lagframecounter; -static INLINE void NDS_swapScreen(void)-{- u16 tmp = MainScreen.offset;- MainScreen.offset = SubScreen.offset;- SubScreen.offset = tmp;-}- extern struct TCommonSettings { TCommonSettings() : GFX3D_HighResolutionInterpolateColor(true)@@ -507,7 +494,7 @@ , rigorous_timing(false) , advanced_timing(true) , micMode(InternalNoise)-, spuInterpolationMode(SPUInterpolation_Linear)+, spuInterpolationMode(1) , manualBackupType(0) , autodetectBackupMethod(0) , spu_captureMuted(false)@@ -522,7 +509,6 @@ strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM7BIOS, "biosnds7.bin"); strcpy(Firmware, "firmware.bin");-NDS_FillDefaultFirmwareConfigData(&fw_config); /* WIFI mode: adhoc = 0, infrastructure = 1 */ wifi.mode = 1;@@ -542,7 +528,8 @@ use_jit = false; #endif -num_cores = getOnlineCores();+num_cores = NDS_GetCPUCoreCount();+NDS_SetupDefaultFirmware(); } bool GFX3D_HighResolutionInterpolateColor; bool GFX3D_EdgeMark;@@ -601,7 +588,7 @@ } micMode; -SPUInterpolationMode spuInterpolationMode;+int spuInterpolationMode; //this is a temporary hack until we straighten out the flushing logic and/or gxfifo //int gfx3d_flushMode;Modified: trunk/desmume/src/OGLRender.cpp===================================================================--- trunk/desmume/src/OGLRender.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/OGLRender.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash-Copyright (C) 2008-2013 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -19,6 +19,7 @@ #include "OGLRender.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> Modified: trunk/desmume/src/SPU.cpp===================================================================--- trunk/desmume/src/SPU.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/SPU.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006 Theo Berkau-Copyright (C) 2008-2012 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team Ideas borrowed from Stephane Dallongeville's SCSP core @@ -32,6 +32,7 @@ #include <vector> #include "debug.h"+#include "driver.h" #include "MMU.h" #include "SPU.h" #include "mem.h"Modified: trunk/desmume/src/SPU.h===================================================================--- trunk/desmume/src/SPU.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/SPU.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright 2006 Theo Berkau-Copyright (C) 2006-2010 DeSmuME team+Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -22,11 +22,13 @@ #include <iosfwd> #include <string> #include <assert.h>+#include <stdio.h>+ #include "types.h" #include "matrix.h"-#include "emufile.h" #include "metaspu/metaspu.h" +class EMUFILE; #define SNDCORE_DEFAULT -1 #define SNDCORE_DUMMY 0Modified: trunk/desmume/src/addons/slot1_none.cpp===================================================================--- trunk/desmume/src/addons/slot1_none.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1_none.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2010-2013 DeSmuME team+Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -16,9 +16,6 @@ */ #include "../slot1.h"-#include "../registers.h"-#include "../MMU.h"-#include "../NDSSystem.h" class Slot1_None : public ISlot1Interface {Modified: trunk/desmume/src/addons/slot1_r4.cpp===================================================================--- trunk/desmume/src/addons/slot1_r4.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1_r4.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2010-2013 DeSmuME team+Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,14 +15,13 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include "slot1comp_protocol.h"+ #include <time.h> #include "../slot1.h"-#include "../registers.h"-#include "../MMU.h" #include "../NDSSystem.h" #include "../emufile.h"-#include "slot1comp_protocol.h" class Slot1_R4 : public ISlot1Interface, public ISlot1Comp_Protocol_Client {Modified: trunk/desmume/src/addons/slot1_retail_auto.cpp===================================================================--- trunk/desmume/src/addons/slot1_retail_auto.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1_retail_auto.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2105 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -16,8 +16,6 @@ */ #include "../slot1.h"-#include "../registers.h"-#include "../MMU.h" #include "../NDSSystem.h" class Slot1_Retail_Auto : public ISlot1InterfaceModified: trunk/desmume/src/addons/slot1_retail_mcrom.cpp===================================================================--- trunk/desmume/src/addons/slot1_retail_mcrom.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1_retail_mcrom.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2010-2013 DeSmuME team+Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,14 +15,13 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ -#include "../slot1.h"-#include "../registers.h"-#include "../MMU.h"-#include "../NDSSystem.h" #include "slot1comp_mc.h" #include "slot1comp_rom.h" #include "slot1comp_protocol.h" +#include "../slot1.h"+#include "../NDSSystem.h"+ //quick architecture overview: //MCROM receives GC bus commands from MMU.cpp //those are passed on to the protocol component for parsingModified: trunk/desmume/src/addons/slot1_retail_mcrom_debug.cpp===================================================================--- trunk/desmume/src/addons/slot1_retail_mcrom_debug.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1_retail_mcrom_debug.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,16 +15,18 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ -#include "../slot1.h"-#include "../registers.h"-#include "../MMU.h"-#include "../NDSSystem.h"-#include "../utils/fsnitro.h"-#include "../path.h" #include "slot1comp_mc.h" #include "slot1comp_rom.h" #include "slot1comp_protocol.h" +#include <stdio.h>+#include <string>++#include "../slot1.h"+#include "../path.h"+#include "../NDSSystem.h"+#include "../utils/fsnitro.h"+ //quick architecture overview: //MCROM receives GC bus commands from MMU.cpp //those are passed on to the protocol component for parsingModified: trunk/desmume/src/addons/slot1_retail_nand.cpp===================================================================--- trunk/desmume/src/addons/slot1_retail_nand.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1_retail_nand.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2010-2013 DeSmuME team+Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -21,13 +21,13 @@ //NTR-UORE-0 //- 128Mbit -#include "../slot1.h"-#include "../registers.h"-#include "../MMU.h"-#include "../NDSSystem.h" #include "slot1comp_rom.h" #include "slot1comp_protocol.h" +#include "../slot1.h"+#include "../NDSSystem.h"+#include "../emufile.h"+ //quick architecture overview: //NAND receives GC bus commands from MMU.cpp //those are passed on to the protocol component for parsingModified: trunk/desmume/src/addons/slot1comp_mc.cpp===================================================================--- trunk/desmume/src/addons/slot1comp_mc.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1comp_mc.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,11 +18,11 @@ //this file contains the components used for emulating standard gamecard "MC" devices (eeprom, fram, flash) //this is largely done by accessing the BackupDevice resources in the core emulator -#include "types.h"-#include "../MMU.h" #include "slot1comp_mc.h"-#include "NDSSystem.h" +#include "../MMU.h"+#include "../NDSSystem.h"+ Slot1Comp_MC g_Slot1Comp_MC; u8 Slot1Comp_MC::auxspi_transaction(int PROCNUM, u8 value)Modified: trunk/desmume/src/addons/slot1comp_mc.h===================================================================--- trunk/desmume/src/addons/slot1comp_mc.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1comp_mc.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -17,6 +17,11 @@ //this file contains the components used for emulating standard gamecard "MC" devices (eeprom, fram, flash) +#ifndef _SLOT1COMP_MC_H+#define _SLOT1COMP_MC_H++#include "../types.h"+ class Slot1Comp_MC { public:@@ -25,4 +30,6 @@ void connect(); }; -extern Slot1Comp_MC g_Slot1Comp_MC;\ No newline at end of file+extern Slot1Comp_MC g_Slot1Comp_MC;++#endifModified: trunk/desmume/src/addons/slot1comp_protocol.cpp===================================================================--- trunk/desmume/src/addons/slot1comp_protocol.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1comp_protocol.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2012-2013 DeSmuME team+Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -16,9 +16,12 @@ */ #include "slot1comp_protocol.h"-#include "MMU.h"-#include "armcpu.h"-#include "encrypt.h"++#include <string.h>++#include "../armcpu.h"+#include "../encrypt.h"+#include "../emufile.h" #include "../utils/decrypt/decrypt.h" static _KEY1 key1((const u8*)arm7_key);Modified: trunk/desmume/src/addons/slot1comp_protocol.h===================================================================--- trunk/desmume/src/addons/slot1comp_protocol.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1comp_protocol.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -23,8 +23,11 @@ #ifndef _SLOT1COMP_PROTOCOL_H #define _SLOT1COMP_PROTOCOL_H -#include "MMU.h"+#include "../types.h"+#include "../MMU.h" +class EMUFILE;+ enum eSlot1Operation { //----------Modified: trunk/desmume/src/addons/slot1comp_rom.cpp===================================================================--- trunk/desmume/src/addons/slot1comp_rom.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1comp_rom.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2010-2013 DeSmuME team+Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -16,10 +16,11 @@ */ #include "slot1comp_rom.h"-#include "MMU.h"-#include "NDSSystem.h" +#include "../NDSSystem.h"+#include "../emufile.h" + void Slot1Comp_Rom::start(eSlot1Operation operation, u32 addr) { this->operation = operation;Modified: trunk/desmume/src/addons/slot1comp_rom.h===================================================================--- trunk/desmume/src/addons/slot1comp_rom.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot1comp_rom.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2010-2013 DeSmuME team+Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,9 +18,14 @@ //this file contains the components used for emulating standard gamecard ROMs //this is largely done by accessing the rom provided in the core emulator +#ifndef _SLOT1COMP_ROM_H+#define _SLOT1COMP_ROM_H+ #include "slot1comp_protocol.h"-#include "emufile.h"+#include "../types.h" +class EMUFILE;+ class Slot1Comp_Rom { public:@@ -37,3 +42,4 @@ eSlot1Operation operation; }; +#endifModified: trunk/desmume/src/addons/slot2_auto.cpp===================================================================--- trunk/desmume/src/addons/slot2_auto.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot2_auto.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,11 +15,10 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include <stdio.h>+ #include "../slot2.h"-#include "../registers.h"-#include "../MMU.h" - class Slot2_Auto : public ISlot2Interface { private:Modified: trunk/desmume/src/addons/slot2_expMemory.cpp===================================================================--- trunk/desmume/src/addons/slot2_expMemory.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot2_expMemory.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2009 CrazyMax-Copyright (C) 2009-2013 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -17,6 +17,8 @@ */ #include "../slot2.h"+#include "../emufile.h"+#include "../mem.h" #if 0 #define EXPINFO(...) INFO(__VA_ARGS__)Modified: trunk/desmume/src/addons/slot2_gbagame.cpp===================================================================--- trunk/desmume/src/addons/slot2_gbagame.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot2_gbagame.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2009 CrazyMax-Copyright (C) 2009-2014 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -16,12 +16,13 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include "../slot2.h"+ #include <string.h>-#include "../mem.h"-#include "../MMU.h"++#include "../debug.h" #include "../NDSSystem.h" #include "../path.h"-#include "../slot2.h" #include "../emufile.h" #define EEPROM0x52504545Modified: trunk/desmume/src/addons/slot2_mpcf.cpp===================================================================--- trunk/desmume/src/addons/slot2_mpcf.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot2_mpcf.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006 Mic-Copyright (C) 2009-2013 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -22,11 +22,12 @@ #include <errno.h> #include <stdio.h> #include <stdlib.h>-#include "../types.h"++#include "../slot2.h" #include "../debug.h"+#include "../emufile.h" #include "../path.h" #include "../utils/vfat.h"-#include "../slot2.h" // Set up addresses for GBAMP #define CF_REG_DATA 0x9000000Modified: trunk/desmume/src/addons/slot2_paddle.cpp===================================================================--- trunk/desmume/src/addons/slot2_paddle.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot2_paddle.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2011-2013 DeSmuME team+Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -38,8 +38,9 @@ */ #include <string.h>++#include "../slot2.h" #include "../NDSSystem.h"-#include "../slot2.h" class Slot2_Paddle : public ISlot2Interface {Modified: trunk/desmume/src/addons/slot2_passme.cpp===================================================================--- trunk/desmume/src/addons/slot2_passme.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/addons/slot2_passme.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2013 DeSmuME team+Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,9 +15,8 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include "../slot2.h" #include "../NDSSystem.h"-#include "../types.h"-#include "../slot2.h" class Slot2_PassME : public ISlot2Interface {Modified: trunk/desmume/src/arm_instructions.cpp===================================================================--- trunk/desmume/src/arm_instructions.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/arm_instructions.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash-Copyright (C) 2008-2013 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -26,6 +26,7 @@ // of current ones) //#define UNTESTEDOPCODEDEBUG+#include "instructions.h" #include "cp15.h" #include "debug.h" #include "MMU.h"Modified: trunk/desmume/src/arm_jit.cpp===================================================================--- trunk/desmume/src/arm_jit.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/arm_jit.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /*Copyright (C) 2006 yopyop Copyright (C) 2011 Loren Merritt-Copyright (C) 2012-2013 DeSmuME team+Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -33,6 +33,7 @@ #define HAVE_STATIC_CODE_BUFFER #endif +#include "armcpu.h" #include "instructions.h" #include "instruction_attributes.h" #include "Disassembler.h"Modified: trunk/desmume/src/armcpu.cpp===================================================================--- trunk/desmume/src/armcpu.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/armcpu.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -20,7 +20,9 @@ #include <stdio.h> #include <assert.h> #include <algorithm>-#include "types.h"++#include "armcpu.h"+#include "common.h" #include "instructions.h" #include "cp15.h" #include "bios.h"@@ -745,6 +747,33 @@ template u32 armcpu_exec<1,true>(); #endif +void setIF(int PROCNUM, u32 flag)+{+//don't set generated bits!!!+assert(!(flag&0x00200000));++MMU.reg_IF_bits[PROCNUM] |= flag;++NDS_Reschedule();+}++char* decodeIntruction(bool thumb_mode, u32 instr)+{+char txt[20] = {0};+u32 tmp = 0;+if (thumb_mode == true)+{+tmp = (instr >> 6);+strcpy(txt, intToBin((u16)tmp)+6);+}+else+{+tmp = ((instr >> 16) & 0x0FF0) | ((instr >> 4) & 0x0F);+strcpy(txt, intToBin((u32)tmp)+20);+}+return strdup(txt);+}+ const armcpu_ctrl_iface arm_default_ctrl_iface = { stall_cpu, unstall_cpu,Modified: trunk/desmume/src/armcpu.h===================================================================--- trunk/desmume/src/armcpu.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/armcpu.h2015-01-10 02:04:18 UTC (rev 5068)@@ -22,9 +22,6 @@ #include "types.h" #include "bits.h" #include "MMU.h"-#include "common.h"-#include "instructions.h"-#include "cp15.h" #define CODE(i) (((i)>>25)&0x7) #define OPCODE(i) (((i)>>21)&0xF)@@ -223,7 +220,8 @@ /** * The control interface to a CPU */-typedef struct {+struct armcpu_ctrl_iface+{ /** stall the processor */ void (*stall)( void *instance); @@ -246,7 +244,7 @@ /** the private data passed to all interface functions */ void *data;-} armcpu_ctrl_iface;+}; typedef void* armcp_t;@@ -343,37 +341,12 @@ template<int PROCNUM, bool jit> u32 armcpu_exec(); #endif -static INLINE void setIF(int PROCNUM, u32 flag)-{-//don't set generated bits!!!-assert(!(flag&0x00200000));+void setIF(int PROCNUM, u32 flag);+char* decodeIntruction(bool thumb_mode, u32 instr); -MMU.reg_IF_bits[PROCNUM] |= flag;--extern void NDS_Reschedule();-NDS_Reschedule();-}- static INLINE void NDS_makeIrq(int PROCNUM, u32 num) { setIF(PROCNUM,1<<num); } -static INLINE char *decodeIntruction(bool thumb_mode, u32 instr)-{-char txt[20] = {0};-u32 tmp = 0;-if (thumb_mode == true)-{-tmp = (instr >> 6);-strcpy(txt, intToBin((u16)tmp)+6);-}-else-{-tmp = ((instr >> 16) & 0x0FF0) | ((instr >> 4) & 0x0F);-strcpy(txt, intToBin((u32)tmp)+20);-}-return strdup(txt);-}- #endifModified: trunk/desmume/src/bios.cpp===================================================================--- trunk/desmume/src/bios.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/bios.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop-Copyright (C) 2008-2013 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -20,10 +20,12 @@ //it renders the use of bios files generally unnecessary. //it turns out that they're not too complex, although of course the timings will be all wrong here. +#include "armcpu.h" #include "cp15.h" #include <math.h> #include "MMU.h" #include "debug.h"+#include "registers.h" #include "NDSSystem.h" #define cpu (&ARMPROC)Modified: trunk/desmume/src/bios.h===================================================================--- trunk/desmume/src/bios.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/bios.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop-Copyright (C) 2006-2012 DeSmuME team+Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -19,7 +19,7 @@ #ifndef BIOS_H #define BIOS_H -#include "armcpu.h"+#include "types.h" extern u32 (* ARM_swi_tab[2][32])(); extern const char* ARM_swi_names[2][32];Modified: trunk/desmume/src/cheatSystem.cpp===================================================================--- trunk/desmume/src/cheatSystem.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cheatSystem.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2009-2012 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,9 +15,11 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ -#include <string.h> #include "cheatSystem.h"+#include "bits.h"+ #include "NDSSystem.h"+#include "common.h" #include "mem.h" #include "MMU.h" #include "debug.h"Modified: trunk/desmume/src/cheatSystem.h===================================================================--- trunk/desmume/src/cheatSystem.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cheatSystem.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2009-2012 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,10 +15,12 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ +#include <stdio.h> #include <stdlib.h> #include <string.h>-#include "common.h"+#include <string> #include <vector>+#include "types.h" #define CHEAT_VERSION_MAJOR2 #define CHEAT_VERSION_MINOR0Modified: trunk/desmume/src/cli/main.cpp===================================================================--- trunk/desmume/src/cli/main.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cli/main.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -44,22 +44,26 @@ #define CLI_UI #endif -#include "MMU.h"-#include "NDSSystem.h"-#include "debug.h"-#include "sndsdl.h"-#include "ctrlssdl.h"-#include "render3D.h"-#include "rasterize.h"-#include "saves.h"-#include "firmware.h"-#include "GPU_osd.h"-#include "desmume_config.h"-#include "commandline.h"-#include "slot2.h"-#include "utils/xstring.h"-#include "gdbstub.h"+#include "../NDSSystem.h"+#include "../driver.h"+#include "../GPU.h"+#include "../SPU.h"+#include "../sndsdl.h"+#include "../ctrlssdl.h"+#include "../render3D.h"+#include "../rasterize.h"+#include "../saves.h"+#include "../GPU_osd.h"+#include "../desmume_config.h"+#include "../commandline.h"+#include "../slot2.h"+#include "../utils/xstring.h" +#ifdef GDB_STUB+#include "../armcpu.h"+#include "../gdbstub.h"+#endif+ volatile bool execute = false; static float nds_screen_size_ratio = 1.0f;@@ -589,7 +593,7 @@ g_thread_init( NULL); } - driver = new UnixDriver();+ driver = new BaseDriver(); #ifdef GDB_STUB /*Modified: trunk/desmume/src/cocoa/cocoa_cheat.h===================================================================--- trunk/desmume/src/cocoa/cocoa_cheat.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/cocoa_cheat.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel-Copyright (C) 2011-2014 DeSmuME team+Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -17,10 +17,13 @@ */ #import <Cocoa/Cocoa.h>-#include "../cheatSystem.h" #undef BOOL +class CHEATS;+class CHEATS_LIST;+class CHEATSEARCH; + /******************************************************************************************** CocoaDSCheatItem - OBJECTIVE-C CLASS Modified: trunk/desmume/src/cocoa/cocoa_cheat.mm===================================================================--- trunk/desmume/src/cocoa/cocoa_cheat.mm2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/cocoa_cheat.mm2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel-Copyright (C) 2012-2014 DeSmuME team+Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -20,6 +20,7 @@ #import "cocoa_globals.h" #import "cocoa_util.h" +#include "../cheatSystem.h" #include "../MMU.h" @implementation CocoaDSCheatItemModified: trunk/desmume/src/cocoa/cocoa_core.mm===================================================================--- trunk/desmume/src/cocoa/cocoa_core.mm2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/cocoa_core.mm2015-01-10 02:04:18 UTC (rev 5068)@@ -30,6 +30,7 @@ #include "../movie.h" #include "../NDSSystem.h"+#include "../armcpu.h" #include "../driver.h" #include "../gdbstub.h" #include "../slot1.h"Modified: trunk/desmume/src/cocoa/cocoa_firmware.mm===================================================================--- trunk/desmume/src/cocoa/cocoa_firmware.mm2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/cocoa_firmware.mm2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel-Copyright (C) 2012 DeSmuME team+Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,6 +18,7 @@ #import "cocoa_firmware.h" #include "../NDSSystem.h"+#include "../firmware.h" @implementation CocoaDSFirmwareModified: trunk/desmume/src/cocoa/cocoa_output.mm===================================================================--- trunk/desmume/src/cocoa/cocoa_output.mm2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/cocoa_output.mm2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel-Copyright (C) 2011-2014 DeSmuME team+Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -23,6 +23,7 @@ #include "sndOSX.h" #include "../NDSSystem.h"+#include "../GPU.h" #include "../SPU.h" #include "../metaspu/metaspu.h" Modified: trunk/desmume/src/cocoa/cocoa_rom.mm===================================================================--- trunk/desmume/src/cocoa/cocoa_rom.mm2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/cocoa_rom.mm2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel-Copyright (C) 2011-2013 DeSmuME team+Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -22,7 +22,7 @@ #import "cocoa_util.h" #include "../NDSSystem.h"-#include "../MMU.h"+#include "../common.h" #include "../mc.h" #undef BOOL Modified: trunk/desmume/src/cocoa/mic_ext.cpp===================================================================--- trunk/desmume/src/cocoa/mic_ext.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/mic_ext.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel-Copyright (C) 2012-2013 DeSmuME team+Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,7 +18,8 @@ #import "cocoa_globals.h" #include "mic_ext.h"-#include "readwrite.h"+#include "../emufile.h"+#include "../readwrite.h" RingBuffer micInputBuffer(MIC_MAX_BUFFER_SAMPLES * 2, sizeof(u8)); NullGenerator nullSampleGenerator;Modified: trunk/desmume/src/cocoa/openemu/NDSGameCore.mm===================================================================--- trunk/desmume/src/cocoa/openemu/NDSGameCore.mm2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cocoa/openemu/NDSGameCore.mm2015-01-10 02:04:18 UTC (rev 5068)@@ -27,6 +27,7 @@ #include <OpenGL/gl.h> #include "../../NDSSystem.h"+#include "../../GPU.h" #undef BOOL Modified: trunk/desmume/src/common.cpp===================================================================--- trunk/desmume/src/common.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/common.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2008-2010 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -17,10 +17,11 @@ //TODO - move this into ndssystem where it belongs probably +#include "common.h"+ #include <string.h> #include <string> #include <stdarg.h>-#include "common.h" #include <zlib.h> #include <stdlib.h> Modified: trunk/desmume/src/common.h===================================================================--- trunk/desmume/src/common.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/common.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2008-2010 DeSmuME team+Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -22,31 +22,13 @@ #include <stdio.h> #include <string.h>+#include <string> #include "types.h"-#include <string> #if defined(WIN32)--#include <winsock2.h>-#include <windows.h>- #define CLASSNAME "DeSmuME"--extern HINSTANCE hAppInst;--extern bool romloaded;--extern char IniName[MAX_PATH];-extern void GetINIPath();-extern void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file);--bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename);-void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file);- #else// non Windows--#define sscanf_s sscanf-+#define sscanf_s sscanf #endif template<typename T>Modified: trunk/desmume/src/cp15.cpp===================================================================--- trunk/desmume/src/cp15.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cp15.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop-Copyright (C) 2006-2013 DeSmuME team+Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -18,9 +18,12 @@ #include <stdlib.h> +#include "armcpu.h" #include "cp15.h" #include "debug.h" #include "MMU.h"+#include "emufile.h"+#include "readwrite.h" armcp15_t cp15; @@ -292,7 +295,7 @@ } return FALSE; case 9:-if((opcode1==0))+if(opcode1==0) { switch(CRm) {Modified: trunk/desmume/src/cp15.h===================================================================--- trunk/desmume/src/cp15.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/cp15.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop-Copyright (C) 2006-2013 DeSmuME team+Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -19,9 +19,11 @@ #ifndef __CP15_H__ #define __CP15_H__ -#include "armcpu.h"-#include "emufile.h"+#include <string.h>+#include "types.h" +class EMUFILE;+ #define CP15_ACCESS_WRITE 0 #define CP15_ACCESS_READ 2 #define CP15_ACCESS_EXECUTE 4Modified: trunk/desmume/src/debug.h===================================================================--- trunk/desmume/src/debug.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/debug.h2015-01-10 02:04:18 UTC (rev 5068)@@ -1,6 +1,6 @@ /* Copyright (C) 2006 Guillaume Duhamel-Copyright (C) 2006-2011 DeSmuME team+Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -26,8 +26,10 @@ #include "types.h" #include "mem.h"-#include "emufile.h" +struct armcpu_t;+class EMUFILE;+ struct DebugStatistics { DebugStatistics();@@ -168,7 +170,6 @@ }; extern DebugNotify DEBUG_Notify;-struct armcpu_t; //information about a debug event will be stuffed into here by the generator struct TDebugEventDataModified: trunk/desmume/src/driver.cpp===================================================================--- trunk/desmume/src/driver.cpp2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/driver.cpp2015-01-10 02:04:18 UTC (rev 5068)@@ -1,5 +1,5 @@ /*-Copyright (C) 2009-2010 DeSmuME team+Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,8 +15,9 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>. */ -#include "types.h" #include "driver.h"++#include "debug.h" #include "rasterize.h" #include "gfx3d.h" #include "texcache.h"@@ -44,3 +45,8 @@ { } +void BaseDriver::USR_InfoMessage(const char *message)+{+LOG("%s\n", message);+}+Modified: trunk/desmume/src/driver.h===================================================================--- trunk/desmume/src/driver.h2015-01-04 21:18:48 UTC (rev 5067)+++ trunk/desmume/src/driver.h2015-01-10 02:04:18 UTC (rev 5068)@@ -18,14 +18,9 @@ #ifndef _DRIVER_H_ #define _DRIVER_H_ +#include <stdio.h> #include "types.h"-#include "debug.h"-#include <stdio.h> -#ifdef EXPERIMENTAL_WIFI_COMM-#include <pcap.h>-#endif- class VIEW3D_Driver { public:@@ -40,28 +35,11 @@ BaseDriver(); ~BaseDriver(); -#ifdef EXPERIMENTAL_WIFI_COMM-virtual bool WIFI_SocketsAvailable() { return true; }-virtual bool WIFI_PCapAvailable() { return false; }--virtual void WIFI_GetUniqueMAC(u8* mac) {}--virtual bool WIFI_WFCWarning() { return false; }--virtual int PCAP_findalldevs(pcap_if_t** alldevs, char* errbuf) { return -1; }-virtual void PCAP_freealldevs(pcap_if_t* alldevs) {}-virtual pcap_t* PCAP_open(const char* source, int snaplen, int flags, int readtimeout, char* errbuf) { return NULL; }-virtual void PCAP_close(pcap_t* dev) {}-virtual int PCAP_setnonblock(pcap_t* dev, int nonblock, char* errbuf) { return -1; }-virtual int PCAP_sendpacket(pcap_t* dev, const u_char* data, int len) { return -1; }-virtual int PCAP_dispatch(pcap_t* dev, int num, pcap_handler callback, u_char* userdata) { return -1; }-#endif- virtual void AVI_SoundUpdate(void* soundData, int soundLen) {} virtual bool AVI_IsRecording() { return FALSE; } virtual bool WAV_IsRecording() { return FALSE; } -virtual void USR_InfoMessage(const char *message) { LOG("%s\n", message); }+virtual void USR_InfoMessage(const char *message); virtual void USR_RefreshScreen() {} virtual void USR_SetDisplayPostpone(int milliseconds, bool drawNextFrame) {} // -1 == indefinitely, 0 == don't pospone, 500 == don't draw for 0.5 seconds @@ -93,38 +71,5 @@ void VIEW3D_Shutdown(); void VIEW3D_Init(); };-extern BaseDriver* driver; -#ifndef HOST_WINDOWS-class UnixDriver : public BaseDriver-{-#ifdef EXPERIMENTAL_WIFI_COMM-virtual bool WIFI_SocketsAvailable() { return true; }-virtual b... [truncated message content]

[Desmume-cvs] SF.net SVN: desmume:[5167] trunk/desmume/src

From: <rog...@us...> - 2015-04-23 22:46:40

Revision: 5167 http://sourceforge.net/p/desmume/code/5167Author: rogermanDate: 2015-04-23 22:46:37 +0000 (Thu, 23 Apr 2015)Log Message:-----------OpenGL Renderer:- Fix some graphical bugs with fog and translucent fragments.Modified Paths:-------------- trunk/desmume/src/OGLRender.cpp trunk/desmume/src/OGLRender_3_2.cppModified: trunk/desmume/src/OGLRender.cpp===================================================================--- trunk/desmume/src/OGLRender.cpp2015-04-23 20:01:51 UTC (rev 5166)+++ trunk/desmume/src/OGLRender.cpp2015-04-23 22:46:37 UTC (rev 5167)@@ -322,8 +322,11 @@ float newFragDepth = (stateUseWDepth) ? vtxPosition.w/4096.0 : clamp((vtxPosition.z/vertW) * 0.5 + 0.5, 0.0, 1.0); \n\ \n\ gl_FragData[0] = newFragColor;\n\-gl_FragData[1] = vec4( packVec3FromFloat(newFragDepth), 1.0);\n\ gl_FragData[2] = vec4( float(polyEnableFog), float(stateEnableFogAlphaOnly), 0.0, 1.0);\n\+if (newFragColor.a >= 1.0 || polySetNewDepthForTranslucent)\n\+{\n\+gl_FragData[1] = vec4( packVec3FromFloat(newFragDepth), 1.0);\n\+}\n\ gl_FragDepth = newFragDepth;\n\ } \n\ "};@@ -2196,7 +2199,6 @@ if (this->isShaderSupported) { glUniform1i(OGLRef.uniformPolyMode, attr.polygonMode);-glUniform1i(OGLRef.uniformPolySetNewDepthForTranslucent, (attr.enableAlphaDepthWrite) ? GL_TRUE : GL_FALSE); glUniform1i(OGLRef.uniformPolyEnableFog, (attr.enableRenderFog) ? GL_TRUE : GL_FALSE); glUniform1f(OGLRef.uniformPolyAlpha, (!attr.isWireframe && attr.isTranslucent) ? divide5bitBy31_LUT[attr.alpha] : 1.0f); glUniform1i(OGLRef.uniformPolyID, attr.polygonID);@@ -2279,6 +2281,11 @@ glDepthMask(enableDepthWrite); +if (this->isShaderSupported)+{+glUniform1i(OGLRef.uniformPolySetNewDepthForTranslucent, ((enableDepthWrite == GL_TRUE) || attr.enableAlphaDepthWrite) ? GL_TRUE : GL_FALSE);+}+ return OGLERROR_NOERR; } @@ -3236,7 +3243,6 @@ // Set up polygon attributes glUniform1i(OGLRef.uniformPolyMode, attr.polygonMode);-glUniform1i(OGLRef.uniformPolySetNewDepthForTranslucent, (attr.enableAlphaDepthWrite) ? GL_TRUE : GL_FALSE); glUniform1i(OGLRef.uniformPolyEnableFog, (attr.enableRenderFog) ? GL_TRUE : GL_FALSE); glUniform1f(OGLRef.uniformPolyAlpha, (!attr.isWireframe && attr.isTranslucent) ? divide5bitBy31_LUT[attr.alpha] : 1.0f); glUniform1i(OGLRef.uniformPolyID, attr.polygonID);@@ -3311,6 +3317,7 @@ } glDepthMask(enableDepthWrite);+glUniform1i(OGLRef.uniformPolySetNewDepthForTranslucent, ((enableDepthWrite == GL_TRUE) || attr.enableAlphaDepthWrite) ? GL_TRUE : GL_FALSE); return OGLERROR_NOERR; }Modified: trunk/desmume/src/OGLRender_3_2.cpp===================================================================--- trunk/desmume/src/OGLRender_3_2.cpp2015-04-23 20:01:51 UTC (rev 5166)+++ trunk/desmume/src/OGLRender_3_2.cpp2015-04-23 22:46:37 UTC (rev 5167)@@ -169,8 +169,11 @@ float newFragDepth = (stateUseWDepth) ? vtxPosition.w/4096.0 : clamp((vtxPosition.z/vertW) * 0.5 + 0.5, 0.0, 1.0); \n\ \n\ outFragColor = newFragColor;\n\-outFragDepth = vec4( packVec3FromFloat(newFragDepth), 1.0);\n\ outFogAttributes = vec4( float(polyEnableFog), float(stateEnableFogAlphaOnly), 0.0, 1.0);\n\+if (newFragColor.a >= 1.0 || polySetNewDepthForTranslucent)\n\+{\n\+outFragDepth = vec4( packVec3FromFloat(newFragDepth), 1.0);\n\+}\n\ gl_FragDepth = newFragDepth;\n\ } \n\ "};This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[996] trunk/desmume/src

From: <mta...@us...> - 2008-09-23 16:22:20

Revision: 996 Author: mtabachenkoDate: 2008-09-23 16:22:10 +0000 (Tue, 23 Sep 2008)Log Message:------------ fixes projects for windows port;Modified Paths:-------------- trunk/desmume/src/GPU_osd.cpp trunk/desmume/src/windows/DeSmuME_2005.vcproj trunk/desmume/src/windows/DeSmuME_2008.vcproj trunk/desmume/src/windows/DeSmuME_Intel.icproj trunk/desmume/src/windows/main.cppModified: trunk/desmume/src/GPU_osd.cpp===================================================================--- trunk/desmume/src/GPU_osd.cpp2008-09-23 16:01:12 UTC (rev 995)+++ trunk/desmume/src/GPU_osd.cpp2008-09-23 16:22:10 UTC (rev 996)@@ -95,7 +95,7 @@ { int i, j; int ofs=c*OSD_FONT_HEIGHT;-unsigned charbits[9]={255, 128, 64, 32, 16, 8, 4, 2, 1};+unsigned charbits[9]={256, 128, 64, 32, 16, 8, 4, 2, 1}; u8*dst=screen; dst+=(y*256)+x; Modified: trunk/desmume/src/windows/DeSmuME_2005.vcproj===================================================================--- trunk/desmume/src/windows/DeSmuME_2005.vcproj2008-09-23 16:01:12 UTC (rev 995)+++ trunk/desmume/src/windows/DeSmuME_2005.vcproj2008-09-23 16:22:10 UTC (rev 996)@@ -106,12 +106,11 @@ /> </Configuration> <Configuration-Name="Release|Win32"+Name="Debug|x64" OutputDirectory="$(SolutionDir)\__bins" IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"-WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool"@@ -130,26 +129,24 @@ /> <Tool Name="VCMIDLTool"+TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool"-InlineFunctionExpansion="2"-EnableIntrinsicFunctions="true"-FavorSizeOrSpeed="1"-OmitFramePointers="true"-EnableFiberSafeOptimizations="true"-WholeProgramOptimization="true"+Optimization="0"+InlineFunctionExpansion="0"+EnableIntrinsicFunctions="false"+FavorSizeOrSpeed="0"+EnableFiberSafeOptimizations="false"+WholeProgramOptimization="false" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;Release\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"-StringPooling="true"-ExceptionHandling="1"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;0.8.0b2 x64 DEBUG\&quot;;WIN32;_x64;BETA_VERSION"+ExceptionHandling="0" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0"-FloatingPointModel="2"-WarningLevel="1" DebugInformationFormat="3"-CallingConvention="1"-CompileAs="0"+CallingConvention="0"+CompileAs="1" /> <Tool Name="VCManagedResourceCompilerTool"@@ -162,17 +159,19 @@ /> <Tool Name="VCLinkerTool"-AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"-OutputFile="$(OutDir)\$(ProjectName).exe"+AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib dxguid.lib shell32.lib comdlg32.lib dxerr.lib dsound.lib dinput8.lib ddraw.lib"+OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" GenerateDebugInformation="true"+GenerateMapFile="true"+TargetMachine="17" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool"-AdditionalManifestFiles="DeSmuME_x86.manifest"+AdditionalManifestFiles="DeSmuME_x64.manifest" /> <Tool Name="VCXDCMakeTool"@@ -194,7 +193,7 @@ /> </Configuration> <Configuration-Name="Release (SSE2)|Win32"+Name="Release|Win32" OutputDirectory="$(SolutionDir)\__bins" IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)" ConfigurationType="1"@@ -228,11 +227,11 @@ EnableFiberSafeOptimizations="true" WholeProgramOptimization="true" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;Release SSE2\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;Release\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" StringPooling="true" ExceptionHandling="1" BufferSecurityCheck="false"-EnableEnhancedInstructionSet="2"+EnableEnhancedInstructionSet="0" FloatingPointModel="2" WarningLevel="1" DebugInformationFormat="3"@@ -251,7 +250,7 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"-OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"+OutputFile="$(OutDir)\$(ProjectName).exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" GenerateDebugInformation="true" />@@ -282,7 +281,7 @@ /> </Configuration> <Configuration-Name="Debug|x64"+Name="Release|x64" OutputDirectory="$(SolutionDir)\__bins" IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)" ConfigurationType="1"@@ -309,17 +308,17 @@ /> <Tool Name="VCCLCompilerTool"-Optimization="0"-InlineFunctionExpansion="0"-EnableIntrinsicFunctions="false"-FavorSizeOrSpeed="0"-EnableFiberSafeOptimizations="false"-WholeProgramOptimization="false"+InlineFunctionExpansion="2"+EnableIntrinsicFunctions="true"+FavorSizeOrSpeed="1"+EnableFiberSafeOptimizations="true"+WholeProgramOptimization="true" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;0.8.0b2 x64 DEBUG\&quot;;WIN32;_x64;BETA_VERSION"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;0.8.0b2 x64\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION" ExceptionHandling="0" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0"+WarningLevel="1" DebugInformationFormat="3" CallingConvention="0" CompileAs="1"@@ -335,11 +334,10 @@ /> <Tool Name="VCLinkerTool"-AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib dxguid.lib shell32.lib comdlg32.lib dxerr.lib dsound.lib dinput8.lib ddraw.lib"-OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"+AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib dxguid.lib shell32.lib comdlg32.lib dxerr.lib dsound.lib dinput8.lib ddraw.lib zlib-2005-x64.lib zziplib-2005-x64.lib"+OutputFile="$(OutDir)\$(ProjectName)_x64.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" GenerateDebugInformation="true"-GenerateMapFile="true" TargetMachine="17" /> <Tool@@ -369,11 +367,12 @@ /> </Configuration> <Configuration-Name="Release|x64"+Name="Release (SSE2)|Win32" OutputDirectory="$(SolutionDir)\__bins" IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool"@@ -392,24 +391,26 @@ /> <Tool Name="VCMIDLTool"-TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1"+OmitFramePointers="true" EnableFiberSafeOptimizations="true" WholeProgramOptimization="true" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;0.8.0b2 x64\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION"-ExceptionHandling="0"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;Release SSE2\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"+StringPooling="true"+ExceptionHandling="1" BufferSecurityCheck="false"-EnableEnhancedInstructionSet="0"+EnableEnhancedInstructionSet="2"+FloatingPointModel="2" WarningLevel="1" DebugInformationFormat="3"-CallingConvention="0"-CompileAs="1"+CallingConvention="1"+CompileAs="0" /> <Tool Name="VCManagedResourceCompilerTool"@@ -422,18 +423,17 @@ /> <Tool Name="VCLinkerTool"-AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib dxguid.lib shell32.lib comdlg32.lib dxerr.lib dsound.lib dinput8.lib ddraw.lib zlib-2005-x64.lib zziplib-2005-x64.lib"-OutputFile="$(OutDir)\$(ProjectName)_x64.exe"+AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"+OutputFile="$(OutDir)\$(ProjectName)_sse2.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" GenerateDebugInformation="true"-TargetMachine="17" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool"-AdditionalManifestFiles="DeSmuME_x64.manifest"+AdditionalManifestFiles="DeSmuME_x86.manifest" /> <Tool Name="VCXDCMakeTool"@@ -781,6 +781,14 @@ > </File> <File+RelativePath="..\common.cpp"+>+</File>+<File+RelativePath="..\common.h"+>+</File>+<File RelativePath="..\config.h" > </File>@@ -884,18 +892,15 @@ /> </FileConfiguration> <FileConfiguration-Name="Release|Win32"+Name="Debug|x64" ExcludedFromBuild="true" > <Tool-Name="VCCustomBuildTool"-Description="Assembling..."-CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"-Outputs="$(IntDir)\$(InputName).obj"+Name="MASM" /> </FileConfiguration> <FileConfiguration-Name="Release (SSE2)|Win32"+Name="Release|Win32" ExcludedFromBuild="true" > <Tool@@ -906,15 +911,18 @@ /> </FileConfiguration> <FileConfiguration-Name="Debug|x64"+Name="Release|x64" ExcludedFromBuild="true" > <Tool-Name="MASM"+Name="VCCustomBuildTool"+Description="Assembling..."+CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"+Outputs="$(IntDir)\$(InputName).obj" /> </FileConfiguration> <FileConfiguration-Name="Release|x64"+Name="Release (SSE2)|Win32" ExcludedFromBuild="true" > <Tool@@ -947,7 +955,7 @@ /> </FileConfiguration> <FileConfiguration-Name="Release|Win32"+Name="Debug|x64" ExcludedFromBuild="true" > <Tool@@ -955,7 +963,7 @@ /> </FileConfiguration> <FileConfiguration-Name="Debug|x64"+Name="Release|Win32" ExcludedFromBuild="true" > <ToolModified: trunk/desmume/src/windows/DeSmuME_2008.vcproj===================================================================--- trunk/desmume/src/windows/DeSmuME_2008.vcproj2008-09-23 16:01:12 UTC (rev 995)+++ trunk/desmume/src/windows/DeSmuME_2008.vcproj2008-09-23 16:22:10 UTC (rev 996)@@ -55,7 +55,7 @@ EnableFiberSafeOptimizations="false" WholeProgramOptimization="false" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0"@@ -140,7 +140,7 @@ EnableFiberSafeOptimizations="false" WholeProgramOptimization="false" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 DEBUG\&quot;;WIN32;_x64;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 DEBUG\&quot;;WIN32;_x64;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0"@@ -315,7 +315,7 @@ EnableFiberSafeOptimizations="true" WholeProgramOptimization="true" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0"@@ -403,7 +403,7 @@ EnableFiberSafeOptimizations="true" WholeProgramOptimization="true" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;0.8.0b2\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;0.8.0b2\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" StringPooling="true" ExceptionHandling="1" BufferSecurityCheck="false"@@ -426,7 +426,7 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"-OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"+OutputFile="$(OutDir)\$(ProjectName).exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" GenerateDebugInformation="true" RandomizedBaseAddress="1"@@ -491,7 +491,7 @@ EnableFiberSafeOptimizations="true" WholeProgramOptimization="true" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0"@@ -512,7 +512,7 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x64.lib zziplib-2008-x64.lib"-OutputFile="$(OutDir)\$(ProjectName)_x64_sse2.exe"+OutputFile="$(OutDir)\$(ProjectName)_x64.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" GenerateDebugInformation="true" RandomizedBaseAddress="1"Modified: trunk/desmume/src/windows/DeSmuME_Intel.icproj===================================================================--- trunk/desmume/src/windows/DeSmuME_Intel.icproj2008-09-23 16:01:12 UTC (rev 995)+++ trunk/desmume/src/windows/DeSmuME_Intel.icproj2008-09-23 16:22:10 UTC (rev 996)@@ -31,7 +31,7 @@ FavorSizeOrSpeed="0" EnableFiberSafeOptimizations="0" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG (Intel)\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG (Intel)\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="0" EnableEnhancedInstructionSet="0"@@ -40,7 +40,7 @@ CompileAs="0"/> <Tool Name="LinkerTool"-OutputFile="$(OutDir)\$(ProjectName)_Intel_debug.exe"+OutputFile="$(OutDir)\$(ProjectName)_debug.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib" GenerateDebugInformation="1"@@ -86,7 +86,7 @@ FavorSizeOrSpeed="0" EnableFiberSafeOptimizations="0" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 DEBUG (Intel)\&quot;;WIN32;_x64;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 DEBUG (Intel)\&quot;;WIN32;_x64;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="0" EnableEnhancedInstructionSet="0"@@ -159,7 +159,7 @@ Parallelization="1"/> <Tool Name="LinkerTool"-OutputFile="$(OutDir)\$(ProjectName)_Intel_sse2.exe"+OutputFile="$(OutDir)\$(ProjectName)_sse2.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib" GenerateDebugInformation="1"@@ -206,7 +206,7 @@ FavorSizeOrSpeed="1" EnableFiberSafeOptimizations="1" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2 (Intel)\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2 (Intel)\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="0" EnableEnhancedInstructionSet="0"@@ -281,7 +281,7 @@ Parallelization="1"/> <Tool Name="LinkerTool"-OutputFile="$(OutDir)\$(ProjectName)_Intel.exe"+OutputFile="$(OutDir)\$(ProjectName).exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib" GenerateDebugInformation="1"@@ -328,7 +328,7 @@ FavorSizeOrSpeed="1" EnableFiberSafeOptimizations="1" AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"-PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2 (Intel)\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2 (Intel)\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX" ExceptionHandling="1" BufferSecurityCheck="0" EnableEnhancedInstructionSet="0"@@ -338,7 +338,7 @@ CompileAs="0"/> <Tool Name="LinkerTool"-OutputFile="$(OutDir)\$(ProjectName)_x64_sse2.exe"+OutputFile="$(OutDir)\$(ProjectName)_x64.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib" AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x64.lib zziplib-2008-x64.lib" GenerateDebugInformation="1"Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2008-09-23 16:01:12 UTC (rev 995)+++ trunk/desmume/src/windows/main.cpp2008-09-23 16:22:10 UTC (rev 996)@@ -1904,6 +1904,7 @@ FpsDisplay ^= 1; MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, FpsDisplay ? MF_CHECKED : MF_UNCHECKED); WritePrivateProfileInt("Video", "Display Fps", FpsDisplay, IniName);+ osd->clear(); return 0; #define saver(one,two,three,four,five, six) \This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[998] trunk/desmume/src

From: <mta...@us...> - 2008-09-24 17:50:13

Revision: 998 Author: mtabachenkoDate: 2008-09-24 17:50:02 +0000 (Wed, 24 Sep 2008)Log Message:-----------typo fixModified Paths:-------------- trunk/desmume/src/GPU.cpp trunk/desmume/src/MMU.cppModified: trunk/desmume/src/GPU.cpp===================================================================--- trunk/desmume/src/GPU.cpp2008-09-24 16:16:11 UTC (rev 997)+++ trunk/desmume/src/GPU.cpp2008-09-24 17:50:02 UTC (rev 998)@@ -2072,7 +2072,7 @@ // Read from FIFO MAIN_MEMORY_DISP_FIFO, two pixels at once format is x555, bit15 unused // Reference: http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode // (under DISP_MMEM_FIFO)-#ifdef 0+#if 0 for (i=0; i<256;) { c = FIFOValue(MMU.fifos + MAIN_MEMORY_DISP_FIFO); T2WriteWord(dst, i << 1, c&0xFFFF); i++;Modified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2008-09-24 16:16:11 UTC (rev 997)+++ trunk/desmume/src/MMU.cpp2008-09-24 17:50:02 UTC (rev 998)@@ -801,7 +801,6 @@ NDS_makeInt(proc^1,17) ; /* remote: SEND FIFO EMPTY */ return val;-#endif } return 0; case REG_TM0CNTL :This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[997] trunk/desmume/src

From: <mta...@us...> - 2008-09-24 18:33:49

Revision: 997 Author: mtabachenkoDate: 2008-09-24 16:16:11 +0000 (Wed, 24 Sep 2008)Log Message:-----------core:- fix FIFO;Modified Paths:-------------- trunk/desmume/src/FIFO.cpp trunk/desmume/src/FIFO.h trunk/desmume/src/GPU.cpp trunk/desmume/src/MMU.cpp trunk/desmume/src/MMU.h trunk/desmume/src/NDSSystem.cppModified: trunk/desmume/src/FIFO.cpp===================================================================--- trunk/desmume/src/FIFO.cpp2008-09-23 16:22:10 UTC (rev 996)+++ trunk/desmume/src/FIFO.cpp2008-09-24 16:16:11 UTC (rev 997)@@ -23,37 +23,44 @@ #include "FIFO.h" #include <string.h>+#include "debug.h" -void FIFOInit(FIFO * fifo)+void FIFOclear(FIFO * fifo) { memset(fifo,0,sizeof(FIFO));-fifo->empty = TRUE;+fifo->empty = true; } -void FIFOAdd(FIFO * fifo, u32 v)+void FIFOadd(FIFO *fifo, u32 val) {-if(fifo->full) - {- fifo->error = TRUE;- return;- }- fifo->data[fifo->end] = v;- fifo->end = (fifo->end + 1)& 0x7FFF;- fifo->full = (fifo->end == fifo->begin);- fifo->empty = FALSE;+if (fifo->full)+{+//printlog("!!!!! FIFOadd full\n");+fifo->error = true;+return;+}++fifo->buf[fifo->sendPos] = val;+fifo->sendPos = (fifo->sendPos+1) & 0x7FFF;+fifo->half = (fifo->sendPos < (sizeof(fifo->buf)>>1));+fifo->full = (fifo->sendPos == fifo->recvPos);+fifo->empty = false;+//printlog("-------------- FIFO add size=%i, val=%X\n",fifo->sendPos, val); }- -u32 FIFOValue(FIFO * fifo)++u32 FIFOget(FIFO * fifo) {- u32 v;+if (fifo->empty)+{+//printlog("!!!!! FIFOget empty\n");+fifo->error = true;+return 0;+} -if(fifo->empty)- {- fifo->error = TRUE;- return 0;- }- v = fifo->data[fifo->begin];- fifo->begin = (fifo->begin + 1)& 0x7FFF;- fifo->empty = (fifo->begin == fifo->end);- return v;+u32 val;+val = fifo->buf[fifo->recvPos];+fifo->recvPos = (fifo->recvPos+1) & 0x7FFF;+fifo->empty = (fifo->recvPos == fifo->sendPos);+//printlog("-------------- FIFO get size=%i, val=%X\n",fifo->recvPos, val);+return val; }Modified: trunk/desmume/src/FIFO.h===================================================================--- trunk/desmume/src/FIFO.h2008-09-23 16:22:10 UTC (rev 996)+++ trunk/desmume/src/FIFO.h2008-09-24 16:16:11 UTC (rev 997)@@ -28,28 +28,22 @@ typedef struct {- u32 data[0x8000];- u32 begin;- u32 end;- BOOL full;- BOOL empty;- BOOL error;-} FIFO;+boolerror;+boolenable; -void FIFOInit(FIFO * fifo);-void FIFOAdd(FIFO * fifo, u32 v);-u32 FIFOValue(FIFO * fifo);+boolempty;+boolhalf;+boolfull;+u8irq; -//================== 3D GFX FIFO-typedef struct{-u32 hits[640];-u32 hits_count;-u32 empty;-u32half;-u32full;-u32 begin;-u32 end;-u32 irq;-} GFXFIFO;+u8sendPos;+u8recvPos; +u32buf[0x8000];+} FIFO;++extern void FIFOclear(FIFO * fifo);+extern void FIFOadd(FIFO * fifo, u32 val);+extern u32 FIFOget(FIFO * fifo);+ #endifModified: trunk/desmume/src/GPU.cpp===================================================================--- trunk/desmume/src/GPU.cpp2008-09-23 16:22:10 UTC (rev 996)+++ trunk/desmume/src/GPU.cpp2008-09-24 16:16:11 UTC (rev 997)@@ -2072,11 +2072,15 @@ // Read from FIFO MAIN_MEMORY_DISP_FIFO, two pixels at once format is x555, bit15 unused // Reference: http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode // (under DISP_MMEM_FIFO)+#ifdef 0 for (i=0; i<256;) { c = FIFOValue(MMU.fifos + MAIN_MEMORY_DISP_FIFO); T2WriteWord(dst, i << 1, c&0xFFFF); i++; T2WriteWord(dst, i << 1, c>>16); i++; }+else+printlog("FIFO MAIN_MEMORY_DISP_FIFO\n");+#endif return; } Modified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2008-09-23 16:22:10 UTC (rev 996)+++ trunk/desmume/src/MMU.cpp2008-09-24 16:16:11 UTC (rev 997)@@ -201,10 +201,8 @@ MMU.MMU_WAIT32[0] = MMU_ARM9_WAIT32; MMU.MMU_WAIT32[1] = MMU_ARM7_WAIT32; -for(i = 0;i < 16;i++)-FIFOInit(MMU.fifos + i);-memset(&MMU.gfxfifo, 0, sizeof(GFXFIFO));-MMU.gfxfifo.empty=MMU.gfxfifo.half=TRUE;+FIFOclear(MMU.fifos);+FIFOclear(MMU.fifos+1); mc_init(&MMU.fw, MC_TYPE_FLASH); /* init fw device */ mc_alloc(&MMU.fw, NDS_FW_SIZE_V1);@@ -260,10 +258,8 @@ memset(MMU.ARM7_ERAM, 0, 0x010000); memset(MMU.ARM7_REG, 0, 0x010000); -for(i = 0;i < 16;i++)-FIFOInit(MMU.fifos + i);-memset(&MMU.gfxfifo, 0, sizeof(GFXFIFO));-MMU.gfxfifo.empty=MMU.gfxfifo.half=TRUE;+FIFOclear(MMU.fifos);+FIFOclear(MMU.fifos+1); MMU.DTCMRegion = 0x027C0000; MMU.ITCMRegion = 0x00000000;@@ -660,6 +656,7 @@ return (gfx3d_GetNumVertex()&8191); case REG_IPCFIFORECV : /* TODO (clear): ??? */+printlog("read16: IPCFIFORECV\n"); //printlog("Stopped IPCFIFORECV\n"); execute = FALSE; return 1;@@ -673,8 +670,10 @@ return (u16)(MMU.reg_IE[proc]>>16); case REG_IF :+//printlog("read16 (low): REG_IF\n"); return (u16)MMU.reg_IF[proc]; case REG_IF + 2 :+//printlog("read16 (high): REG_IF\n"); return (u16)(MMU.reg_IF[proc]>>16); case REG_TM0CNTL :@@ -726,13 +725,14 @@ switch(adr) { // This is hacked due to the only current 3D core-case 0x04000600:+case 0x04000600:// Geometry Engine Status Register (R and R/W) {-u32 gxstat =(2|(MMU.gfxfifo.hits_count<<16)|-(MMU.gfxfifo.full<<24)|-(MMU.gfxfifo.empty<<25)|-(MMU.gfxfifo.half<<26)|-(MMU.gfxfifo.irq<<30));+u32 gxstat =( 2 |+(MMU.fifos[proc].full<<24)|+(MMU.fifos[proc].half<<25)|+(MMU.fifos[proc].empty<<26)|+(MMU.fifos[proc].irq<<30)+); returngxstat; } @@ -781,25 +781,27 @@ case REG_IE : return MMU.reg_IE[proc]; case REG_IF :+//printlog("read32: REG_IF\n"); return MMU.reg_IF[proc]; case REG_IPCFIFORECV : {-u16 IPCFIFO_CNT = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);-if(IPCFIFO_CNT&0x8000)-{-//execute = FALSE;-u32 fifonum = IPCFIFO+proc;-u32 val = FIFOValue(MMU.fifos + fifonum);-u32 remote = (proc+1) & 1;-u16 IPCFIFO_CNT_remote = T1ReadWord(MMU.MMU_MEM[remote][0x40], 0x184);-IPCFIFO_CNT |= (MMU.fifos[fifonum].empty<<8) | (MMU.fifos[fifonum].full<<9) | (MMU.fifos[fifonum].error<<14);-IPCFIFO_CNT_remote |= (MMU.fifos[fifonum].empty) | (MMU.fifos[fifonum].full<<1);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, IPCFIFO_CNT);-T1WriteWord(MMU.MMU_MEM[remote][0x40], 0x184, IPCFIFO_CNT_remote);-if ((MMU.fifos[fifonum].empty) && (IPCFIFO_CNT & BIT(2)))-NDS_makeInt(remote,17) ; /* remote: SEND FIFO EMPTY */+u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);+//printlog("read32: REG_IPCFIFORECV (%X)\n", cnt_l);+if (!(cnt_l & 0x8000)) return 0;// FIFO disabled+u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);+u32 val = FIFOget(MMU.fifos + proc);++cnt_l |= (MMU.fifos[proc].empty<<8) | (MMU.fifos[proc].full<<9) | (MMU.fifos[proc].error<<14);+cnt_r |= (MMU.fifos[proc].empty) | (MMU.fifos[proc].full<<1);++T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);+T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, cnt_r);++if ((MMU.fifos[proc].empty) && (cnt_l & BIT(2)))+NDS_makeInt(proc^1,17) ; /* remote: SEND FIFO EMPTY */+ return val;-}+#endif } return 0; case REG_TM0CNTL :@@ -1684,15 +1686,18 @@ case REG_IF : //execute = FALSE;+//printlog("write16 (low): REG_IF (%X)\n", val); MMU.reg_IF[proc] &= (~((u32)val)); return; case REG_IF + 2 :+//printlog("write16 (high): REG_IF (%X)\n", val); //execute = FALSE; MMU.reg_IF[proc] &= (~(((u32)val)<<16)); return; - case REG_IPCSYNC :+ case REG_IPCSYNC : {+//printlog("IPCSYNC\n"); u32 remote = (proc+1)&1; u16 IPCSYNC_remote = T1ReadWord(MMU.MMU_MEM[remote][0x40], 0x180); T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x180, (val&0xFFF0)|((IPCSYNC_remote>>8)&0xF));@@ -1701,29 +1706,35 @@ //execute = FALSE; } return;- case REG_IPCFIFOCNT :++case REG_IPCFIFOCNT : { u32 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184) ;-u32 cnt_r = T1ReadWord(MMU.MMU_MEM[(proc+1) & 1][0x40], 0x184) ;+u32 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184) ;++//printlog("write16 (%s): REG_IPCFIFOCNT 0x(%08X)\n", proc?"ARM9":"ARM7",REG_IPCFIFOCNT);+//printlog(" --- val=%X\n",val);+ if ((val & 0x8000) && !(cnt_l & 0x8000)) { /* this is the first init, the other side didnt init yet */ /* so do a complete init */-FIFOInit(MMU.fifos + (IPCFIFO+proc));+FIFOclear(MMU.fifos + proc); T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184,0x8101) ; /* and then handle it as usual */ } -if(val & 0x4008)-{-FIFOInit(MMU.fifos + (IPCFIFO+((proc+1)&1)));-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);-T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0xC507) | 0x100);-MMU.reg_IF[proc] |= ((val & 4)<<15);// & (MMU.reg_IME[proc]<<17);// & (MMU.reg_IE[proc]&0x20000);//-return;+if (val & 0x4008)// clear FIFO+{+FIFOclear(&MMU.fifos[proc]);+T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);+T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0xC507) | 0x100);+MMU.reg_IF[proc] |= ((val & 4)<<15);+//T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val);+return;+}+T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l | (val & 0xBFF4)); }-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184) | (val & 0xBFF4));-} return; case REG_TM0CNTL : case REG_TM1CNTL :@@ -2364,9 +2375,12 @@ return; } -case 0x04000600:+case 0x04000600:// Geometry Engine Status Register (R and R/W) {-MMU.gfxfifo.irq=(val>>30)&3;+//printlog("write32: Geometry Engine Status Register (R and R/W)");+//printlog("------- val=%X\n\n************\n\n", val);++MMU.fifos[proc].irq = (val>>30) & 0x03; return; } case REG_DISPA_WININ: @@ -2509,6 +2523,7 @@ return; case REG_IF :+//printlog("write32: REG_IF (%X)\n", val); MMU.reg_IF[proc] &= (~val); return; @@ -2711,8 +2726,9 @@ MMU.reg_IF[remote] |= ((IPCSYNC_remote & (1<<14))<<2) & ((val & (1<<13))<<3);// & (MMU.reg_IME[remote] << 16);// & (MMU.reg_IE[remote] & (1<<16));// } return;- case REG_IPCFIFOCNT :+case REG_IPCFIFOCNT : {+#ifdef 0 u32 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184) ; u32 cnt_r = T1ReadWord(MMU.MMU_MEM[(proc+1) & 1][0x40], 0x184) ; if ((val & 0x8000) && !(cnt_l & 0x8000))@@ -2732,27 +2748,25 @@ return; } T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val & 0xBFF4);+#else+printlog("write32: REG_IPCFIFOCNT\n");+#endif //execute = FALSE; return; }- case REG_IPCFIFOSEND :+case REG_IPCFIFOSEND : {-u16 IPCFIFO_CNT = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);-if(IPCFIFO_CNT&0x8000)-{-//if(val==43) execute = FALSE;-u32 remote = (proc+1)&1;-u32 fifonum = IPCFIFO+remote;- u16 IPCFIFO_CNT_remote;-FIFOAdd(MMU.fifos + fifonum, val);-IPCFIFO_CNT = (IPCFIFO_CNT & 0xFFFC) | (MMU.fifos[fifonum].full<<1);- IPCFIFO_CNT_remote = T1ReadWord(MMU.MMU_MEM[remote][0x40], 0x184);-IPCFIFO_CNT_remote = (IPCFIFO_CNT_remote & 0xFCFF) | (MMU.fifos[fifonum].full<<10);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, IPCFIFO_CNT);-T1WriteWord(MMU.MMU_MEM[remote][0x40], 0x184, IPCFIFO_CNT_remote);-MMU.reg_IF[remote] |= ((IPCFIFO_CNT_remote & (1<<10))<<8);// & (MMU.reg_IME[remote] << 18);// & (MMU.reg_IE[remote] & 0x40000);//-//execute = FALSE;-}+u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);+if (!(cnt_l & 0x8000)) return;//FIFO disabled+u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);+//printlog("write32 (%s): REG_IPCFIFOSEND (%X-%X) val=%X\n", proc?"ARM9":"ARM7",cnt_l,cnt_r,val);+//FIFOadd(MMU.fifos+(proc^1), val);+FIFOadd(MMU.fifos+(proc^1), val);+cnt_l = (cnt_l & 0xFFFC) | (MMU.fifos[proc^1].full<<1);+cnt_r = (cnt_r & 0xFCFF) | (MMU.fifos[proc^1].full<<9);+T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);+T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, cnt_r);+MMU.reg_IF[proc^1] |= ((cnt_r & (1<<10))<<8); } return; case REG_DMA0CNTL :@@ -2929,8 +2943,21 @@ { // NOTE: right now, the capture unit is not taken into account, // I don't know is it should be handled here or -+#ifdef 0 FIFOAdd(MMU.fifos + MAIN_MEMORY_DISP_FIFO, val);+#else+//4000068h - NDS9 - DISP_MMEM_FIFO - 32bit - Main Memory Display FIFO (R?/W)+//Intended to send 256x192 pixel 32K color bitmaps by DMA directly+ //- to Screen A (set DISPCNT to Main Memory Display mode), or+ //- to Display Capture unit (set DISPCAPCNT to Main Memory Source).++//The FIFO can receive 4 words (8 pixels) at a time, each pixel is a 15bit RGB value (the upper bit, bit15, is unused).+//Set DMA to Main Memory mode, 32bit transfer width, word count set to 4, destination address to DISP_MMEM_FIFO, source address must be in Main Memory.+//Transfer starts at next frame.+//Main Memory Display/Capture is supported for Display Engine A only.++printlog("write32: REG_DISPA_DISPMMEMFIFO\n");+#endif break; } //case 0x21FDFF0 : if(val==0) execute = FALSE;Modified: trunk/desmume/src/MMU.h===================================================================--- trunk/desmume/src/MMU.h2008-09-23 16:22:10 UTC (rev 996)+++ trunk/desmume/src/MMU.h2008-09-24 16:16:11 UTC (rev 997)@@ -39,8 +39,8 @@ /* theses ones for reading in rom data */ #define ROM_8(m, a) (((u8*)(m))[(a)]) -#define IPCFIFO 0-#define MAIN_MEMORY_DISP_FIFO 2+//#define IPCFIFO 0+//#define MAIN_MEMORY_DISP_FIFO 2 typedef struct { //ARM7 mem@@ -66,10 +66,10 @@ u32 * MMU_MASK[2]; u8 ARM9_RW_MODE;- - FIFOfifos[16];-GFXFIFOgfxfifo; +FIFOfifos[2];// 0 - ARM9 FIFO+// 1 - ARM7 FIFO+ u32 * MMU_WAIT16[2]; u32 * MMU_WAIT32[2]; Modified: trunk/desmume/src/NDSSystem.cpp===================================================================--- trunk/desmume/src/NDSSystem.cpp2008-09-23 16:22:10 UTC (rev 996)+++ trunk/desmume/src/NDSSystem.cpp2008-09-24 16:16:11 UTC (rev 997)@@ -1526,12 +1526,22 @@ } } -if(MMU.reg_IE[0]&(1<<21))+/*for (int tt=0; tt<24; tt++) {-if(MMU.gfxfifo.irq==0) return nds.cycles;-if(MMU.gfxfifo.irq==3) return nds.cycles;-if(MMU.gfxfifo.irq==1 && MMU.gfxfifo.half) NDS_makeARM9Int(21);-if(MMU.gfxfifo.irq==2 && MMU.gfxfifo.empty) NDS_makeARM9Int(21);+if (tt == 0) continue;//VBlank+if (tt == 1) continue;//HBlank+if (tt == 3) continue;+if (tt == 12) continue;+if (tt == 18) continue;+if (MMU.reg_IE[0]&(1<<tt)) printlog("wait IRQ%i\n", tt);+}*/++//if(MMU.reg_IE[0]&(1<<0)) gfx3d_VBlankSignal();++if(MMU.reg_IE[0]&(1<<21))// IRQ21+{+if (MMU.fifos[0].irq==1) NDS_makeARM9Int(21);+if (MMU.fifos[0].irq==2) NDS_makeARM9Int(21); } if((MMU.reg_IF[0]&MMU.reg_IE[0]) && (MMU.reg_IME[0]))This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1000] trunk/desmume/src

From: <sha...@us...> - 2008-09-24 22:25:44

Revision: 1000 Author: shashClpDate: 2008-09-24 22:25:24 +0000 (Wed, 24 Sep 2008)Log Message:------------ Fixed a type- Removed the logo so desmume doesn't infringe copyrights. Don't read it, sodesmume isn't shutdown due to copyright infringement.Modified Paths:-------------- trunk/desmume/src/MMU.cpp trunk/desmume/src/windows/DeSmuME_2008.vcproj trunk/desmume/src/windows/resource.h trunk/desmume/src/windows/resources.rcRemoved Paths:------------- trunk/desmume/src/windows/NintendoDS(tm)_logo.bmpModified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2008-09-24 17:53:14 UTC (rev 999)+++ trunk/desmume/src/MMU.cpp2008-09-24 22:25:24 UTC (rev 1000)@@ -1,2950 +1,2950 @@-/* Copyright (C) 2006 yopyop- yop...@if...- yopyop156.ifrance.com--Copyright (C) 2007 shash-- 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 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-*/--//#define RENDER3D--#include <stdlib.h>-#include <math.h>-#include <string.h>--//#include "gl_vertex.h"--#include "debug.h"-#include "NDSSystem.h"-#include "cflash.h"-#include "cp15.h"-#include "wifi.h"-#include "registers.h"-#include "render3D.h"-#include "gfx3d.h"-#include "GPU_osd.h"--#define ROM_MASK 3--/*- *- */-//#define PROFILE_MEMORY_ACCESS 1-#define EARLY_MEMORY_ACCESS 1--#define INTERNAL_DTCM_READ 1-#define INTERNAL_DTCM_WRITE 1--//#define LOG_CARD-//#define LOG_GPU-//#define LOG_DMA-//#define LOG_DMA2-//#define LOG_DIV--char szRomPath[512];-char szRomBaseName[512];--#define DUP2(x) x, x-#define DUP4(x) x, x, x, x-#define DUP8(x) x, x, x, x, x, x, x, x-#define DUP16(x) x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x--MMU_struct MMU;--u8 * MMU_ARM9_MEM_MAP[256]={-/* 0X*/DUP16(ARM9Mem.ARM9_ITCM), -/* 1X*///DUP16(ARM9Mem.ARM9_ITCM)-/* 1X*/DUP16(MMU.UNUSED_RAM), -/* 2X*/DUP16(ARM9Mem.MAIN_MEM),-/* 3X*/DUP16(MMU.SWIRAM),-/* 4X*/DUP16(ARM9Mem.ARM9_REG),-/* 5X*/DUP16(ARM9Mem.ARM9_VMEM),-/* 6X*/DUP2(ARM9Mem.ARM9_ABG), -DUP2(ARM9Mem.ARM9_BBG),-DUP2(ARM9Mem.ARM9_AOBJ),-DUP2(ARM9Mem.ARM9_BOBJ),-DUP8(ARM9Mem.ARM9_LCD),-/* 7X*/DUP16(ARM9Mem.ARM9_OAM),-/* 8X*/DUP16(NULL),-/* 9X*/DUP16(NULL),-/* AX*/DUP16(MMU.CART_RAM),-/* BX*/DUP16(MMU.UNUSED_RAM),-/* CX*/DUP16(MMU.UNUSED_RAM),-/* DX*/DUP16(MMU.UNUSED_RAM),-/* EX*/DUP16(MMU.UNUSED_RAM),-/* FX*/DUP16(ARM9Mem.ARM9_BIOS)-};- -u32 MMU_ARM9_MEM_MASK[256]={-/* 0X*/DUP16(0x00007FFF), -/* 1X*///DUP16(0x00007FFF)-/* 1X*/DUP16(0x00000003), -/* 2X*/DUP16(0x003FFFFF),-/* 3X*/DUP16(0x00007FFF),-/* 4X*/DUP16(0x00FFFFFF),-/* 5X*/DUP16(0x000007FF),-/* 6X*/DUP2(0x0007FFFF), -DUP2(0x0001FFFF),-DUP2(0x0003FFFF),-DUP2(0x0001FFFF),-DUP8(0x000FFFFF),-/* 7X*/DUP16(0x000007FF),-/* 8X*/DUP16(ROM_MASK),-/* 9X*/DUP16(ROM_MASK),-/* AX*/DUP16(0x0000FFFF),-/* BX*/DUP16(0x00000003),-/* CX*/DUP16(0x00000003),-/* DX*/DUP16(0x00000003),-/* EX*/DUP16(0x00000003),-/* FX*/DUP16(0x00007FFF)-};--u8 * MMU_ARM7_MEM_MAP[256]={-/* 0X*/DUP16(MMU.ARM7_BIOS), -/* 1X*/DUP16(MMU.UNUSED_RAM), -/* 2X*/DUP16(ARM9Mem.MAIN_MEM),-/* 3X*/DUP8(MMU.SWIRAM),-DUP8(MMU.ARM7_ERAM),-/* 4X*/DUP8(MMU.ARM7_REG),-DUP8(MMU.ARM7_WIRAM),-/* 5X*/DUP16(MMU.UNUSED_RAM),-/* 6X*/DUP16(ARM9Mem.ARM9_ABG), -/* 7X*/DUP16(MMU.UNUSED_RAM),-/* 8X*/DUP16(NULL),-/* 9X*/DUP16(NULL),-/* AX*/DUP16(MMU.CART_RAM),-/* BX*/DUP16(MMU.UNUSED_RAM),-/* CX*/DUP16(MMU.UNUSED_RAM),-/* DX*/DUP16(MMU.UNUSED_RAM),-/* EX*/DUP16(MMU.UNUSED_RAM),-/* FX*/DUP16(MMU.UNUSED_RAM)-};--u32 MMU_ARM7_MEM_MASK[256]={-/* 0X*/DUP16(0x00003FFF), -/* 1X*/DUP16(0x00000003),-/* 2X*/DUP16(0x003FFFFF),-/* 3X*/DUP8(0x00007FFF),-DUP8(0x0000FFFF),-/* 4X*/DUP8(0x00FFFFFF),-DUP8(0x0000FFFF),-/* 5X*/DUP16(0x00000003),-/* 6X*/DUP16(0x0003FFFF), -/* 7X*/DUP16(0x00000003),-/* 8X*/DUP16(ROM_MASK),-/* 9X*/DUP16(ROM_MASK),-/* AX*/DUP16(0x0000FFFF),-/* BX*/DUP16(0x00000003),-/* CX*/DUP16(0x00000003),-/* DX*/DUP16(0x00000003),-/* EX*/DUP16(0x00000003),-/* FX*/DUP16(0x00000003)-};--u32 MMU_ARM9_WAIT16[16]={-1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1,-};--u32 MMU_ARM9_WAIT32[16]={-1, 1, 1, 1, 1, 2, 2, 1, 8, 8, 5, 1, 1, 1, 1, 1,-};--u32 MMU_ARM7_WAIT16[16]={-1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1,-};--u32 MMU_ARM7_WAIT32[16]={-1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 5, 1, 1, 1, 1, 1,-};--void MMU_Init(void) {-int i;--LOG("MMU init\n");-//printlog("MMU init\n");--memset(&MMU, 0, sizeof(MMU_struct));--MMU.CART_ROM = MMU.UNUSED_RAM;-- for(i = 0x80; i<0xA0; ++i)- {- MMU_ARM9_MEM_MAP[i] = MMU.CART_ROM;- MMU_ARM7_MEM_MAP[i] = MMU.CART_ROM;- }--MMU.MMU_MEM[0] = MMU_ARM9_MEM_MAP;-MMU.MMU_MEM[1] = MMU_ARM7_MEM_MAP;-MMU.MMU_MASK[0]= MMU_ARM9_MEM_MASK;-MMU.MMU_MASK[1] = MMU_ARM7_MEM_MASK;--MMU.DTCMRegion = 0x027C0000;-MMU.ITCMRegion = 0x00000000;--MMU.MMU_WAIT16[0] = MMU_ARM9_WAIT16;-MMU.MMU_WAIT16[1] = MMU_ARM7_WAIT16;-MMU.MMU_WAIT32[0] = MMU_ARM9_WAIT32;-MMU.MMU_WAIT32[1] = MMU_ARM7_WAIT32;--FIFOclear(MMU.fifos);-FIFOclear(MMU.fifos+1);-- mc_init(&MMU.fw, MC_TYPE_FLASH); /* init fw device */- mc_alloc(&MMU.fw, NDS_FW_SIZE_V1);- MMU.fw.fp = NULL;-- // Init Backup Memory device, this should really be done when the rom is loaded- mc_init(&MMU.bupmem, MC_TYPE_AUTODETECT);- mc_alloc(&MMU.bupmem, 1);- MMU.bupmem.fp = NULL;--} --void MMU_DeInit(void) {-LOG("MMU deinit\n");- if (MMU.fw.fp)- fclose(MMU.fw.fp);- mc_free(&MMU.fw); - if (MMU.bupmem.fp)- fclose(MMU.bupmem.fp);- mc_free(&MMU.bupmem);-}--//Card rom & ram--u16 SPI_CNT = 0;-u16 SPI_CMD = 0;-u16 AUX_SPI_CNT = 0;-u16 AUX_SPI_CMD = 0;--u32 rom_mask = 0;--u32 DMASrc[2][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}};-u32 DMADst[2][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}};--void MMU_clearMem()-{-int i;--memset(ARM9Mem.ARM9_ABG, 0, 0x080000);-memset(ARM9Mem.ARM9_AOBJ, 0, 0x040000);-memset(ARM9Mem.ARM9_BBG, 0, 0x020000);-memset(ARM9Mem.ARM9_BOBJ, 0, 0x020000);-memset(ARM9Mem.ARM9_DTCM, 0, 0x4000);-memset(ARM9Mem.ARM9_ITCM, 0, 0x8000);-memset(ARM9Mem.ARM9_LCD, 0, 0x0A4000);-memset(ARM9Mem.ARM9_OAM, 0, 0x0800);-memset(ARM9Mem.ARM9_REG, 0, 0x01000000);-memset(ARM9Mem.ARM9_VMEM, 0, 0x0800);-memset(ARM9Mem.MAIN_MEM, 0, 0x400000);--memset(ARM9Mem.blank_memory, 0, 0x020000);--memset(MMU.ARM7_ERAM, 0, 0x010000);-memset(MMU.ARM7_REG, 0, 0x010000);--FIFOclear(MMU.fifos);-FIFOclear(MMU.fifos+1);--MMU.DTCMRegion = 0x027C0000;-MMU.ITCMRegion = 0x00000000;--memset(MMU.timer, 0, sizeof(u16) * 2 * 4);-memset(MMU.timerMODE, 0, sizeof(s32) * 2 * 4);-memset(MMU.timerON, 0, sizeof(u32) * 2 * 4);-memset(MMU.timerRUN, 0, sizeof(u32) * 2 * 4);-memset(MMU.timerReload, 0, sizeof(u16) * 2 * 4);--memset(MMU.reg_IME, 0, sizeof(u32) * 2);-memset(MMU.reg_IE, 0, sizeof(u32) * 2);-memset(MMU.reg_IF, 0, sizeof(u32) * 2);--memset(MMU.DMAStartTime, 0, sizeof(u32) * 2 * 4);-memset(MMU.DMACycle, 0, sizeof(s32) * 2 * 4);-memset(MMU.DMACrt, 0, sizeof(u32) * 2 * 4);-memset(MMU.DMAing, 0, sizeof(BOOL) * 2 * 4);--memset(MMU.dscard, 0, sizeof(nds_dscard) * 2);--MainScreen.offset = 0;-SubScreen.offset = 192;-osdA->setOffset(MainScreen.offset);-osdB->setOffset(SubScreen.offset);-- /* setup the texture slot pointers */-#if 0- ARM9Mem.textureSlotAddr[0] = ARM9Mem.blank_memory;- ARM9Mem.textureSlotAddr[1] = ARM9Mem.blank_memory;- ARM9Mem.textureSlotAddr[2] = ARM9Mem.blank_memory;- ARM9Mem.textureSlotAddr[3] = ARM9Mem.blank_memory;-#else- ARM9Mem.textureSlotAddr[0] = &ARM9Mem.ARM9_LCD[0x20000 * 0];- ARM9Mem.textureSlotAddr[1] = &ARM9Mem.ARM9_LCD[0x20000 * 1];- ARM9Mem.textureSlotAddr[2] = &ARM9Mem.ARM9_LCD[0x20000 * 2];- ARM9Mem.textureSlotAddr[3] = &ARM9Mem.ARM9_LCD[0x20000 * 3];-#endif-}--/* the VRAM blocks keep their content even when not blended in */-/* to ensure that we write the content back to the LCD ram */-/* FIXME: VRAM Bank E,F,G,H,I missing */-void MMU_VRAMWriteBackToLCD(u8 block)-{-u8 *destination;-u8 *source;-u32 size ;-u8 VRAMBankCnt;--destination = 0 ;-source = 0;-VRAMBankCnt = MMU_read8(ARMCPU_ARM9,REG_VRAMCNTA+block);-if(!(VRAMBankCnt&0x80))return;--switch (block)-{-case 0: // Bank A-destination = ARM9Mem.ARM9_LCD ;-size = 0x20000 ;-break ;-case 1: // Bank B-destination = ARM9Mem.ARM9_LCD + 0x20000 ;-size = 0x20000 ;-break ;-case 2: // Bank C-destination = ARM9Mem.ARM9_LCD + 0x40000 ;-size = 0x20000 ;-break ;-case 3: // Bank D-destination = ARM9Mem.ARM9_LCD + 0x60000 ;-size = 0x20000 ;-break ;-case 4: // Bank E-destination = ARM9Mem.ARM9_LCD + 0x80000 ;-size = 0x10000 ;-break ;-case 5: // Bank F-destination = ARM9Mem.ARM9_LCD + 0x90000 ;-size = 0x4000 ;-break ;-case 6: // Bank G-destination = ARM9Mem.ARM9_LCD + 0x94000 ;-size = 0x4000 ;-break ;-case 8: // Bank H-destination = ARM9Mem.ARM9_LCD + 0x98000 ;-size = 0x8000 ;-break ;-case 9: // Bank I-destination = ARM9Mem.ARM9_LCD + 0xA0000 ;-size = 0x4000 ;-break ;-default:-return ;-}-switch (VRAMBankCnt & 7) {-case 0:-/* vram is allready stored at LCD, we dont need to write it back */-break ;-case 1:-switch(block){-case 0:-case 1:-case 2:-case 3:-/* banks are in use for BG at ABG + ofs * 0x20000 */-source = ARM9Mem.ARM9_ABG + ((VRAMBankCnt >> 3) & 3) * 0x20000 ;-break ;-case 4:-/* bank E is in use at ABG */ -source = ARM9Mem.ARM9_ABG ;-break;-case 5:-case 6:-/* banks are in use for BG at ABG + (0x4000*OFS.0)+(0x10000*OFS.1)*/-source = ARM9Mem.ARM9_ABG + (((VRAMBankCnt >> 3) & 1) * 0x4000) + (((VRAMBankCnt >> 2) & 1) * 0x10000) ;-break;-case 8:-/* bank H is in use at BBG */ -source = ARM9Mem.ARM9_BBG ;-break ;-case 9:-/* bank I is in use at BBG */ -source = ARM9Mem.ARM9_BBG + 0x8000 ;-break;-default: return ;-}-break ;-case 2:-switch(block)-{-case 0:-case 1:-// banks A,B are in use for OBJ at AOBJ + ofs * 0x20000-source=ARM9Mem.ARM9_AOBJ+(((VRAMBankCnt>>3)&1)*0x20000);-break;-case 4:-source=ARM9Mem.ARM9_AOBJ;-break;-case 5:-case 6:-source=ARM9Mem.ARM9_AOBJ+(((VRAMBankCnt>>3)&1)*0x4000)+(((VRAMBankCnt>>4)&1)*0x10000);-break;-case 9:-//source=ARM9Mem.ARM9_BOBJ;-break;-}-break ;-case 3: break;-case 4:-switch(block)-{-case 2:-/* bank C is in use at BBG */ -source = ARM9Mem.ARM9_BBG ;-break ;-case 3:-/* bank D is in use at BOBJ */ -source = ARM9Mem.ARM9_BOBJ ;-break ;-default: return ;-}-break ;-default:-return ;-}-if (!destination) return ;-if (!source) return ;-memcpy(destination,source,size) ;-}--void MMU_VRAMReloadFromLCD(u8 block,u8 VRAMBankCnt)-{-u8 *destination;-u8 *source;-u32 size;--if(!(VRAMBankCnt&0x80))return;-destination = 0;-source = 0;-size = 0;-switch (block)-{-case 0: // Bank A-source = ARM9Mem.ARM9_LCD ;-size = 0x20000 ;-break ;-case 1: // Bank B-source = ARM9Mem.ARM9_LCD + 0x20000 ;-size = 0x20000 ;-break ;-case 2: // Bank C-source = ARM9Mem.ARM9_LCD + 0x40000 ;-size = 0x20000 ;-break ;-case 3: // Bank D-source = ARM9Mem.ARM9_LCD + 0x60000 ;-size = 0x20000 ;-break ;-case 4: // Bank E-source = ARM9Mem.ARM9_LCD + 0x80000 ;-size = 0x10000 ;-break ;-case 5: // Bank F-source = ARM9Mem.ARM9_LCD + 0x90000 ;-size = 0x4000 ;-break ;-case 6: // Bank G-source = ARM9Mem.ARM9_LCD + 0x94000 ;-size = 0x4000 ;-break ;-case 8: // Bank H-source = ARM9Mem.ARM9_LCD + 0x98000 ;-size = 0x8000 ;-break ;-case 9: // Bank I-source = ARM9Mem.ARM9_LCD + 0xA0000 ;-size = 0x4000 ;-break ;-default:-return ;-}-switch (VRAMBankCnt & 7) {-case 0:// vram is allready stored at LCD, we dont need to write it back-break ;-case 1:-switch(block){-case 0:-case 1:-case 2:-case 3:// banks are in use for BG at ABG + ofs * 0x20000-destination = ARM9Mem.ARM9_ABG + ((VRAMBankCnt >> 3) & 3) * 0x20000 ;-break ;-case 4:// bank E is in use at ABG -destination = ARM9Mem.ARM9_ABG ;-break;-case 5:-case 6:// banks are in use for BG at ABG + (0x4000*OFS.0)+(0x10000*OFS.1)-destination = ARM9Mem.ARM9_ABG + (((VRAMBankCnt >> 3) & 1) * 0x4000) + (((VRAMBankCnt >> 4) & 1) * 0x10000) ;-break;-case 7:-case 8:// bank H is in use at BBG-//destination = ARM9Mem.ARM9_BBG ;-break ;-case 9:// bank I is in use at BBG-//destination = ARM9Mem.ARM9_BBG + 0x8000 ;-break;-//default: return ;-}-break ;-case 2:-switch(block)-{-case 0:-case 1:-destination=ARM9Mem.ARM9_AOBJ+(((VRAMBankCnt>>3)&3)*0x20000);-break;-case 4:-destination=ARM9Mem.ARM9_AOBJ;-break;-case 5:-case 6:-destination=ARM9Mem.ARM9_AOBJ+(((VRAMBankCnt>>3)&1)*0x4000)+(((VRAMBankCnt>>4)&1)*0x10000);-break;-case 9:-//destination=ARM9Mem.ARM9_BOBJ;-break;-}--break;-//case 3: break;-case 4:-switch(block){-case 2:// bank C is in use at BBG-destination = ARM9Mem.ARM9_BBG ;-break ;-case 3:-// bank D is in use at BOBJ -destination = ARM9Mem.ARM9_BOBJ ;-break ;-default: return ;-}-break ;-default:-return ;-}-if (!destination) return ;-if (!source) return ;-memcpy(destination,source,size) ;-}--void MMU_setRom(u8 * rom, u32 mask)-{-unsigned int i;-MMU.CART_ROM = rom;--for(i = 0x80; i<0xA0; ++i)-{-MMU_ARM9_MEM_MAP[i] = rom;-MMU_ARM7_MEM_MAP[i] = rom;-MMU_ARM9_MEM_MASK[i] = mask;-MMU_ARM7_MEM_MASK[i] = mask;-}-rom_mask = mask;-}--void MMU_unsetRom()-{-unsigned int i;-MMU.CART_ROM=MMU.UNUSED_RAM;--for(i = 0x80; i<0xA0; ++i)-{-MMU_ARM9_MEM_MAP[i] = MMU.UNUSED_RAM;-MMU_ARM7_MEM_MAP[i] = MMU.UNUSED_RAM;-MMU_ARM9_MEM_MASK[i] = ROM_MASK;-MMU_ARM7_MEM_MASK[i] = ROM_MASK;-}-rom_mask = ROM_MASK;-}-char txt[80];--template<u32 proc>-u8 FASTCALL _MMU_read8(u32 adr)-{-#ifdef INTERNAL_DTCM_READ-if((proc==ARMCPU_ARM9)&((adr&(~0x3FFF))==MMU.DTCMRegion))-{-return ARM9Mem.ARM9_DTCM[adr&0x3FFF];-}-#endif--if(proc==ARMCPU_ARM9 && adr<0x02000000)-{-//printlog("MMU ITCM (08) Read %08X: %08X\n", adr, T1ReadByte(ARM9Mem.ARM9_ITCM, adr&0x7FFF));-return T1ReadByte(ARM9Mem.ARM9_ITCM, adr&0x7FFF);-}--// CFlash reading, Mic-if ((adr>=0x9000000)&&(adr<0x9900000))-return (unsigned char)cflash_read(adr);--#ifdef EXPERIMENTAL_WIFI-/* wifi mac access */-if ((proc==ARMCPU_ARM7) && (adr>=0x04800000)&&(adr<0x05000000))-{-if (adr & 1)-return (WIFI_read16(&wifiMac,adr) >> 8) & 0xFF;-else-return WIFI_read16(&wifiMac,adr) & 0xFF;-}-#endif-- return MMU.MMU_MEM[proc][(adr>>20)&0xFF][adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF]];-}--template<u32 proc>-u16 FASTCALL _MMU_read16(u32 adr)-{ -#ifdef INTERNAL_DTCM_READ-if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion))-{-/* Returns data from DTCM (ARM9 only) */-return T1ReadWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF);-}-#endif-if(proc==ARMCPU_ARM9 && adr<0x02000000)-{-//printlog("MMU ITCM (16) Read %08X: %08X\n", adr, T1ReadWord(ARM9Mem.ARM9_ITCM, adr&0x7FFF));-return T1ReadWord(ARM9Mem.ARM9_ITCM, adr&0x7FFF);-}--// CFlash reading, Mic-if ((adr>=0x08800000)&&(adr<0x09900000))- return (unsigned short)cflash_read(adr);--#ifdef EXPERIMENTAL_WIFI-/* wifi mac access */-if ((proc==ARMCPU_ARM7) && (adr>=0x04800000)&&(adr<0x05000000))-return WIFI_read16(&wifiMac,adr) ;-#endif--adr &= 0x0FFFFFFF;--if(adr&0x04000000)-{-/* Adress is an IO register */-switch(adr)-{-case 0x04000604:-return (gfx3d_GetNumPolys()&2047);-case 0x04000606:-return (gfx3d_GetNumVertex()&8191);--case REG_IPCFIFORECV : /* TODO (clear): ??? */-printlog("read16: IPCFIFORECV\n");-//printlog("Stopped IPCFIFORECV\n");-execute = FALSE;-return 1;--case REG_IME :-return (u16)MMU.reg_IME[proc];--case REG_IE :-return (u16)MMU.reg_IE[proc];-case REG_IE + 2 :-return (u16)(MMU.reg_IE[proc]>>16);--case REG_IF :-//printlog("read16 (low): REG_IF\n");-return (u16)MMU.reg_IF[proc];-case REG_IF + 2 :-//printlog("read16 (high): REG_IF\n");-return (u16)(MMU.reg_IF[proc]>>16);--case REG_TM0CNTL :-case REG_TM1CNTL :-case REG_TM2CNTL :-case REG_TM3CNTL :-return MMU.timer[proc][(adr&0xF)>>2];--case 0x04000630 :-//LOG("vect res\r\n");/* TODO (clear): ??? */-//execute = FALSE;-return 0;- case REG_POSTFLG :-return 1;-default :-break;-}-}--/* Returns data from memory */-return T1ReadWord(MMU.MMU_MEM[proc][(adr >> 20) & 0xFF], adr & MMU.MMU_MASK[proc][(adr >> 20) & 0xFF]); -}--template<u32 proc>-u32 FASTCALL _MMU_read32(u32 adr)-{-#ifdef INTERNAL_DTCM_READ-if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion))-{-/* Returns data from DTCM (ARM9 only) */-return T1ReadLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF);-}-#endif--if(proc==ARMCPU_ARM9 && adr<0x02000000) -{-//printlog("MMU ITCM (32) Read %08X: %08X\n", adr, T1ReadLong(ARM9Mem.ARM9_ITCM, adr&0x7FFF));-return T1ReadLong(ARM9Mem.ARM9_ITCM, adr&0x7FFF);-}--// CFlash reading, Mic-if ((adr>=0x9000000)&&(adr<0x9900000))- return (unsigned long)cflash_read(adr);-adr &= 0x0FFFFFFF;--if((adr >> 24) == 4)-{-/* Adress is an IO register */-switch(adr)-{-// This is hacked due to the only current 3D core-case 0x04000600:// Geometry Engine Status Register (R and R/W)- {-u32 gxstat =( 2 |-(MMU.fifos[proc].full<<24)|-(MMU.fifos[proc].half<<25)|-(MMU.fifos[proc].empty<<26)|-(MMU.fifos[proc].irq<<30)-);-returngxstat;- }--case 0x04000640:-case 0x04000644:-case 0x04000648:-case 0x0400064C:-case 0x04000650:-case 0x04000654:-case 0x04000658:-case 0x0400065C:-case 0x04000660:-case 0x04000664:-case 0x04000668:-case 0x0400066C:-case 0x04000670:-case 0x04000674:-case 0x04000678:-case 0x0400067C:-{-//LOG("4000640h..67Fh - CLIPMTX_RESULT - Read Current Clip Coordinates Matrix (R)");-return gfx3d_GetClipMatrix ((adr-0x04000640)/4);-}-case 0x04000680:-case 0x04000684:-case 0x04000688:-case 0x0400068C:-case 0x04000690:-case 0x04000694:-case 0x04000698:-case 0x0400069C:-case 0x040006A0:-{-//LOG("4000680h..6A3h - VECMTX_RESULT - Read Current Directional Vector Matrix (R)");-return gfx3d_GetDirectionalMatrix ((adr-0x04000680)/4);-}--case 0x4000604:-{-return (gfx3d_GetNumPolys()&2047) & ((gfx3d_GetNumVertex()&8191) << 16);-//LOG ("read32 - RAM_COUNT -> 0x%X", ((u32 *)(MMU.MMU_MEM[proc][(adr>>20)&0xFF]))[(adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF])>>2]);-}--case REG_IME :-return MMU.reg_IME[proc];-case REG_IE :-return MMU.reg_IE[proc];-case REG_IF :-//printlog("read32: REG_IF\n");-return MMU.reg_IF[proc];-case REG_IPCFIFORECV :-{-u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);-//printlog("read32: REG_IPCFIFORECV (%X)\n", cnt_l);-if (!(cnt_l & 0x8000)) return 0;// FIFO disabled-u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);-u32 val = FIFOget(MMU.fifos + proc);--cnt_l |= (MMU.fifos[proc].empty<<8) | (MMU.fifos[proc].full<<9) | (MMU.fifos[proc].error<<14);-cnt_r |= (MMU.fifos[proc].empty) | (MMU.fifos[proc].full<<1);--T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);-T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, cnt_r);--if ((MMU.fifos[proc].empty) && (cnt_l & BIT(2)))-NDS_makeInt(proc^1,17) ; /* remote: SEND FIFO EMPTY */--return val;-}-return 0;- case REG_TM0CNTL :- case REG_TM1CNTL :- case REG_TM2CNTL :- case REG_TM3CNTL :-{-u32 val = T1ReadWord(MMU.MMU_MEM[proc][0x40], (adr + 2) & 0xFFF);-return MMU.timer[proc][(adr&0xF)>>2] | (val<<16);-}-/*-case 0x04000640 :// TODO (clear): again, ??? -LOG("read proj\r\n");-return 0;-case 0x04000680 :-LOG("read roat\r\n");-return 0;-case 0x04000620 :-LOG("point res\r\n");-return 0;-*/- case REG_GCDATAIN:-{- u32 val=0;-- if(MMU.dscard[proc].adress)-val = T1ReadLong(MMU.CART_ROM, MMU.dscard[proc].adress);--MMU.dscard[proc].adress += 4;/* increment adress */--MMU.dscard[proc].transfer_count--;/* update transfer counter */-if(MMU.dscard[proc].transfer_count) /* if transfer is not ended */-return val;/* return data */-else/* transfer is done */- { -T1WriteLong(MMU.MMU_MEM[proc][(REG_GCROMCTRL >> 20) & 0xff], REG_GCROMCTRL & 0xfff, T1ReadLong(MMU.MMU_MEM[proc][(REG_GCROMCTRL >> 20) & 0xff], REG_GCROMCTRL & 0xfff) & ~(0x00800000 | 0x80000000));-/* = 0x7f7fffff */--/* if needed, throw irq for the end of transfer */-if(T1ReadWord(MMU.MMU_MEM[proc][(REG_AUXSPICNT >> 20) & 0xff], REG_AUXSPICNT & 0xfff) & 0x4000)-NDS_makeInt(proc,19);--return val;-}-}--default :-break;-}-}--//Returns data from memory-// Removed the &0xFF as they are implicit with the adr&0x0FFFFFFFF [zeromus, inspired by shash]-return T1ReadLong(MMU.MMU_MEM[proc][(adr >> 20)], adr & MMU.MMU_MASK[proc][(adr >> 20)]);-}--#define OFS(i)((i>>3)&3)--template<u32 proc>-void FASTCALL _MMU_write8(u32 adr, u8 val)-{-#ifdef INTERNAL_DTCM_WRITE-if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion))-{-/* Writes data in DTCM (ARM9 only) */-ARM9Mem.ARM9_DTCM[adr&0x3FFF] = val;-return ;-}-#endif-if(proc==ARMCPU_ARM9 && adr<0x02000000)-{-//printlog("MMU ITCM (08) Write %08X: %08X\n", adr, val);-T1WriteByte(ARM9Mem.ARM9_ITCM, adr&0x7FFF, val);-return ;-}-// CFlash writing, Mic-if ((adr>=0x9000000)&&(adr<0x9900000)) {-cflash_write(adr,val);-return;-}--adr &= 0x0FFFFFFF;-- // This is bad, remove it- if(proc == ARMCPU_ARM7)- {- if ((adr>=0x04000400)&&(adr<0x0400051D))- {- SPU_WriteByte(adr, val);- return;- }- }--if (adr & 0xFF800000 == 0x04800000)-{-/* is wifi hardware, dont intermix with regular hardware registers */-/* FIXME handle 8 bit writes */-return ;-}--switch(adr)-{-case REG_DISPA_WIN0H: -if(proc == ARMCPU_ARM9) GPU_setWIN0_H1(MainScreen.gpu, val);-break ; -case REG_DISPA_WIN0H+1: -if(proc == ARMCPU_ARM9) GPU_setWIN0_H0 (MainScreen.gpu, val);-break ; -case REG_DISPA_WIN1H: -if(proc == ARMCPU_ARM9) GPU_setWIN1_H1 (MainScreen.gpu,val);-break ; -case REG_DISPA_WIN1H+1: -if(proc == ARMCPU_ARM9) GPU_setWIN1_H0 (MainScreen.gpu,val);-break ; --case REG_DISPB_WIN0H: -if(proc == ARMCPU_ARM9) GPU_setWIN0_H1(SubScreen.gpu,val);-break ; -case REG_DISPB_WIN0H+1: -if(proc == ARMCPU_ARM9) GPU_setWIN0_H0(SubScreen.gpu,val);-break ; -case REG_DISPB_WIN1H: -if(proc == ARMCPU_ARM9) GPU_setWIN1_H1(SubScreen.gpu,val);-break ; -case REG_DISPB_WIN1H+1: -if(proc == ARMCPU_ARM9) GPU_setWIN1_H0(SubScreen.gpu,val);-break ;--case REG_DISPA_WIN0V: -if(proc == ARMCPU_ARM9) GPU_setWIN0_V1(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WIN0V+1: -if(proc == ARMCPU_ARM9) GPU_setWIN0_V0(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WIN1V: -if(proc == ARMCPU_ARM9) GPU_setWIN1_V1(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WIN1V+1: -if(proc == ARMCPU_ARM9) GPU_setWIN1_V0(MainScreen.gpu,val) ; -break ; --case REG_DISPB_WIN0V: -if(proc == ARMCPU_ARM9) GPU_setWIN0_V1(SubScreen.gpu,val) ;-break ; -case REG_DISPB_WIN0V+1: -if(proc == ARMCPU_ARM9) GPU_setWIN0_V0(SubScreen.gpu,val) ;-break ; -case REG_DISPB_WIN1V: -if(proc == ARMCPU_ARM9) GPU_setWIN1_V1(SubScreen.gpu,val) ;-break ; -case REG_DISPB_WIN1V+1: -if(proc == ARMCPU_ARM9) GPU_setWIN1_V0(SubScreen.gpu,val) ;-break ;--case REG_DISPA_WININ: -if(proc == ARMCPU_ARM9) GPU_setWININ0(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WININ+1: -if(proc == ARMCPU_ARM9) GPU_setWININ1(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WINOUT: -if(proc == ARMCPU_ARM9) GPU_setWINOUT(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WINOUT+1: -if(proc == ARMCPU_ARM9) GPU_setWINOBJ(MainScreen.gpu,val);-break ; --case REG_DISPB_WININ: -if(proc == ARMCPU_ARM9) GPU_setWININ0(SubScreen.gpu,val) ; -break ; -case REG_DISPB_WININ+1: -if(proc == ARMCPU_ARM9) GPU_setWININ1(SubScreen.gpu,val) ; -break ; -case REG_DISPB_WINOUT: -if(proc == ARMCPU_ARM9) GPU_setWINOUT(SubScreen.gpu,val) ; -break ; -case REG_DISPB_WINOUT+1: -if(proc == ARMCPU_ARM9) GPU_setWINOBJ(SubScreen.gpu,val) ; -break ;---case REG_DISPA_BLDCNT:-if(proc == ARMCPU_ARM9) GPU_setBLDCNT_HIGH(MainScreen.gpu,val);-break;-case REG_DISPA_BLDCNT+1:-if(proc == ARMCPU_ARM9) GPU_setBLDCNT_LOW (MainScreen.gpu,val);-break;--case REG_DISPB_BLDCNT: -if(proc == ARMCPU_ARM9) GPU_setBLDCNT_HIGH (SubScreen.gpu,val);-break;-case REG_DISPB_BLDCNT+1: -if(proc == ARMCPU_ARM9) GPU_setBLDCNT_LOW (SubScreen.gpu,val);-break;--case REG_DISPA_BLDALPHA: -if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVB(MainScreen.gpu,val) ; -break;-case REG_DISPA_BLDALPHA+1:-if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVA(MainScreen.gpu,val) ; -break;--case REG_DISPB_BLDALPHA:-if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVB(SubScreen.gpu,val) ; -break;-case REG_DISPB_BLDALPHA+1:-if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVA(SubScreen.gpu,val);-break;--case REG_DISPA_BLDY: -if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(MainScreen.gpu,val) ; -break ; -case REG_DISPB_BLDY: -if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(SubScreen.gpu,val) ; -break;--/* 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)-{-MMU_VRAMWriteBackToLCD(adr-REG_VRAMCNTA) ;-switch(val & 0x1F)-{-case 1 :-MMU.vram_mode[adr-REG_VRAMCNTA] = 0; // BG-VRAM-//memset(ARM9Mem.ARM9_ABG,0,0x20000);-//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-//memset(ARM9Mem.ARM9_ABG+0x20000,0,0x20000);-//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-//memset(ARM9Mem.ARM9_ABG+0x40000,0,0x20000);-//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-//memset(ARM9Mem.ARM9_ABG+0x60000,0,0x20000);-//MMU.vram_offset[0] = ARM9Mem.ARM9_ABG+(0x20000*3); // BG-VRAM-break;-case 0: // mapped to lcd- MMU.vram_mode[adr-REG_VRAMCNTA] = 4 | (adr-REG_VRAMCNTA) ;-break ;-}- //- // FIXME: simply texture slot handling- // This is a first stab and is not correct. It does- // not handle a VRAM texture slot becoming- // unconfigured.- // Revisit all of VRAM control handling for future- // release?- //- if ( val & 0x80) {- if ( (val & 0x7) == 3) {- int slot_index = (val >> 3) & 0x3;-- ARM9Mem.textureSlotAddr[slot_index] =- &ARM9Mem.ARM9_LCD[0x20000 * (adr - REG_VRAMCNTA)];--gpu3D->NDS_3D_VramReconfigureSignal();- }- }- MMU_VRAMReloadFromLCD(adr-REG_VRAMCNTA,val) ;-}-break;-- case REG_VRAMCNTE :-if(proc == ARMCPU_ARM9)-{- MMU_VRAMWriteBackToLCD(4);- if((val & 7) == 5)-{-ARM9Mem.ExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x80000;-ARM9Mem.ExtPal[0][1] = ARM9Mem.ARM9_LCD + 0x82000;-ARM9Mem.ExtPal[0][2] = ARM9Mem.ARM9_LCD + 0x84000;-ARM9Mem.ExtPal[0][3] = ARM9Mem.ARM9_LCD + 0x86000;-}- else if((val & 7) == 3)-{-ARM9Mem.texPalSlot[0] = ARM9Mem.ARM9_LCD + 0x80000;-ARM9Mem.texPalSlot[1] = ARM9Mem.ARM9_LCD + 0x82000;-ARM9Mem.texPalSlot[2] = ARM9Mem.ARM9_LCD + 0x84000;-ARM9Mem.texPalSlot[3] = ARM9Mem.ARM9_LCD + 0x86000;-}- else if((val & 7) == 4)-{-ARM9Mem.ExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x80000;-ARM9Mem.ExtPal[0][1] = ARM9Mem.ARM9_LCD + 0x82000;-ARM9Mem.ExtPal[0][2] = ARM9Mem.ARM9_LCD + 0x84000;-ARM9Mem.ExtPal[0][3] = ARM9Mem.ARM9_LCD + 0x86000;-}--MMU_VRAMReloadFromLCD(4,val) ;-}-break;-- case REG_VRAMCNTF :-if(proc == ARMCPU_ARM9)-{-MMU_VRAMWriteBackToLCD(5);-switch(val & 0x1F)-{- case 4 :-ARM9Mem.ExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x90000;-ARM9Mem.ExtPal[0][1] = ARM9Mem.ARM9_LCD + 0x92000;-break;-- case 4 | (1 << 3) :-ARM9Mem.ExtPal[0][2] = ARM9Mem.ARM9_LCD + 0x90000;-ARM9Mem.ExtPal[0][3] = ARM9Mem.ARM9_LCD + 0x92000;-break;-- case 3 :-ARM9Mem.texPalSlot[0] = ARM9Mem.ARM9_LCD + 0x90000;-break;-- case 3 | (1 << 3) :-ARM9Mem.texPalSlot[1] = ARM9Mem.ARM9_LCD + 0x90000;-break;-- case 3 | (2 << 3) :-ARM9Mem.texPalSlot[2] = ARM9Mem.ARM9_LCD + 0x90000;-break;-- case 3 | (3 << 3) :-ARM9Mem.texPalSlot[3] = ARM9Mem.ARM9_LCD + 0x90000;-break;-- case 5 :- case 5 | (1 << 3) :- case 5 | (2 << 3) :- case 5 | (3 << 3) :-ARM9Mem.ObjExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x90000;-ARM9Mem.ObjExtPal[0][1] = ARM9Mem.ARM9_LCD + 0x92000;-break;-}-MMU_VRAMReloadFromLCD(5,val);- }-break;- case REG_VRAMCNTG :-if(proc == ARMCPU_ARM9)-{-MMU_VRAMWriteBackToLCD(6);- switch(val & 0x1F)-{- case 4 :-ARM9Mem.ExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x94000;-ARM9Mem.ExtPal[0][1] = ARM9Mem.ARM9_LCD + 0x96000;-break;-- case 4 | (1 << 3) :-ARM9Mem.ExtPal[0][2] = ARM9Mem.ARM9_LCD + 0x94000;-ARM9Mem.ExtPal[0][3] = ARM9Mem.ARM9_LCD + 0x96000;-break;-- case 3 :-ARM9Mem.texPalSlot[0] = ARM9Mem.ARM9_LCD + 0x94000;-break;-- case 3 | (1 << 3) :-ARM9Mem.texPalSlot[1] = ARM9Mem.ARM9_LCD + 0x94000;-break;-- case 3 | (2 << 3) :-ARM9Mem.texPalSlot[2] = ARM9Mem.ARM9_LCD + 0x94000;-break;-- case 3 | (3 << 3) :-ARM9Mem.texPalSlot[3] = ARM9Mem.ARM9_LCD + 0x94000;-break;-- case 5 :- case 5 | (1 << 3) :- case 5 | (2 << 3) :- case 5 | (3 << 3) :-ARM9Mem.ObjExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x94000;-ARM9Mem.ObjExtPal[0][1] = ARM9Mem.ARM9_LCD + 0x96000;-break;-}-MMU_VRAMReloadFromLCD(6,val);-}-break;-- case REG_VRAMCNTH :-if(proc == ARMCPU_ARM9)-{- MMU_VRAMWriteBackToLCD(7);- - if((val & 7) == 2)-{-ARM9Mem.ExtPal[1][0] = ARM9Mem.ARM9_LCD + 0x98000;-ARM9Mem.ExtPal[1][1] = ARM9Mem.ARM9_LCD + 0x9A000;-ARM9Mem.ExtPal[1][2] = ARM9Mem.ARM9_LCD + 0x9C000;-ARM9Mem.ExtPal[1][3] = ARM9Mem.ARM9_LCD + 0x9E000;-}--MMU_VRAMReloadFromLCD(7,val);-}-break;-- case REG_VRAMCNTI :-if(proc == ARMCPU_ARM9)-{- MMU_VRAMWriteBackToLCD(8);- - if((val & 7) == 3)-{-ARM9Mem.ObjExtPal[1][0] = ARM9Mem.ARM9_LCD + 0xA0000;-ARM9Mem.ObjExtPal[1][1] = ARM9Mem.ARM9_LCD + 0xA2000;-}--MMU_VRAMReloadFromLCD(8,val);-}-break;--#ifdef LOG_CARD-case 0x040001A0 : /* TODO (clear): ??? */-case 0x040001A1 :-case 0x040001A2 :-case 0x040001A8 :-case 0x040001A9 :-case 0x040001AA :-case 0x040001AB :-case 0x040001AC :-case 0x040001AD :-case 0x040001AE :-case 0x040001AF :- LOG("%08X : %02X\r\n", adr, val);-#endif--default :-break;-}--// Removed the &0xFF as they are implicit with the adr&0x0FFFFFFFF [shash]-MMU.MMU_MEM[proc][adr>>20][adr&MMU.MMU_MASK[proc][adr>>20]]=val;-}--u16 partie = 1;--template<u32 proc>-void FASTCALL _MMU_write16(u32 adr, u16 val)-{-#ifdef INTERNAL_DTCM_WRITE-if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion))-{-/* Writes in DTCM (ARM9 only) */-T1WriteWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF, val);-return;-}-#endif-if(proc==ARMCPU_ARM9 && adr<0x02000000)-{-//printlog("MMU ITCM (16) Write %08X: %08X\n", adr, val);-T1WriteWord(ARM9Mem.ARM9_ITCM, adr&0x7FFF, val);-return ;-}--// CFlash writing, Mic-if ((adr>=0x08800000)&&(adr<0x09900000))-{-cflash_write(adr,val);-return;-}--#ifdef EXPERIMENTAL_WIFI--/* wifi mac access */-if ((proc==ARMCPU_ARM7) && (adr>=0x04800000)&&(adr<0x05000000))-{-WIFI_write16(&wifiMac,adr,val) ;-return ;-}-#else-if ((proc==ARMCPU_ARM7) && (adr>=0x04800000)&&(adr<0x05000000))-return ;-#endif--adr &= 0x0FFFFFFF;-- // This is bad, remove it- if(proc == ARMCPU_ARM7)- {- if ((adr>=0x04000400)&&(adr<0x0400051D))- {- SPU_WriteWord(adr, val);- return;- }- }--if((adr >> 24) == 4)-{-if(adr >= 0x04000380 && adr <= 0x040003BE)-{-//toon table-((u16 *)(MMU.MMU_MEM[proc][0x40]))[(adr-0x04000000)>>1] = val;-gfx3d_UpdateToonTable(&((MMU.MMU_MEM[proc][0x40]))[(0x380)]);-}-/* Adress is an IO register */-else switch(adr)-{-case 0x0400035C:-{-((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x35C>>1] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glFogOffset (val);-}-return;-}-case 0x04000340:-{-((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x340>>1] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glAlphaFunc(val);-}-return;-}-case 0x04000060:-{-((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x060>>1] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_Control(val);-}-return;-}-case 0x04000354:-{-((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x354>>1] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glClearDepth(val);-}-return;-}--case REG_DISPA_BLDCNT: -if(proc == ARMCPU_ARM9) GPU_setBLDCNT(MainScreen.gpu,val) ; -break ; -case REG_DISPB_BLDCNT: -if(proc == ARMCPU_ARM9) GPU_setBLDCNT(SubScreen.gpu,val) ; -break ; -case REG_DISPA_BLDALPHA: -if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(MainScreen.gpu,val) ; -break ; -case REG_DISPB_BLDALPHA: -if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(SubScreen.gpu,val) ; -break ; -case REG_DISPA_BLDY: -if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(MainScreen.gpu,val) ; -break ; -case REG_DISPB_BLDY: -if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(SubScreen.gpu,val) ; -break;-case REG_DISPA_MASTERBRIGHT:-GPU_setMasterBrightness (MainScreen.gpu, val);-break;-/*-case REG_DISPA_MOSAIC: -if(proc == ARMCPU_ARM9) GPU_setMOSAIC(MainScreen.gpu,val) ; -break ; -case REG_DISPB_MOSAIC: -if(proc == ARMCPU_ARM9) GPU_setMOSAIC(SubScreen.gpu,val) ; -break ;-*/--case REG_DISPA_WIN0H: -if(proc == ARMCPU_ARM9) GPU_setWIN0_H (MainScreen.gpu,val) ; -break ; -case REG_DISPA_WIN1H: -if(proc == ARMCPU_ARM9) GPU_setWIN1_H(MainScreen.gpu,val) ; -break ; -case REG_DISPB_WIN0H: -if(proc == ARMCPU_ARM9) GPU_setWIN0_H(SubScreen.gpu,val) ; -break ; -case REG_DISPB_WIN1H: -if(proc == ARMCPU_ARM9) GPU_setWIN1_H(SubScreen.gpu,val) ; -break ; -case REG_DISPA_WIN0V: -if(proc == ARMCPU_ARM9) GPU_setWIN0_V(MainScreen.gpu,val) ; -break ; -case REG_DISPA_WIN1V: -if(proc == ARMCPU_ARM9) GPU_setWIN1_V(MainScreen.gpu,val) ; -break ; -case REG_DISPB_WIN0V: -if(proc == ARMCPU_ARM9) GPU_setWIN0_V(SubScreen.gpu,val) ; -break ; -case REG_DISPB_WIN1V: -if(proc == ARMCPU_ARM9) GPU_setWIN1_V(SubScreen.gpu,val) ; -break ; -case REG_DISPA_WININ: -if(proc == ARMCPU_ARM9) GPU_setWININ(MainScreen.gpu, val) ; -break ; -case REG_DISPA_WINOUT: -if(proc == ARMCPU_ARM9) GPU_setWINOUT16(MainScreen.gpu, val) ; -break ; -case REG_DISPB_WININ: -if(proc == ARMCPU_ARM9) GPU_setWININ(SubScreen.gpu, val) ; -break ; -case REG_DISPB_WINOUT: -if(proc == ARMCPU_ARM9) GPU_setWINOUT16(SubScreen.gpu, val) ; -break ;--case REG_DISPB_MASTERBRIGHT:-GPU_setMasterBrightness (SubScreen.gpu, val);-break;-- case REG_POWCNT1 :-if(proc == ARMCPU_ARM9)-{-if(val & (1<<15))-{-LOG("Main core on top\n");-MainScreen.offset = 0;-SubScreen.offset = 192;-//nds.swapScreen();-}-else-{-LOG("Main core on bottom (%04X)\n", val);-MainScreen.offset = 192;-SubScreen.offset = 0;-}-osdA->setOffset(MainScreen.offset);-osdB->setOffset(SubScreen.offset);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x304, val);-}--return;-- case REG_AUXSPICNT:- T1WriteWord(MMU.MMU_MEM[proc][(REG_AUXSPICNT >> 20) & 0xff], REG_AUXSPICNT & 0xfff, val);- AUX_SPI_CNT = val;-- if (val == 0)- mc_reset_com(&MMU.bupmem); /* reset backup memory device communication */-return;-- case REG_AUXSPIDATA:- if(val!=0)- {- AUX_SPI_CMD = val & 0xFF;- }-- T1WriteWord(MMU.MMU_MEM[proc][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));-return;--case REG_SPICNT :-if(proc == ARMCPU_ARM7)-{- int reset_firmware = 1;-- if ( ((SPI_CNT >> 8) & 0x3) == 1) {- if ( ((val >> 8) & 0x3) == 1) {- if ( BIT11(SPI_CNT)) {- /* select held */- reset_firmware = 0;- }- }- }-- //MMU.fw.com == 0; /* reset fw device communication */- if ( reset_firmware) {- /* reset fw device communication */- mc_reset_com(&MMU.fw);- }- SPI_CNT = val;- }--T1WriteWord(MMU.MMU_MEM[proc][(REG_SPICNT >> 20) & 0xff], REG_SPICNT & 0xfff, val);-return;--case REG_SPIDATA :-if(proc==ARMCPU_ARM7)-{- u16 spicnt;--if(val!=0)-{-SPI_CMD = val;-}-- spicnt = T1ReadWord(MMU.MMU_MEM[proc][(REG_SPICNT >> 20) & 0xff], REG_SPICNT & 0xfff);-- switch((spicnt >> 8) & 0x3)-{- case 0 :-break;-- case 1 : /* firmware memory device */- if(spicnt & 0x3 != 0) /* check SPI baudrate (must be 4mhz) */-{-T1WriteWord(MMU.MMU_MEM[proc][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, 0);-break;-}-T1WriteWord(MMU.MMU_MEM[proc][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, fw_transfer(&MMU.fw, val));--return;-- case 2 :-switch(SPI_CMD & 0x70)-{-case 0x00 :-val = 0;-break;-case 0x10 :-//execute = FALSE;-if(SPI_CNT&(1<<11))-{-if(partie)-{-val = ((nds.touchY<<3)&0x7FF);-partie = 0;-//execute = FALSE;-break;-}-val = (nds.touchY>>5);- partie = 1;-break;-}-val = ((nds.touchY<<3)&0x7FF);-partie = 1;-break;-case 0x20 :-val = 0;-break;-case 0x30 :-val = 0;-break;-case 0x40 :-val = 0;-break;-case 0x50 :- if(spicnt & 0x800)-{-if(partie)-{-val = ((nds.touchX<<3)&0x7FF);-partie = 0;-break;-}-val = (nds.touchX>>5);-partie = 1;-break;-}-val = ((nds.touchX<<3)&0x7FF);-partie = 1;-break;-case 0x60 :-val = 0;-break;-case 0x70 :-val = 0;-break;-}-break;-- case 3 :-/* NOTICE: Device 3 of SPI is reserved (unused and unusable) */-break;-}-}--T1WriteWord(MMU.MMU_MEM[proc][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, val);-return;--/* NOTICE: Perhaps we have to use gbatek-like reg names instead of libnds-like ones ...*/-- case REG_DISPA_BG0CNT :-//GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 0, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x8, val);-return;- case REG_DISPA_BG1CNT :-//GPULOG("MAIN BG1 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 1, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xA, val);-return;- case REG_DISPA_BG2CNT :-//GPULOG("MAIN BG2 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 2, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xC, val);-return;- case REG_DISPA_BG3CNT :-//GPULOG("MAIN BG3 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 3, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xE, val);-return;- case REG_DISPB_BG0CNT :-//GPULOG("SUB BG0 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 0, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x1008, val);-return;- case REG_DISPB_BG1CNT :-//GPULOG("SUB BG1 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 1, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x100A, val);-return;- case REG_DISPB_BG2CNT :-//GPULOG("SUB BG2 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 2, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x100C, val);-return;- case REG_DISPB_BG3CNT :-//GPULOG("SUB BG3 SETPROP 16B %08X\r\n", val);-if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 3, val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x100E, val);-return;- case REG_IME : {- u32 old_val = MMU.reg_IME[proc];-u32 new_val = val & 1;-MMU.reg_IME[proc] = new_val;-T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x208, val);-if ( new_val && old_val != new_val) {- /* raise an interrupt request to the CPU if needed */- if ( MMU.reg_IE[proc] & MMU.reg_IF[proc]) {-if (proc==ARMCPU_ARM7)-{-NDS_ARM7.wIRQ = TRUE;-NDS_ARM7.waitIRQ = FALSE;-}-else-{-NDS_ARM9.wIRQ = TRUE;-NDS_ARM9.waitIRQ = FALSE;-}- }-}-return;-}-case REG_VRAMCNTA:-MMU_write8(proc,adr,val & 0xFF) ;-MMU_write8(proc,adr+1,val >> 8) ;-return ;-case REG_VRAMCNTC:-MMU_write8(proc,adr,val & 0xFF) ;-MMU_write8(proc,adr+1,val >> 8) ;-return ;-case REG_VRAMCNTE:-MMU_write8(proc,adr,val & 0xFF) ;-MMU_write8(proc,adr+1,val >> 8) ;-return ;-case REG_VRAMCNTG:-MMU_write8(proc,adr,val & 0xFF) ;-MMU_write8(proc,adr+1,val >> 8) ;-return ;-case REG_VRAMCNTI:-MMU_write8(proc,adr,val & 0xFF) ;-return ;--case REG_IE :-MMU.reg_IE[proc] = (MMU.reg_IE[proc]&0xFFFF0000) | val;-if ( MMU.reg_IME[proc]) {- /* raise an interrupt request to the CPU if needed */- if ( MMU.reg_IE[proc] & MMU.reg_IF[proc]) {-if (proc==ARMCPU_ARM7)-{-NDS_ARM7.wIRQ = TRUE;-NDS_ARM7.waitIRQ = FALSE;-}-else-{-NDS_ARM9.wIRQ = TRUE;-NDS_ARM9.waitIRQ = FALSE;-}- }-}-return;-case REG_IE + 2 :-//execute = FALSE;-MMU.reg_IE[proc] = (MMU.reg_IE[proc]&0xFFFF) | (((u32)val)<<16);-return;--case REG_IF :-//execute = FALSE;-//printlog("write16 (low): REG_IF (%X)\n", val);-MMU.reg_IF[proc] &= (~((u32)val)); -return;-case REG_IF + 2 :-//printlog("write16 (high): REG_IF (%X)\n", val);-//execute = FALSE;-MMU.reg_IF[proc] &= (~(((u32)val)<<16));-return;-- case REG_IPCSYNC :-{-//printlog("IPCSYNC\n");-u32 remote = (proc+1)&1;-u16 IPCSYNC_remote = T1ReadWord(MMU.MMU_MEM[remote][0x40], 0x180);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x180, (val&0xFFF0)|((IPCSYNC_remote>>8)&0xF));-T1WriteWord(MMU.MMU_MEM[remote][0x40], 0x180, (IPCSYNC_remote&0xFFF0)|((val>>8)&0xF));-MMU.reg_IF[remote] |= ((IPCSYNC_remote & (1<<14))<<2) & ((val & (1<<13))<<3);// & (MMU.reg_IME[remote] << 16);// & (MMU.reg_IE[remote] & (1<<16));// -//execute = FALSE;-}-return;--case REG_IPCFIFOCNT :-{-u32 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184) ;-u32 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184) ;--//printlog("write16 (%s): REG_IPCFIFOCNT 0x(%08X)\n", proc?"ARM9":"ARM7",REG_IPCFIFOCNT);-//printlog(" --- val=%X\n",val);--if ((val & 0x8000) && !(cnt_l & 0x8000))-{-/* this is the first init, the other side didnt init yet */-/* so do a complete init */-FIFOclear(MMU.fifos + proc);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184,0x8101) ;-/* and then handle it as usual */-}--if (val & 0x4008)// clear FIFO-{-FIFOclear(&MMU.fifos[proc]);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);-T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0xC507) | 0x100);-MMU.reg_IF[proc] |= ((val & 4)<<15);-//T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val);-return;-}-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l | (val & 0xBFF4));-}-return;- case REG_TM0CNTL :- case REG_TM1CNTL :- case REG_TM2CNTL :- case REG_TM3CNTL :-MMU.timerReload[proc][(adr>>2)&3] = val;-return;-case REG_TM0CNTH :-case REG_TM1CNTH :-case REG_TM2CNTH :-case REG_TM3CNTH :-{-int timerIndex= ((adr-2)>>2)&0x3;-int mask= ((val&0x80)>>7) << (timerIndex+(proc<<2));-MMU.CheckTimers = (MMU.CheckTimers & (~mask)) | mask;--if(val&0x80)-{-MMU.timer[proc][timerIndex] = MMU.timerReload[proc][((adr-2)>>2)&0x3];-}--MMU.timerON[proc][((adr-2)>>2)&0x3] = val & 0x80;--switch(val&7)-{-case 0 :-MMU.timerMODE[proc][timerIndex] = 0+1;//proc;-break;-case 1 :-MMU.timerMODE[proc][timerIndex] = 6+1;//proc; -break;-case 2 :-MMU.timerMODE[proc][timerIndex] = 8+1;//proc;-break;-case 3 :-MMU.timerMODE[proc][timerIndex] = 10+1;//proc;-break;-default :-MMU.timerMODE[proc][timerIndex] = 0xFFFF;-break;-}--if(!(val & 0x80))-MMU.timerRUN[proc][timerIndex] = FALSE;--T1WriteWord(MMU.MMU_MEM[proc][0x40], adr & 0xFFF, val);-return;-}--case REG_DISPA_DISPCNT+2 : -{-//execute = FALSE;-u32 v = (T1ReadLong(MMU.MMU_MEM[proc][0x40], 0) & 0xFFFF) | ((u32) val << 16);-GPU_setVideoProp(MainScreen.gpu, v);-T1WriteLong(MMU.MMU_MEM[proc][0x40], 0, v);-}-return;- case REG_DISPA_DISPCNT :-if(proc == ARMCPU_ARM9)-{-u32 v = (T1ReadLong(MMU.MMU_MEM[proc][0x40], 0) & 0xFFFF0000) | val;-GPU_setVideoProp(MainScreen.gpu, v);-T1WriteLong(MMU.MMU_MEM[proc][0x40], 0, v);-}-return;- case REG_DISPA_DISPCAPCNT :-if(proc == ARMCPU_ARM9)-{-GPU_set_DISPCAPCNT(MainScreen.gpu,val);-}-return;- case REG_DISPB_DISPCNT+2 : -if(proc == ARMCPU_ARM9)-{-//execute = FALSE;-u32 v = (T1ReadLong(MMU.MMU_MEM[proc][0x40], 0x1000) & 0xFFFF) | ((u32) val << 16);-GPU_setVideoProp(SubScreen.gpu, v);-T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x1000, v);-}-return;- case REG_DISPB_DISPCNT :-{-u32 v = (T1ReadLong(MMU.MMU_MEM[proc][0x40], 0x1000) & 0xFFFF0000) | val;-GPU_setVideoProp(SubScreen.gpu, v);-T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x1000, v);-}-return;-//case 0x020D8460 :-/*case 0x0235A904 :-LOG("ECRIRE %d %04X\r\n", proc, val);-execute = FALSE;*/- case REG_DMA0CNTH :-{- u32 v;--//if(val&0x8000) execute = FALSE;-//LOG("16 bit dma0 %04X\r\n", val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xBA, val);-DMASrc[proc][0] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB0);-DMADst[proc][0] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB4);- v = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB8);-MMU.DMAStartTime[proc][0] = (proc ? (v>>28) & 0x3 : (v>>27) & 0x7);-MMU.DMACrt[proc][0] = v;-if(MMU.DMAStartTime[proc][0] == 0)-MMU_doDMA(proc, 0);-#ifdef LOG_DMA2-//else-{-LOG("proc %d, dma %d src %08X dst %08X %s\r\n", proc, 0, DMASrc[proc][0], DMADst[proc][0], (val&(1<<25))?"ON":"OFF");-}-#endif-}-return;- case REG_DMA1CNTH :-{- u32 v;-//if(val&0x8000) execute = FALSE;-//LOG("16 bit dma1 %04X\r\n", val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xC6, val);-DMASrc[proc][1] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xBC);-DMASrc[proc][1] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xC0);- v = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xC4);-MMU.DMAStartTime[proc][1] = (proc ? (v>>28) & 0x3 : (v>>27) & 0x7);-MMU.DMACrt[proc][1] = v;-if(MMU.DMAStartTime[proc][1] == 0)-MMU_doDMA(proc, 1);-#ifdef LOG_DMA2-//else-{-LOG("proc %d, dma %d src %08X dst %08X %s\r\n", proc, 1, DMASrc[proc][1], DMADst[proc][1], (val&(1<<25))?"ON":"OFF");-}-#endif-}-return;- case REG_DMA2CNTH :-{- u32 v;-//if(val&0x8000) execute = FALSE;-//LOG("16 bit dma2 %04X\r\n", val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xD2, val);-DMASrc[proc][2] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xC8);-DMASrc[proc][2] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xCC);- v = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xD0);-MMU.DMAStartTime[proc][2] = (proc ? (v>>28) & 0x3 : (v>>27) & 0x7);-MMU.DMACrt[proc][2] = v;-if(MMU.DMAStartTime[proc][2] == 0)-MMU_doDMA(proc, 2);-#ifdef LOG_DMA2-//else-{-LOG("proc %d, dma %d src %08X dst %08X %s\r\n", proc, 2, DMASrc[proc][2], DMADst[proc][2], (val&(1<<25))?"ON":"OFF");-}-#endif-}-return;- case REG_DMA3CNTH :-{- u32 v;-//if(val&0x8000) execute = FALSE;-//LOG("16 bit dma3 %04X\r\n", val);-T1WriteWord(MMU.MMU_MEM[proc][0x40], 0xDE, val);-DMASrc[proc][3] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xD4);-DMASrc[proc][3] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xD8);- v = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xDC);-MMU.DMAStartTime[proc][3] = (proc ? (v>>28) & 0x3 : (v>>27) & 0x7);-MMU.DMACrt[proc][3] = v;--if(MMU.DMAStartTime[proc][3] == 0)-MMU_doDMA(proc, 3);-#ifdef LOG_DMA2-//else-{-LOG("proc %d, dma %d src %08X dst %08X %s\r\n", proc, 3, DMASrc[proc][3], DMADst[proc][3], (val&(1<<25))?"ON":"OFF");-}-#endif-}-return;- //case REG_AUXSPICNT : execute = FALSE;-default :-T1WriteWord(MMU.MMU_MEM[proc][0x40], adr&MMU.MMU_MASK[proc][adr>>20], val); -return;-}-}--// Removed the &0xFF as they are implicit with the adr&0x0FFFFFFFF [shash]-T1WriteWord(MMU.MMU_MEM[proc][adr>>20], adr&MMU.MMU_MASK[proc][adr>>20], val);-} ---template<u32 proc>-void FASTCALL _MMU_write32(u32 adr, u32 val)-{-#ifdef INTERNAL_DTCM_WRITE-if((proc==ARMCPU_ARM9)&((adr&(~0x3FFF))==MMU.DTCMRegion))-{-T1WriteLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF, val);-return ;-}-#endif-if(proc==ARMCPU_ARM9 && adr<0x02000000)-{-//printlog("MMU ITCM (32) Write %08X: %08X\n", adr, val);-T1WriteLong(ARM9Mem.ARM9_ITCM, adr&0x7FFF, val);-return ;-}--// CFlash writing, Mic-if ((adr>=0x9000000)&&(adr<0x9900000)) {- cflash_write(adr,val);- return;-}--adr &= 0x0FFFFFFF;-- // This is bad, remove it- if(proc == ARMCPU_ARM7)- {- if ((adr>=0x04000400)&&(adr<0x0400051D))- {- SPU_WriteLong(adr, val);- return;- }- }--if (adr & 0xFF800000 == 0x04800000) {-/* access to non regular hw registers */-/* return to not overwrite valid data */-return ;-}--if((adr>>24)==4)-{-if (adr >= 0x04000400 && adr < 0x04000440)-{-// Geometry commands (aka Dislay Lists) - Parameters:X-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x400>>2] = val;-if(proc==ARMCPU_ARM9)-{-gfx3d_glCallList(val);-}-}-else if(adr >= 0x04000380 && adr <= 0x040003BC)-{-//toon table-((u32 *)(MMU.MMU_MEM[proc][0x40]))[(adr-0x04000000)>>2] = val;-gfx3d_UpdateToonTable(&((MMU.MMU_MEM[proc][0x40]))[(0x380)]);-}-else switch(adr)-{-// Alpha test reference value - Parameters:1-case 0x04000340:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x340>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glAlphaFunc(val);-}-return;-}-// Clear background color setup - Parameters:2-case 0x04000350:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x350>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glClearColor(val);-}-return;-}-// Clear background depth setup - Parameters:2-case 0x04000354:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x354>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glClearDepth(val);-}-return;-}-// Fog Color - Parameters:4b-case 0x04000358:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x358>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glFogColor(val);-}-return;-}-case 0x0400035C:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x35C>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glFogOffset(val);-}-return;-}-// Matrix mode - Parameters:1-case 0x04000440:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x440>>2] = val;--if(proc == ARMCPU_ARM9)-{-gfx3d_glMatrixMode(val);-}-return;-}-// Push matrix - Parameters:0-case 0x04000444:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x444>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glPushMatrix();-}-return;-}-// Pop matrix/es - Parameters:1-case 0x04000448:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x448>>2] = val;-if(proc == ARMCPU_ARM9)-{-gfx3d_glPopMatrix(val);-}-return;-}-// Store matrix in the stack - Parameters:1-case 0x0400044C:-{-((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x44C>>2] = val;-if(proc == ARMCPU_ARM9... [truncated message content]

[Desmume-cvs] SF.net SVN: desmume:[1004] trunk/desmume/src

From: <ze...@us...> - 2008-09-26 06:24:47

Revision: 1004 Author: zeromusDate: 2008-09-26 06:24:36 +0000 (Fri, 26 Sep 2008)Log Message:------------ fix windows keyboard shortcuts and pause (recently broken)- maybe fix crashy savestates?- do a bunch of valgrinding to fix memory problems- add spu to savestate (still need to add mmu and fifos); tweak savestate variables a little bit.Modified Paths:-------------- trunk/desmume/src/GPU.cpp trunk/desmume/src/GPU_osd.cpp trunk/desmume/src/SPU.cpp trunk/desmume/src/SPU.h trunk/desmume/src/fs-linux.cpp trunk/desmume/src/gfx3d.cpp trunk/desmume/src/mc.cpp trunk/desmume/src/readwrite.cpp trunk/desmume/src/readwrite.h trunk/desmume/src/saves.cpp trunk/desmume/src/types.h trunk/desmume/src/windows/DeSmuME_2005.vcproj trunk/desmume/src/windows/main.cppModified: trunk/desmume/src/GPU.cpp===================================================================--- trunk/desmume/src/GPU.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/GPU.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -191,11 +191,7 @@ g->sprMem = ARM9Mem.ARM9_BOBJ; // GPU core B g->dispx_st = (REG_DISPx*)(&ARM9Mem.ARM9_REG[REG_DISPB]);-if (osdB==NULL) -{-delete osdB;-osdB=NULL;-}+delete osdB; osdB = new OSDCLASS(1); } else@@ -204,40 +200,19 @@ g->sprMem = ARM9Mem.ARM9_AOBJ; // GPU core A g->dispx_st = (REG_DISPx*)(&ARM9Mem.ARM9_REG[0]);--if (osdA==NULL) -{-delete osdA;-osdA=NULL;-}+delete osdA; osdA = new OSDCLASS(0); } -if (osd==NULL)-{-delete osd;-osd=NULL;-}+delete osd; osd = new OSDCLASS(-1); } void GPU_DeInit(GPU * gpu) {-if (osd==NULL) -{-delete osd;-osd=NULL;-}-if (osdA==NULL) -{-delete osdA;-osdA=NULL;-}-if (osdB==NULL) -{-delete osdB;-osdB=NULL;-}+delete osd; osd=NULL;+delete osdA; osdA=NULL;+delete osdB; osdB=NULL; free(gpu); } Modified: trunk/desmume/src/GPU_osd.cpp===================================================================--- trunk/desmume/src/GPU_osd.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/GPU_osd.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -70,7 +70,7 @@ { LOG("OSD_Deinit (%s)\n",name); -delete old_msg;+delete[] old_msg; } void OSDCLASS::setOffset(u16 ofs)@@ -155,6 +155,6 @@ x+=OSD_FONT_WIDTH+2; old_msg[i]=msg[i]; }-old_msg[512]=0;+old_msg[511]=0; needUpdate = true; }Modified: trunk/desmume/src/SPU.cpp===================================================================--- trunk/desmume/src/SPU.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/SPU.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -27,7 +27,7 @@ #include "MMU.h" #include "SPU.h" #include "mem.h"-+#include "readwrite.h" #include "armcpu.h" SPU_struct *SPU_core = 0;@@ -77,7 +77,7 @@ { int i; -delete SPU_user;+delete SPU_user; SPU_user = 0; // Make sure the old core is freed if (SNDCore)@@ -155,11 +155,6 @@ ////////////////////////////////////////////////////////////////////////////// -void SPU_struct::reset()-{-memset((void *)channels, 0, sizeof(channel_struct) * 16);-}- void SPU_Reset(void) { int i;@@ -167,12 +162,23 @@ SPU_core->reset(); if(SPU_user) SPU_user->reset(); +if(SNDCore && SPU_user) {+SNDCore->DeInit();+SNDCore->Init(SPU_user->bufsize*2);+//todo - check success?+}+ // Reset Registers for (i = 0x400; i < 0x51D; i++) T1WriteByte(MMU.ARM7_REG, i, 0); } -//////////////////////////////////////////////////////////////////////////////+void SPU_struct::reset()+{+memset((void *)channels, 0, sizeof(channel_struct) * 16);+memset(sndbuf,0,bufsize*2*4);+memset(outbuf,0,bufsize*2*2);+} SPU_struct::SPU_struct(int buffersize) : bufpos(0)@@ -181,11 +187,9 @@ , outbuf(0) , bufsize(buffersize) {-reset(); sndbuf = new s32[buffersize*2]; outbuf = new s16[buffersize*2];-memset(sndbuf,0,buffersize*2*4);-memset(outbuf,0,buffersize*2*2);+reset(); } SPU_struct::~SPU_struct()@@ -1207,6 +1211,9 @@ void SPU_Emulate_user() {+if(!SPU_user)+return;+ u32 audiosize; // Check to see how much free space there is@@ -1427,3 +1434,76 @@ ////////////////////////////////////////////////////////////////////////////// +void spu_savestate(std::ostream* os)+{+//version+write32le(0,os);++SPU_struct *spu = SPU_core;++for(int j=0;j<16;j++) {+channel_struct &chan = spu->channels[j];+write8le(chan.vol,os);+write8le(chan.datashift,os);+write8le(chan.hold,os);+write8le(chan.pan,os);+write8le(chan.waveduty,os);+write8le(chan.repeat,os);+write8le(chan.format,os);+write8le(chan.status,os);+write32le(chan.addr,os);+write16le(chan.timer,os);+write16le(chan.loopstart,os);+write32le(chan.length,os);+write64le(double_to_u64(chan.sampcnt),os);+write64le(double_to_u64(chan.sampinc),os);+write32le(chan.lastsampcnt,os);+write16le(chan.pcm16b,os);+write16le(chan.pcm16b_last,os);+write32le(chan.index,os);+}+}++bool spu_loadstate(std::istream* is)+{+//read version+int version;+if(read32le(&version,is) != 1) return false;+if(version != 0) return false;++SPU_struct *spu = SPU_core;++for(int j=0;j<16;j++) {+channel_struct &chan = spu->channels[j];+read8le(&chan.vol,is);+read8le(&chan.datashift,is);+read8le(&chan.hold,is);+read8le(&chan.pan,is);+read8le(&chan.waveduty,is);+read8le(&chan.repeat,is);+read8le(&chan.format,is);+read8le(&chan.status,is);+read32le(&chan.addr,is);+read16le(&chan.timer,is);+read16le(&chan.loopstart,is);+read32le(&chan.length,is);+u64 temp; +read64le(&temp,is); chan.sampcnt = u64_to_double(temp);+read64le(&temp,is); chan.sampinc = u64_to_double(temp);+read32le(&chan.lastsampcnt,is);+read16le(&chan.pcm16b,is);+read16le(&chan.pcm16b_last,is);+read32le(&chan.index,is);++//fixup the pointers which we had are supposed to keep cached+chan.buf8 = (s8*)&MMU.MMU_MEM[1][(chan.addr>>20)&0xFF][(chan.addr & MMU.MMU_MASK[1][(chan.addr >> 20) & 0xFF])];+chan.buf16 = (s16*)chan.buf8;+}++//copy the core spu (the more accurate) to the user spu+if(SPU_user) {+memcpy(SPU_core->channels,SPU_user->channels,sizeof(SPU_core->channels));+}++return true;+}\ No newline at end of fileModified: trunk/desmume/src/SPU.h===================================================================--- trunk/desmume/src/SPU.h2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/SPU.h2008-09-26 06:24:36 UTC (rev 1004)@@ -21,6 +21,7 @@ #define SPU_H #include "types.h"+#include <iosfwd> #define SNDCORE_DEFAULT -1 #define SNDCORE_DUMMY 0@@ -104,4 +105,7 @@ extern SPU_struct *SPU_core; extern int spu_core_samples; +void spu_savestate(std::ostream* os);+bool spu_loadstate(std::istream* is);+ #endifModified: trunk/desmume/src/fs-linux.cpp===================================================================--- trunk/desmume/src/fs-linux.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/fs-linux.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -100,9 +100,11 @@ } void FsClose(void * search) {-DIR * dir = ((FsLinuxDir *) search)->dir;+FsLinuxDir *linuxdir = (FsLinuxDir *) search; +DIR * dir = linuxdir->dir; closedir(dir);+free(linuxdir->path); free(search); } Modified: trunk/desmume/src/gfx3d.cpp===================================================================--- trunk/desmume/src/gfx3d.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/gfx3d.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -133,7 +133,7 @@ #define RENDER_BACK_SURFACE 0X40 -//-------------poly and vertex lists+//-------------poly and vertex lists and such things POLYLIST polylists[2]; POLYLIST* polylist = &polylists[0]; VERTLIST vertlists[2];@@ -154,6 +154,9 @@ vertlist->count = 0; } +static BOOL flushPending = FALSE;+static u32 flush_wbuffer;+static u32 flush_sortmode; //------------------------------------------------------------ static void makeTables() {@@ -187,6 +190,7 @@ { gfx3d = GFX3D(); +flushPending = FALSE; listTwiddle = 1; twiddleLists(); @@ -1355,14 +1359,9 @@ } } --static bool flushPending = false;-static u32 flush_wbuffer;-static u32 flush_sortmode;- void gfx3d_glFlush(unsigned long v) {-flushPending = true;+flushPending = TRUE; gfx3d.wbuffer = (v&1)!=0; gfx3d.sortmode = ((v>>1)&1)!=0; @@ -1399,7 +1398,7 @@ //the 3d buffers are swapped when a vblank begins. //so, if we have a redraw pending, now is a safe time to do it if(!flushPending) return;-flushPending = false;+flushPending = FALSE; gpu3D->NDS_3D_Render(); }@@ -1519,6 +1518,7 @@ { &dsEmission, 2|SS_RLSB, "GMEM" }, { &triStripToggle, 4|SS_RLSB, "GTST" }, { &listTwiddle, 4|SS_RLSB, "GLTW" },+{ &flushPending, 4|SS_RLSB, "GFLP" }, { &gfx3d.enableTexturing, 4|SS_RLSB, "GSET" }, { &gfx3d.enableAlphaTest, 4|SS_RLSB, "GSEA" }, { &gfx3d.enableAlphaBlending, 4|SS_RLSB, "GSEB" },Modified: trunk/desmume/src/mc.cpp===================================================================--- trunk/desmume/src/mc.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/mc.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -182,7 +182,7 @@ void mc_realloc(memory_chip_t *mc, int type, u32 size) {- if(mc->data) free(mc->data);+ if(mc->data) delete[] mc->data; mc_init(mc, type); mc_alloc(mc, size); }Modified: trunk/desmume/src/readwrite.cpp===================================================================--- trunk/desmume/src/readwrite.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/readwrite.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -1,6 +1,27 @@ #include "readwrite.h" #include "types.h" +//well. just for the sake of consistency+int write8le(u8 b, FILE *fp)+{+return((fwrite(&b,1,1,fp)<1)?0:1);+}++//well. just for the sake of consistency+int write8le(u8 b, std::ostream *os)+{+os->write((char*)&b,1);+return 1;+}++//well. just for the sake of consistency+int read8le(u8 *Bufo, std::istream *is)+{+if(is->read((char*)Bufo,1).gcount() != 1)+return 0;+return 1;+}+ ///writes a little endian 16bit value to the specified file int write16le(u16 b, FILE *fp) {@@ -10,6 +31,17 @@ return((fwrite(s,1,2,fp)<2)?0:2); } ++///writes a little endian 16bit value to the specified file+int write16le(u16 b, std::ostream *os)+{+u8 s[2];+s[0]=b;+s[1]=b>>8;+os->write((char*)&s,2);+return 2;+}+ ///writes a little endian 32bit value to the specified file int write32le(u32 b, FILE *fp) {@@ -89,7 +121,6 @@ return 1; } - int read32le(u32 *Bufo, std::istream *is) { u32 buf;Modified: trunk/desmume/src/readwrite.h===================================================================--- trunk/desmume/src/readwrite.h2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/readwrite.h2008-09-26 06:24:36 UTC (rev 1004)@@ -4,13 +4,20 @@ #include "types.h" #include <iostream> +//well. just for the sake of consistency+int write8le(u8 b, FILE *fp);+int write8le(u8 b, std::ostream *os); int write16le(u16 b, FILE *fp);+int write16le(u16 b, std::ostream* os); int write32le(u32 b, FILE *fp); int write32le(u32 b, std::ostream* os); int write64le(u64 b, std::ostream* os); int read64le(u64 *Bufo, std::istream *is); int read32le(u32 *Bufo, std::istream *is);+inline int read32le(int *Bufo, std::istream *is) { return read32le((u32*)Bufo,is); } int read32le(u32 *Bufo, FILE *fp); int read16le(u16 *Bufo, std::istream *is);+inline int read16le(s16 *Bufo, std::istream* is) { return read16le((u16*)Bufo,is); }+int read8le(u8 *Bufo, std::istream *is); #endifModified: trunk/desmume/src/saves.cpp===================================================================--- trunk/desmume/src/saves.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/saves.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -128,7 +128,12 @@ { ARM9Mem.ARM9_ITCM, 0x8000, "ITCM" }, { ARM9Mem.ARM9_DTCM, 0x4000, "DTCM" }, { ARM9Mem.MAIN_MEM, 0x400000, "WRAM" },-{ ARM9Mem.ARM9_REG, 0x10000, "9REG" },++//NOTE - this is not as large as the allocated memory.+//the memory is overlarge due to the way our memory map system is setup+//but there are actually no more registers than this+{ ARM9Mem.ARM9_REG, 0x2000, "9REG" }, + { ARM9Mem.ARM9_VMEM, 0x800, "VMEM" }, { ARM9Mem.ARM9_OAM, 0x800, "OAMS" }, { ARM9Mem.ARM9_ABG, 0x80000, "ABGM" },@@ -504,6 +509,7 @@ savestate_WriteChunk(os,3,SF_MEM); savestate_WriteChunk(os,4,SF_NDS); savestate_WriteChunk(os,5,gpu_savestate);+savestate_WriteChunk(os,7,spu_savestate); savestate_WriteChunk(os,60,SF_GFX3D); savestate_WriteChunk(os,61,gfx3d_savestate); savestate_WriteChunk(os,0xFFFFFFFF,(SFORMAT*)0);@@ -526,6 +532,7 @@ case 3: if(!ReadStateChunk(is,SF_MEM,size)) ret=false; break; case 4: if(!ReadStateChunk(is,SF_NDS,size)) ret=false; break; case 5: if(!gpu_loadstate(is)) ret=false; break;+case 7: if(!spu_loadstate(is)) ret=false; break; case 60: if(!ReadStateChunk(is,SF_GFX3D,size)) ret=false; break; case 61: if(!gfx3d_loadstate(is)) ret=false; break; default:@@ -591,6 +598,18 @@ is->read((char*)&buf[0],len); } +//GO!! READ THE SAVESTATE+//THERE IS NO GOING BACK NOW+//reset the emulator first to clean out the host's state+//NDS_Reset();+//************* OH NO **********************+//we arent saving something we need to!+//maybe MMU state or maybe FIFO+//I will have to look into this soon++//hack+SPU_Reset();+ memorystream mstemp(&buf); bool x = ReadStateChunks(&mstemp,(s32)len); Modified: trunk/desmume/src/types.h===================================================================--- trunk/desmume/src/types.h2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/types.h2008-09-26 06:24:36 UTC (rev 1004)@@ -228,5 +228,23 @@ #define printlog(X) ((void)(X)) #endif +inline u64 double_to_u64(double d) {+union {+u64 a;+double b;+} f*ckor;+f*ckor.b = d;+return f*ckor.a;+} +inline double u64_to_double(u64 u) {+union {+u64 a;+double b;+} f*ckor;+f*ckor.a = u;+return f*ckor.b;+}++ #endifModified: trunk/desmume/src/windows/DeSmuME_2005.vcproj===================================================================--- trunk/desmume/src/windows/DeSmuME_2005.vcproj2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/windows/DeSmuME_2005.vcproj2008-09-26 06:24:36 UTC (rev 1004)@@ -1024,10 +1024,6 @@ > </File> <File-RelativePath=".\NintendoDS(tm)_logo.bmp"->-</File>-<File RelativePath="..\OGLRender.cpp" > </File>Modified: trunk/desmume/src/windows/main.cpp===================================================================--- trunk/desmume/src/windows/main.cpp2008-09-25 07:44:18 UTC (rev 1003)+++ trunk/desmume/src/windows/main.cpp2008-09-26 06:24:36 UTC (rev 1004)@@ -104,6 +104,7 @@ //HWND hwnd; //HDC hdc;+HACCEL hAccel; HINSTANCE hAppInst; RECTMainWindowRect; @@ -667,12 +668,16 @@ void CheckMessages() { MSG msg;+HWND hwnd = MainWindow->getHWnd(); while( PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ) ) { if( GetMessage( &msg, 0, 0, 0)>0 ) {-TranslateMessage(&msg);-DispatchMessage(&msg);+if(!TranslateAccelerator(hwnd,hAccel,&msg))+{+TranslateMessage(&msg);+DispatchMessage(&msg);+} } } }@@ -749,9 +754,6 @@ DRV_AviSoundUpdate(SPU_core->outbuf,spu_core_samples); DRV_AviVideoUpdate((u16*)GPU_screen); - //check win32 messages- CheckMessages();- Input_Process(); Input_Post(); @@ -837,9 +839,13 @@ } frameCounter++; if (frameCounterDisplay) osd->addFixed(200, 30, "%d",frameCounter);++ CheckMessages(); }- paused = TRUE;- Sleep(500);+ + paused = TRUE;+ CheckMessages();+ Sleep(100); } if (lpDDClipPrimary!=NULL) IDirectDraw7_Release(lpDDClipPrimary); if (lpPrimarySurface != NULL) IDirectDraw7_Release(lpPrimarySurface);@@ -1014,7 +1020,6 @@ MSG messages; /* Here messages to the application are saved */ char text[80];- HACCEL hAccel; hAppInst=hThisInstance; init_configured_features( &my_config);@@ -1170,7 +1175,10 @@ sndcoretype = GetPrivateProfileInt("Sound","SoundCore", SNDCORE_DIRECTX, IniName); sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize", 735 * 4, IniName); - if (SPU_ChangeSoundCore(sndcoretype, sndbuffersize) != 0)+EnterCriticalSection(&win_sync);+ int spu_ret = SPU_ChangeSoundCore(sndcoretype, sndbuffersize);+LeaveCriticalSection(&win_sync);+if(spu_ret != 0) { MessageBox(MainWindow->getHWnd(),"Unable to initialize DirectSound","Error",MB_OK); return -1;@@ -2307,7 +2315,9 @@ sscanf(tempstr, "%d", &sndbuffersize); WritePrivateProfileString("Sound", "SoundBufferSize", tempstr, IniName); + EnterCriticalSection(&win_sync); SPU_ChangeSoundCore(sndcoretype, sndbuffersize);+ LeaveCriticalSection(&win_sync); // Write Volume sndvolume = SendDlgItemMessage(hDlg, IDC_SLVOLUME, TBM_GETPOS, 0, 0);This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1008] trunk/desmume/src

From: <ze...@us...> - 2008-09-28 22:05:00

Revision: 1008 Author: zeromusDate: 2008-09-28 22:04:24 +0000 (Sun, 28 Sep 2008)Log Message:-----------add some asserts to identify emulator bugs as a source of incompatibilityModified Paths:-------------- trunk/desmume/src/MMU.cpp trunk/desmume/src/MMU.h trunk/desmume/src/armcpu.cppModified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2008-09-28 04:48:46 UTC (rev 1007)+++ trunk/desmume/src/MMU.cpp2008-09-28 22:04:24 UTC (rev 1008)@@ -21,14 +21,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -//#define RENDER3D- #include <stdlib.h> #include <math.h> #include <string.h>+#include <assert.h> -//#include "gl_vertex.h"- #include "debug.h" #include "NDSSystem.h" #include "cflash.h"@@ -3573,12 +3570,14 @@ u32 FASTCALL MMU_read32(u32 proc, u32 adr) {+assert((adr&3)==0); if(proc==0) return _MMU_read32<0ul>(adr); else return _MMU_read32<1ul>(adr); } u16 FASTCALL MMU_read16(u32 proc, u32 adr) {+assert((adr&1)==0); if(proc==0) return _MMU_read16<0ul>(adr); else return _MMU_read16<1ul>(adr); }@@ -3591,12 +3590,14 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val) {+assert((adr&3)==0); if(proc==0) _MMU_write32<0ul>(adr,val); else _MMU_write32<1ul>(adr,val); } void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val) {+assert((adr&1)==0); if(proc==0) _MMU_write16<0ul>(adr,val); else _MMU_write16<1ul>(adr,val); }Modified: trunk/desmume/src/MMU.h===================================================================--- trunk/desmume/src/MMU.h2008-09-28 04:48:46 UTC (rev 1007)+++ trunk/desmume/src/MMU.h2008-09-28 22:04:24 UTC (rev 1008)@@ -60,6 +60,11 @@ //Unused ram u8 UNUSED_RAM[4];++//this is here so that we can trap glitchy emulator code+//which is accessing offsets 5,6,7 of unused ram due to unaligned accesses+//(also since the emulator doesn't prevent unaligned accesses)+u8 MORE_UNUSED_RAM[4]; u8 * * MMU_MEM[2]; u32 * MMU_MASK[2];Modified: trunk/desmume/src/armcpu.cpp===================================================================--- trunk/desmume/src/armcpu.cpp2008-09-28 04:48:46 UTC (rev 1007)+++ trunk/desmume/src/armcpu.cpp2008-09-28 22:04:24 UTC (rev 1008)@@ -19,13 +19,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <stdlib.h>+#include <stdio.h>+#include <assert.h> #include "arm_instructions.h" #include "thumb_instructions.h" #include "cp15.h" #include "bios.h"-#include <stdlib.h>-#include <stdio.h> + template<u32> static u32 armcpu_prefetch(); inline u32 armcpu_prefetch(armcpu_t *armcpu) { @@ -538,6 +540,8 @@ { u32 c = 1; +assert(ARMPROC.instruct_adr!=0x00000000);+ #ifdef GDB_STUB if (ARMPROC.stalled) return STALLED_CYCLE_COUNT;This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1011] trunk/desmume/src

From: <mta...@us...> - 2008-10-02 23:00:28

Revision: 1011 Author: mtabachenkoDate: 2008-10-02 22:56:06 +0000 (Thu, 02 Oct 2008)Log Message:------------ added for developers mmu debug;- fix Intel C++ project;- "printlog" is possibly corrected for other ports in a difference from Windows of port;Modified Paths:-------------- trunk/desmume/src/MMU.cpp trunk/desmume/src/debug.h trunk/desmume/src/windows/DeSmuME_Intel.icproj trunk/desmume/src/windows/console.hAdded Paths:----------- trunk/desmume/src/windows/DeSmuME_Intel.vcprojModified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2008-09-29 09:37:23 UTC (rev 1010)+++ trunk/desmume/src/MMU.cpp2008-10-02 22:56:06 UTC (rev 1011)@@ -39,6 +39,51 @@ #define ROM_MASK 3 +//#define_MMU_DEBUG++#ifdef _MMU_DEBUG+void mmu_log_debug(u32 adr, u8 proc, const char *fmt, ...)+{+if ((adr>=0x04000000 && adr<=0x04000800)+||(adr>=0x04100000 && adr<=0x04100010)+||(adr>=0x04800000 && adr<=0x04808000))+{+if (proc==ARMCPU_ARM9)+{+if (adr >= 0x4000000 && adr <= 0x400006C) return;// Display Engine A+if (adr >= 0x40000B0 && adr <= 0x4000132) return;// DMA, Timers and Keypad+if (adr >= 0x4000180 && adr <= 0x40001BA) return;// IPC/ROM+if (adr >= 0x4000204 && adr <= 0x4000249) return;// Memory & IRQ control+if (adr >= 0x4000280 && adr <= 0x4000304) return;// Maths+if (adr >= 0x4000320 && adr <= 0x40006A3) return;// 3D dispaly engine+if (adr >= 0x4100000 && adr <= 0x4100012) return;// IPC/ROM+}+else+{+if (adr >= 0x4000000 && adr <= 0x4000003) return;// ????+if (adr >= 0x4000004 && adr <= 0x40001C2) return;// ARM7 I/O Map+if (adr >= 0x4000204 && adr <= 0x4000308) return;// Memory and IRQ Control+if (adr >= 0x4000400 && adr <= 0x400051C) return;// Sound Registers+if (adr >= 0x4100000 && adr <= 0x4000010) return;// IPC/ROM+if (adr >= 0x4800000 && adr <= 0x4808000) return;// WLAN Registers+}++va_list list;+char msg[512];++memset(msg,0,512);++va_start(list,fmt);+_vsnprintf(msg,511,fmt,list);+va_end(list);++printlog("MMU ARM%s 0x%08X: %s\n",proc==ARMCPU_ARM9?"9":"7",adr, msg);+}+}+#else+#definemmu_log_debug(...)+#endif+ /* * */@@ -617,6 +662,8 @@ } #endif +mmu_log_debug(adr, proc, "read08");+ return MMU.MMU_MEM[proc][(adr>>20)&0xFF][adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF]]; } @@ -659,7 +706,7 @@ return (gfx3d_GetNumVertex()&8191); case REG_IPCFIFORECV : /* TODO (clear): ??? */-printlog("read16: IPCFIFORECV\n");+printlog("MMU read16: IPCFIFORECV\n"); //printlog("Stopped IPCFIFORECV\n"); execute = FALSE; return 1;@@ -673,10 +720,10 @@ return (u16)(MMU.reg_IE[proc]>>16); case REG_IF :-//printlog("read16 (low): REG_IF\n");+//printlog("MMU read16 (low): REG_IF\n"); return (u16)MMU.reg_IF[proc]; case REG_IF + 2 :-//printlog("read16 (high): REG_IF\n");+//printlog("MMU read16 (high): REG_IF\n"); return (u16)(MMU.reg_IF[proc]>>16); case REG_TM0CNTL :@@ -692,6 +739,7 @@ case REG_POSTFLG : return 1; default :+mmu_log_debug(adr, proc, "read16"); break; } }@@ -784,12 +832,12 @@ case REG_IE : return MMU.reg_IE[proc]; case REG_IF :-//printlog("read32: REG_IF\n");+//printlog("MMU read32: REG_IF\n"); return MMU.reg_IF[proc]; case REG_IPCFIFORECV : { u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);-//printlog("read32: REG_IPCFIFORECV (%X)\n", cnt_l);+//printlog("MMU read32: REG_IPCFIFORECV (%X)\n", cnt_l); if (!(cnt_l & 0x8000)) return 0;// FIFO disabled u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184); u32 val = FIFOget(MMU.fifos + proc);@@ -851,6 +899,7 @@ } default :+mmu_log_debug(adr, proc, "read32"); break; } }@@ -1247,6 +1296,7 @@ } default :+mmu_log_debug(adr, proc, "write08: value=0x%X\n", val); break; } @@ -1693,18 +1743,17 @@ case REG_IF : //execute = FALSE;-//printlog("write16 (low): REG_IF (%X)\n", val);+//printlog("MMU write16 (low): REG_IF (%X)\n", val); MMU.reg_IF[proc] &= (~((u32)val)); return; case REG_IF + 2 :-//printlog("write16 (high): REG_IF (%X)\n", val);+//printlog("MMU write16 (high): REG_IF (%X)\n", val); //execute = FALSE; MMU.reg_IF[proc] &= (~(((u32)val)<<16)); return; case REG_IPCSYNC : {-//printlog("IPCSYNC\n"); u32 remote = (proc+1)&1; u16 IPCSYNC_remote = T1ReadWord(MMU.MMU_MEM[remote][0x40], 0x180); T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x180, (val&0xFFF0)|((IPCSYNC_remote>>8)&0xF));@@ -1719,7 +1768,7 @@ u32 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184) ; u32 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184) ; -//printlog("write16 (%s): REG_IPCFIFOCNT 0x(%08X)\n", proc?"ARM9":"ARM7",REG_IPCFIFOCNT);+//printlog("MMU write16 (%s): REG_IPCFIFOCNT 0x(%08X)\n", proc?"ARM9":"ARM7",REG_IPCFIFOCNT); //printlog(" --- val=%X\n",val); if ((val & 0x8000) && !(cnt_l & 0x8000))@@ -1921,6 +1970,7 @@ return; //case REG_AUXSPICNT : execute = FALSE; default :+mmu_log_debug(adr, proc, "write16 value=0x%X\n", val); T1WriteWord(MMU.MMU_MEM[proc][0x40], adr&MMU.MMU_MASK[proc][adr>>20], val); return; }@@ -2384,7 +2434,7 @@ case 0x04000600:// Geometry Engine Status Register (R and R/W) {-//printlog("write32: Geometry Engine Status Register (R and R/W)");+//printlog("MMU write32: Geometry Engine Status Register (R and R/W)"); //printlog("------- val=%X\n\n************\n\n", val); MMU.fifos[proc].irq = (val>>30) & 0x03;@@ -2530,7 +2580,7 @@ return; case REG_IF :-//printlog("write32: REG_IF (%X)\n", val);+//printlog("MMU write32: REG_IF (%X)\n", val); MMU.reg_IF[proc] &= (~val); return; @@ -2574,6 +2624,7 @@ T1WriteLong(MMU.MMU_MEM[proc][0x40], adr & 0xFFF, val); return; }+ case REG_DIVDENOM : { u16 cnt;@@ -2726,6 +2777,7 @@ case REG_IPCSYNC : { //execute=FALSE;+printlog("MMU write 32 IPCSYNC\n"); u32 remote = (proc+1)&1; u32 IPCSYNC_remote = T1ReadLong(MMU.MMU_MEM[remote][0x40], 0x180); T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x180, (val&0xFFF0)|((IPCSYNC_remote>>8)&0xF));@@ -2756,7 +2808,7 @@ } T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val & 0xBFF4); #else-printlog("write32: REG_IPCFIFOCNT\n");+printlog("MMU write32: REG_IPCFIFOCNT\n"); #endif //execute = FALSE; return;@@ -2766,7 +2818,7 @@ u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184); if (!(cnt_l & 0x8000)) return;//FIFO disabled u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);-//printlog("write32 (%s): REG_IPCFIFOSEND (%X-%X) val=%X\n", proc?"ARM9":"ARM7",cnt_l,cnt_r,val);+//printlog("MMU write32 (%s): REG_IPCFIFOSEND (%X-%X) val=%X\n", proc?"ARM9":"ARM7",cnt_l,cnt_r,val); //FIFOadd(MMU.fifos+(proc^1), val); FIFOadd(MMU.fifos+(proc^1), val); cnt_l = (cnt_l & 0xFFFC) | (MMU.fifos[proc^1].full?0x0002:0);@@ -2963,13 +3015,14 @@ //Transfer starts at next frame. //Main Memory Display/Capture is supported for Display Engine A only. -printlog("write32: REG_DISPA_DISPMMEMFIFO\n");+printlog("MMU write32: REG_DISPA_DISPMMEMFIFO\n"); #endif break; } //case 0x21FDFF0 : if(val==0) execute = FALSE; //case 0x21FDFB0 : if(val==0) execute = FALSE; default :+mmu_log_debug(adr, proc, "write32: value=0x%X\n", val); T1WriteLong(MMU.MMU_MEM[proc][0x40], adr & MMU.MMU_MASK[proc][adr>>20], val); return; }Modified: trunk/desmume/src/debug.h===================================================================--- trunk/desmume/src/debug.h2008-09-29 09:37:23 UTC (rev 1010)+++ trunk/desmume/src/debug.h2008-10-02 22:56:06 UTC (rev 1011)@@ -27,6 +27,16 @@ #include "windows/console.h" #endif +#if defined(BETA_VERSION) && defined(WIN32)+void OpenConsole();+void CloseConsole();+void printlog(const char *fmt, ...);+#else+#define OpenConsole()+#define CloseConsole()+#define printlog(...)+#endif+ typedef enum { DEBUG_STRING, DEBUG_STREAM , DEBUG_STDOUT, DEBUG_STDERR } DebugOutType; typedef struct {Modified: trunk/desmume/src/windows/DeSmuME_Intel.icproj===================================================================--- trunk/desmume/src/windows/DeSmuME_Intel.icproj2008-09-29 09:37:23 UTC (rev 1010)+++ trunk/desmume/src/windows/DeSmuME_Intel.icproj2008-10-02 22:56:06 UTC (rev 1011)@@ -5,7 +5,7 @@ Name="DeSmuME_Intel" ProjectGUID="{F26376D4-B1A6-4ACC-9B2C-5CB92B9E7B80}" VCNestedProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"-VCNestedProjectCRC32="1511626194"+VCNestedProjectCRC32="4086597408" VCNestedProjectFileName="DeSmuME_Intel.vcproj"> <Platforms> <Platform @@ -42,7 +42,7 @@ Name="LinkerTool" OutputFile="$(OutDir)\$(ProjectName)_debug.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib"-AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib"+AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib" GenerateDebugInformation="1" GenerateMapFile="1" RandomizedBaseAddress="1"@@ -161,7 +161,7 @@ Name="LinkerTool" OutputFile="$(OutDir)\$(ProjectName)_sse2.exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib"-AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"+AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib" GenerateDebugInformation="1" RandomizedBaseAddress="1" DataExecutionPrevention="0"@@ -283,7 +283,7 @@ Name="LinkerTool" OutputFile="$(OutDir)\$(ProjectName).exe" AdditionalLibraryDirectories=".\zlib123;.\zziplib"-AdditionalDependencies="comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"+AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib" GenerateDebugInformation="1" RandomizedBaseAddress="1" DataExecutionPrevention="0"@@ -432,6 +432,8 @@ <File RelativePath="..\ROMReader.h"/> <File +RelativePath="..\rtc.h"/>+<File RelativePath="..\saves.h"/> <File RelativePath="..\SPU.h"/>@@ -490,8 +492,6 @@ <File RelativePath=".\DeSmuME.ico"/> <File -RelativePath=".\NintendoDS(tm)_logo.bmp"/>-<File RelativePath=".\resources.rc"/> <File RelativePath="..\arm_instructions.cpp"/>@@ -625,6 +625,8 @@ <File RelativePath="..\ROMReader.cpp"/> <File +RelativePath="..\rtc.cpp"/>+<File RelativePath="..\saves.cpp"/> <File RelativePath="..\SPU.cpp"/>@@ -635,6 +637,8 @@ <File RelativePath=".\AboutBox.cpp"/> <File +RelativePath=".\aviout.cpp"/>+<File RelativePath=".\colorctrl.cpp"/> <File RelativePath=".\ConfigKeys.cpp"/>Added: trunk/desmume/src/windows/DeSmuME_Intel.vcproj===================================================================--- trunk/desmume/src/windows/DeSmuME_Intel.vcproj (rev 0)+++ trunk/desmume/src/windows/DeSmuME_Intel.vcproj2008-10-02 22:56:06 UTC (rev 1011)@@ -0,0 +1,1132 @@+<?xml version="1.0" encoding="shift_jis"?>+<VisualStudioProject+ProjectType="Visual C++"+Version="9,00"+Name="DeSmuME_VS2008"+ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"+RootNamespace="DeSmuME"+TargetFrameworkVersion="131072"+>+<Platforms>+<Platform+Name="Win32"+/>+<Platform+Name="x64"+/>+</Platforms>+<ToolFiles>+<DefaultToolFile+FileName="masm.rules"+/>+</ToolFiles>+<Configurations>+<Configuration+Name="Debug|Win32"+OutputDirectory="$(SolutionDir)\__bins"+IntermediateDirectory="$(SolutionDir)\.Intel\$(ConfigurationName)\$(PlatformName)"+ConfigurationType="1"+InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+>+<Tool+Name="VCPreBuildEventTool"+/>+<Tool+Name="VCCustomBuildTool"+/>+<Tool+Name="MASM"+/>+<Tool+Name="VCXMLDataGeneratorTool"+/>+<Tool+Name="VCWebServiceProxyGeneratorTool"+/>+<Tool+Name="VCMIDLTool"+/>+<Tool+Name="VCCLCompilerTool"+Optimization="0"+InlineFunctionExpansion="0"+EnableIntrinsicFunctions="false"+FavorSizeOrSpeed="0"+EnableFiberSafeOptimizations="false"+WholeProgramOptimization="false"+AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG (Intel)\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"+ExceptionHandling="1"+BufferSecurityCheck="false"+EnableEnhancedInstructionSet="0"+DebugInformationFormat="4"+CallingConvention="1"+CompileAs="0"+/>+<Tool+Name="VCManagedResourceCompilerTool"+/>+<Tool+Name="VCResourceCompilerTool"+/>+<Tool+Name="VCPreLinkEventTool"+/>+<Tool+Name="VCLinkerTool"+AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"+OutputFile="$(OutDir)\$(ProjectName)_debug.exe"+AdditionalLibraryDirectories=".\zlib123;.\zziplib"+GenerateDebugInformation="true"+GenerateMapFile="true"+RandomizedBaseAddress="1"+DataExecutionPrevention="0"+/>+<Tool+Name="VCALinkTool"+/>+<Tool+Name="VCManifestTool"+AdditionalManifestFiles="DeSmuME_x86.manifest"+/>+<Tool+Name="VCXDCMakeTool"+/>+<Tool+Name="VCBscMakeTool"+/>+<Tool+Name="VCFxCopTool"+/>+<Tool+Name="VCAppVerifierTool"+/>+<Tool+Name="VCPostBuildEventTool"+/>+</Configuration>+<Configuration+Name="Debug|x64"+OutputDirectory="$(SolutionDir)\__bins"+IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"+ConfigurationType="1"+InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+>+<Tool+Name="VCPreBuildEventTool"+/>+<Tool+Name="VCCustomBuildTool"+/>+<Tool+Name="MASM"+/>+<Tool+Name="VCXMLDataGeneratorTool"+/>+<Tool+Name="VCWebServiceProxyGeneratorTool"+/>+<Tool+Name="VCMIDLTool"+TargetEnvironment="3"+/>+<Tool+Name="VCCLCompilerTool"+Optimization="0"+InlineFunctionExpansion="0"+EnableIntrinsicFunctions="false"+FavorSizeOrSpeed="0"+EnableFiberSafeOptimizations="false"+WholeProgramOptimization="false"+AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 DEBUG\&quot;;WIN32;_x64;BETA_VERSION;SPU_INTERPOLATE"+ExceptionHandling="1"+BufferSecurityCheck="false"+EnableEnhancedInstructionSet="0"+DebugInformationFormat="3"+CallingConvention="1"+CompileAs="0"+/>+<Tool+Name="VCManagedResourceCompilerTool"+/>+<Tool+Name="VCResourceCompilerTool"+/>+<Tool+Name="VCPreLinkEventTool"+/>+<Tool+Name="VCLinkerTool"+AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib"+OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"+AdditionalLibraryDirectories=".\zlib123;.\zziplib"+GenerateDebugInformation="true"+GenerateMapFile="true"+RandomizedBaseAddress="1"+DataExecutionPrevention="0"+TargetMachine="17"+/>+<Tool+Name="VCALinkTool"+/>+<Tool+Name="VCManifestTool"+AdditionalManifestFiles="DeSmuME_x64.manifest"+/>+<Tool+Name="VCXDCMakeTool"+/>+<Tool+Name="VCBscMakeTool"+/>+<Tool+Name="VCFxCopTool"+/>+<Tool+Name="VCAppVerifierTool"+/>+<Tool+Name="VCPostBuildEventTool"+/>+</Configuration>+<Configuration+Name="Release (SSE2)|Win32"+OutputDirectory="$(SolutionDir)\__bins"+IntermediateDirectory="$(SolutionDir)\.Intel\$(ConfigurationName)\$(PlatformName)"+ConfigurationType="1"+InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+WholeProgramOptimization="1"+>+<Tool+Name="VCPreBuildEventTool"+/>+<Tool+Name="VCCustomBuildTool"+/>+<Tool+Name="MASM"+/>+<Tool+Name="VCXMLDataGeneratorTool"+/>+<Tool+Name="VCWebServiceProxyGeneratorTool"+/>+<Tool+Name="VCMIDLTool"+/>+<Tool+Name="VCCLCompilerTool"+Optimization="2"+InlineFunctionExpansion="2"+EnableIntrinsicFunctions="false"+FavorSizeOrSpeed="1"+OmitFramePointers="true"+EnableFiberSafeOptimizations="true"+WholeProgramOptimization="true"+AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;SSE2 (Intel)\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"+StringPooling="true"+ExceptionHandling="1"+BufferSecurityCheck="false"+EnableEnhancedInstructionSet="0"+FloatingPointModel="2"+WarningLevel="1"+DebugInformationFormat="3"+CallingConvention="1"+CompileAs="0"+/>+<Tool+Name="VCManagedResourceCompilerTool"+/>+<Tool+Name="VCResourceCompilerTool"+/>+<Tool+Name="VCPreLinkEventTool"+/>+<Tool+Name="VCLinkerTool"+AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"+OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"+AdditionalLibraryDirectories=".\zlib123;.\zziplib"+GenerateDebugInformation="true"+RandomizedBaseAddress="1"+DataExecutionPrevention="0"+TargetMachine="1"+Profile="false"+/>+<Tool+Name="VCALinkTool"+/>+<Tool+Name="VCManifestTool"+AdditionalManifestFiles="DeSmuME_x86.manifest"+/>+<Tool+Name="VCXDCMakeTool"+/>+<Tool+Name="VCBscMakeTool"+/>+<Tool+Name="VCFxCopTool"+/>+<Tool+Name="VCAppVerifierTool"+/>+<Tool+Name="VCPostBuildEventTool"+/>+</Configuration>+<Configuration+Name="Release (SSE2)|x64"+OutputDirectory="$(SolutionDir)\__bins"+IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"+ConfigurationType="1"+InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+>+<Tool+Name="VCPreBuildEventTool"+/>+<Tool+Name="VCCustomBuildTool"+/>+<Tool+Name="MASM"+/>+<Tool+Name="VCXMLDataGeneratorTool"+/>+<Tool+Name="VCWebServiceProxyGeneratorTool"+/>+<Tool+Name="VCMIDLTool"+TargetEnvironment="3"+/>+<Tool+Name="VCCLCompilerTool"+Optimization="2"+InlineFunctionExpansion="2"+EnableIntrinsicFunctions="true"+FavorSizeOrSpeed="1"+EnableFiberSafeOptimizations="true"+WholeProgramOptimization="true"+AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE"+ExceptionHandling="1"+BufferSecurityCheck="false"+EnableEnhancedInstructionSet="0"+WarningLevel="1"+DebugInformationFormat="3"+CallingConvention="1"+CompileAs="0"+/>+<Tool+Name="VCManagedResourceCompilerTool"+/>+<Tool+Name="VCResourceCompilerTool"+/>+<Tool+Name="VCPreLinkEventTool"+/>+<Tool+Name="VCLinkerTool"+AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x64.lib zziplib-2008-x64.lib"+OutputFile="$(OutDir)\$(ProjectName)_x64_sse2.exe"+AdditionalLibraryDirectories=".\zlib123;.\zziplib"+GenerateDebugInformation="true"+RandomizedBaseAddress="1"+DataExecutionPrevention="0"+TargetMachine="17"+Profile="true"+/>+<Tool+Name="VCALinkTool"+/>+<Tool+Name="VCManifestTool"+AdditionalManifestFiles="DeSmuME_x64.manifest"+/>+<Tool+Name="VCXDCMakeTool"+/>+<Tool+Name="VCBscMakeTool"+/>+<Tool+Name="VCFxCopTool"+/>+<Tool+Name="VCAppVerifierTool"+/>+<Tool+Name="VCPostBuildEventTool"+/>+</Configuration>+<Configuration+Name="Release|Win32"+OutputDirectory="$(SolutionDir)\__bins"+IntermediateDirectory="$(SolutionDir)\.Intel\$(ConfigurationName)\$(PlatformName)"+ConfigurationType="1"+InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+WholeProgramOptimization="1"+>+<Tool+Name="VCPreBuildEventTool"+/>+<Tool+Name="VCCustomBuildTool"+/>+<Tool+Name="MASM"+/>+<Tool+Name="VCXMLDataGeneratorTool"+/>+<Tool+Name="VCWebServiceProxyGeneratorTool"+/>+<Tool+Name="VCMIDLTool"+/>+<Tool+Name="VCCLCompilerTool"+Optimization="2"+InlineFunctionExpansion="2"+EnableIntrinsicFunctions="true"+FavorSizeOrSpeed="1"+OmitFramePointers="true"+EnableFiberSafeOptimizations="true"+WholeProgramOptimization="true"+AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;(Intel)\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"+StringPooling="true"+ExceptionHandling="1"+BufferSecurityCheck="false"+EnableEnhancedInstructionSet="2"+FloatingPointModel="2"+WarningLevel="1"+DebugInformationFormat="3"+CallingConvention="1"+CompileAs="0"+/>+<Tool+Name="VCManagedResourceCompilerTool"+/>+<Tool+Name="VCResourceCompilerTool"+/>+<Tool+Name="VCPreLinkEventTool"+/>+<Tool+Name="VCLinkerTool"+AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"+OutputFile="$(OutDir)\$(ProjectName).exe"+AdditionalLibraryDirectories=".\zlib123;.\zziplib"+GenerateDebugInformation="true"+RandomizedBaseAddress="1"+DataExecutionPrevention="0"+TargetMachine="1"+Profile="true"+/>+<Tool+Name="VCALinkTool"+/>+<Tool+Name="VCManifestTool"+AdditionalManifestFiles="DeSmuME_x86.manifest"+/>+<Tool+Name="VCXDCMakeTool"+/>+<Tool+Name="VCBscMakeTool"+/>+<Tool+Name="VCFxCopTool"+/>+<Tool+Name="VCAppVerifierTool"+/>+<Tool+Name="VCPostBuildEventTool"+/>+</Configuration>+<Configuration+Name="Release|x64"+OutputDirectory="$(SolutionDir)\__bins"+IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"+ConfigurationType="1"+InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"+>+<Tool+Name="VCPreBuildEventTool"+/>+<Tool+Name="VCCustomBuildTool"+/>+<Tool+Name="MASM"+/>+<Tool+Name="VCXMLDataGeneratorTool"+/>+<Tool+Name="VCWebServiceProxyGeneratorTool"+/>+<Tool+Name="VCMIDLTool"+TargetEnvironment="3"+/>+<Tool+Name="VCCLCompilerTool"+Optimization="2"+InlineFunctionExpansion="2"+EnableIntrinsicFunctions="true"+FavorSizeOrSpeed="1"+EnableFiberSafeOptimizations="true"+WholeProgramOptimization="true"+AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;x64 SSE2\&quot;;WIN32;_x64;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE"+ExceptionHandling="1"+BufferSecurityCheck="false"+EnableEnhancedInstructionSet="0"+WarningLevel="1"+DebugInformationFormat="3"+CallingConvention="1"+CompileAs="0"+/>+<Tool+Name="VCManagedResourceCompilerTool"+/>+<Tool+Name="VCResourceCompilerTool"+/>+<Tool+Name="VCPreLinkEventTool"+/>+<Tool+Name="VCLinkerTool"+AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr.lib dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x64.lib zziplib-2008-x64.lib"+OutputFile="$(OutDir)\$(ProjectName)_x64_sse2.exe"+AdditionalLibraryDirectories=".\zlib123;.\zziplib"+GenerateDebugInformation="true"+RandomizedBaseAddress="1"+DataExecutionPrevention="0"+TargetMachine="17"+Profile="true"+/>+<Tool+Name="VCALinkTool"+/>+<Tool+Name="VCManifestTool"+AdditionalManifestFiles="DeSmuME_x64.manifest"+/>+<Tool+Name="VCXDCMakeTool"+/>+<Tool+Name="VCBscMakeTool"+/>+<Tool+Name="VCFxCopTool"+/>+<Tool+Name="VCAppVerifierTool"+/>+<Tool+Name="VCPostBuildEventTool"+/>+</Configuration>+</Configurations>+<References>+</References>+<Files>+<Filter+Name="Source Files"+Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"+UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"+>+<Filter+Name="core"+>+<File+RelativePath="..\arm_instructions.cpp"+>+</File>+<File+RelativePath="..\armcpu.cpp"+>+</File>+<File+RelativePath="..\bios.cpp"+>+</File>+<File+RelativePath="..\cflash.cpp"+>+</File>+<File+RelativePath="..\common.cpp"+>+</File>+<File+RelativePath="..\cp15.cpp"+>+</File>+<File+RelativePath="..\debug.cpp"+>+</File>+<File+RelativePath="..\Disassembler.cpp"+>+</File>+<File+RelativePath="..\FIFO.cpp"+>+</File>+<File+RelativePath="..\gfx3d.cpp"+>+</File>+<File+RelativePath="..\gl_vertex.cpp"+>+</File>+<File+RelativePath="..\GPU.cpp"+>+</File>+<File+RelativePath="..\GPU_OSD.cpp"+>+</File>+<File+RelativePath="..\matrix.cpp"+>+</File>+<File+RelativePath="..\matrix_sse2-x64.asm"+>+<FileConfiguration+Name="Debug|Win32"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+<FileConfiguration+Name="Debug|x64"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+<FileConfiguration+Name="Release (SSE2)|Win32"+ExcludedFromBuild="true"+>+<Tool+Name="VCCustomBuildTool"+Description="Assembling..."+CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"+Outputs="$(IntDir)\$(InputName).obj"+/>+</FileConfiguration>+<FileConfiguration+Name="Release (SSE2)|x64"+>+<Tool+Name="VCCustomBuildTool"+Description="Assembling..."+CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"+Outputs="$(IntDir)\$(InputName).obj"+/>+</FileConfiguration>+<FileConfiguration+Name="Release|Win32"+ExcludedFromBuild="true"+>+<Tool+Name="VCCustomBuildTool"+Description="Assembling..."+CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"+Outputs="$(IntDir)\$(InputName).obj"+/>+</FileConfiguration>+<FileConfiguration+Name="Release|x64"+ExcludedFromBuild="true"+>+<Tool+Name="VCCustomBuildTool"+Description="Assembling..."+CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"+Outputs="$(IntDir)\$(InputName).obj"+/>+</FileConfiguration>+</File>+<File+RelativePath="..\matrix_sse2-x86.asm"+>+<FileConfiguration+Name="Debug|Win32"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+<FileConfiguration+Name="Debug|x64"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+<FileConfiguration+Name="Release (SSE2)|x64"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+<FileConfiguration+Name="Release|Win32"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+<FileConfiguration+Name="Release|x64"+ExcludedFromBuild="true"+>+<Tool+Name="MASM"+/>+</FileConfiguration>+</File>+<File+RelativePath="..\mc.cpp"+>+</File>+<File+RelativePath="..\MMU.cpp"+>+</File>+<File+RelativePath="..\NDSSystem.cpp"+>+</File>+<File+RelativePath="..\OGLRender.cpp"+>+</File>+<File+RelativePath="..\readwrite.cpp"+>+</File>+<File+RelativePath="..\render3D.cpp"+>+</File>+<File+RelativePath="..\ROMReader.cpp"+>+</File>+<File+RelativePath="..\rtc.cpp"+>+</File>+<File+RelativePath="..\saves.cpp"+>+</File>+<File+RelativePath="..\SPU.cpp"+>+</File>+<File+RelativePath="..\thumb_instructions.cpp"+>+</File>+<File+RelativePath="..\wifi.cpp"+>+</File>+</Filter>+<Filter+Name="windows"+>+<File+RelativePath=".\AboutBox.cpp"+>+</File>+<File+RelativePath=".\aviout.cpp"+>+</File>+<File+RelativePath=".\colorctrl.cpp"+>+</File>+<File+RelativePath=".\ConfigKeys.cpp"+>+</File>+<File+RelativePath=".\console.cpp"+>+</File>+<File+RelativePath=".\CWindow.cpp"+>+</File>+<File+RelativePath=".\disView.cpp"+>+</File>+<File+RelativePath=".\FirmConfig.cpp"+>+</File>+<File+RelativePath=".\fs-windows.cpp"+>+</File>+<File+RelativePath=".\ginfo.cpp"+>+</File>+<File+RelativePath=".\IORegView.cpp"+>+</File>+<File+RelativePath=".\lightView.cpp"+>+</File>+<File+RelativePath=".\main.cpp"+>+</File>+<File+RelativePath=".\mapView.cpp"+>+</File>+<File+RelativePath=".\matrixView.cpp"+>+</File>+<File+RelativePath=".\memView.cpp"+>+</File>+<File+RelativePath=".\oamView.cpp"+>+</File>+<File+RelativePath=".\ogl.cpp"+>+</File>+<File+RelativePath=".\palView.cpp"+>+</File>+<File+RelativePath=".\snddx.cpp"+>+</File>+<File+RelativePath=".\throttle.cpp"+>+</File>+<File+RelativePath=".\tileView.cpp"+>+</File>+</Filter>+</Filter>+<Filter+Name="Header Files"+Filter="h;hpp;hxx;hm;inl;inc;xsd"+UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"+>+<File+RelativePath="..\font_eng.inc"+>+</File>+<File+RelativePath="..\instruction_tabdef.inc"+>+</File>+<File+RelativePath="..\thumb_tabdef.inc"+>+</File>+<Filter+Name="windows"+>+<File+RelativePath=".\AboutBox.h"+>+</File>+<File+RelativePath=".\colorconv.h"+>+</File>+<File+RelativePath=".\colorctrl.h"+>+</File>+<File+RelativePath=".\ConfigKeys.h"+>+</File>+<File+RelativePath=".\console.h"+>+</File>+<File+RelativePath=".\CWindow.h"+>+</File>+<File+RelativePath=".\disView.h"+>+</File>+<File+RelativePath=".\FirmConfig.h"+>+</File>+<File+RelativePath=".\ginfo.h"+>+</File>+<File+RelativePath=".\IORegView.h"+>+</File>+<File+RelativePath=".\lightView.h"+>+</File>+<File+RelativePath=".\mapView.h"+>+</File>+<File+RelativePath=".\matrixView.h"+>+</File>+<File+RelativePath=".\memView.h"+>+</File>+<File+RelativePath=".\oamView.h"+>+</File>+<File+RelativePath=".\palView.h"+>+</File>+<File+RelativePath=".\resource.h"+>+</File>+<File+RelativePath=".\snddx.h"+>+</File>+<File+RelativePath=".\throttle.h"+>+</File>+<File+RelativePath=".\tileView.h"+>+</File>+</Filter>+<Filter+Name="core"+>+<File+RelativePath="..\ARM9.h"+>+</File>+<File+RelativePath="..\arm_instructions.h"+>+</File>+<File+RelativePath="..\armcpu.h"+>+</File>+<File+RelativePath="..\bios.h"+>+</File>+<File+RelativePath="..\bits.h"+>+</File>+<File+RelativePath="..\cflash.h"+>+</File>+<File+RelativePath="..\common.h"+>+</File>+<File+RelativePath="..\cp15.h"+>+</File>+<File+RelativePath="..\debug.h"+>+</File>+<File+RelativePath="..\Disassembler.h"+>+</File>+<File+RelativePath="..\dscard.h"+>+</File>+<File+RelativePath="..\fat.h"+>+</File>+<File+RelativePath="..\FIFO.h"+>+</File>+<File+RelativePath="..\fs.h"+>+</File>+<File+RelativePath="..\gdbstub.h"+>+</File>+<File+RelativePath="..\gfx3d.h"+>+</File>+<File+RelativePath="..\gl_vertex.h"+>+</File>+<File+RelativePath="..\GPU.h"+>+</File>+<File+RelativePath="..\GPU_osd.h"+>+</File>+<File+RelativePath="..\matrix.h"+>+</File>+<File+RelativePath="..\mc.h"+>+</File>+<File+RelativePath="..\mem.h"+>+</File>+<File+RelativePath="..\memorystream.h"+>+</File>+<File+RelativePath="..\MMU.h"+>+</File>+<File+RelativePath="..\NDSSystem.h"+>+</File>+<File+RelativePath="..\OGLRender.h"+>+</File>+<File+RelativePath="..\readwrite.h"+>+</File>+<File+RelativePath="..\registers.h"+>+</File>+<File+RelativePath="..\render3D.h"+>+</File>+<File+RelativePath="..\ROMReader.h"+>+</File>+<File+RelativePath="..\rtc.h"+>+</File>+<File+RelativePath="..\saves.h"+>+</File>+<File+RelativePath="..\SPU.h"+>+</File>+<File+RelativePath="..\thumb_instructions.h"+>+</File>+<File+RelativePath="..\types.h"+>+</File>+<File+RelativePath="..\wifi.h"+>+</File>+</Filter>+</Filter>+<Filter+Name="Resource Files"+Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"+UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"+>+<File+RelativePath=".\DeSmuME.ico"+>+</File>+<File+RelativePath=".\resources.rc"+>+</File>+</Filter>+</Files>+<Globals>+</Globals>+</VisualStudioProject>Modified: trunk/desmume/src/windows/console.h===================================================================--- trunk/desmume/src/windows/console.h2008-09-29 09:37:23 UTC (rev 1010)+++ trunk/desmume/src/windows/console.h2008-10-02 22:56:06 UTC (rev 1011)@@ -24,14 +24,6 @@ #define _CONSOLE_H_ #include <windows.h> #include <stdio.h>+#include "debug.h" -#ifdef BETA_VERSION-void OpenConsole();-void CloseConsole();-void printlog(const char *fmt, ...);-#else-#define OpenConsole()-#define CloseConsole()-#define printlog(...)-#endif #endif\ No newline at end of fileThis was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1006] trunk/desmume/src

From: <ze...@us...> - 2008-09-27 06:53:09

Revision: 1006 Author: zeromusDate: 2008-09-27 06:52:33 +0000 (Sat, 27 Sep 2008)Log Message:------------ add mmu to savestate.- totally change how the savestates work in order to fix a bug in the gfx3d savestate. your old savestates are definitely invalidated.- rename adress to address everywhere.Modified Paths:-------------- trunk/desmume/src/GPU.cpp trunk/desmume/src/MMU.cpp trunk/desmume/src/MMU.h trunk/desmume/src/SPU.cpp trunk/desmume/src/dscard.h trunk/desmume/src/gfx3d.cpp trunk/desmume/src/saves.cpp trunk/desmume/src/saves.hModified: trunk/desmume/src/GPU.cpp===================================================================--- trunk/desmume/src/GPU.cpp2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/GPU.cpp2008-09-27 06:52:33 UTC (rev 1006)@@ -2011,6 +2011,7 @@ /* initialize the scanline black */ /* not doing this causes invalid colors when all active BGs are prevented to draw at some place */+//ZERO TODO - shouldnt this be BG palette color 0? memset(dst,0,256*2) ; // This could almost be changed to use function pointersModified: trunk/desmume/src/MMU.cpp===================================================================--- trunk/desmume/src/MMU.cpp2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/MMU.cpp2008-09-27 06:52:33 UTC (rev 1006)@@ -647,7 +647,7 @@ if(adr&0x04000000) {-/* Adress is an IO register */+/* Address is an IO register */ switch(adr) { case 0x04000604:@@ -721,7 +721,7 @@ if((adr >> 24) == 4) {-/* Adress is an IO register */+/* Address is an IO register */ switch(adr) { // This is hacked due to the only current 3D core@@ -826,10 +826,10 @@ { u32 val=0; - if(MMU.dscard[proc].adress)-val = T1ReadLong(MMU.CART_ROM, MMU.dscard[proc].adress);+ if(MMU.dscard[proc].address)+val = T1ReadLong(MMU.CART_ROM, MMU.dscard[proc].address); -MMU.dscard[proc].adress += 4;/* increment adress */+MMU.dscard[proc].address += 4;/* increment address */ MMU.dscard[proc].transfer_count--;/* update transfer counter */ if(MMU.dscard[proc].transfer_count) /* if transfer is not ended */@@ -1306,7 +1306,7 @@ ((u16 *)(MMU.MMU_MEM[proc][0x40]))[(adr-0x04000000)>>1] = val; gfx3d_UpdateToonTable(&((MMU.MMU_MEM[proc][0x40]))[(0x380)]); }-/* Adress is an IO register */+/* Address is an IO register */ else switch(adr) { case 0x0400035C:@@ -2843,7 +2843,7 @@ if(MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT) == 0xB7) {- MMU.dscard[proc].adress = (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+1) << 24) | (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+2) << 16) | (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+3) << 8) | (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+4));+ MMU.dscard[proc].address = (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+1) << 24) | (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+2) << 16) | (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+3) << 8) | (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT+4)); MMU.dscard[proc].transfer_count = 0x80;// * ((val>>24)&7)); } else if (MEM_8(MMU.MMU_MEM[proc], REG_GCCMDOUT) == 0xB8)@@ -2851,7 +2851,7 @@ // Get ROM chip ID val |= 0x800000; // Data-Word Status T1WriteLong(MMU.MMU_MEM[proc][(REG_GCROMCTRL >> 20) & 0xff], REG_GCROMCTRL & 0xfff, val);- MMU.dscard[proc].adress = 0;+ MMU.dscard[proc].address = 0; } else {@@ -2861,7 +2861,7 @@ //CARDLOG("%08X : %08X %08X\r\n", adr, val, adresse[proc]); val |= 0x00800000; -if(MMU.dscard[proc].adress == 0)+if(MMU.dscard[proc].address == 0) { val &= ~0x80000000; T1WriteLong(MMU.MMU_MEM[proc][(REG_GCROMCTRL >> 20) & 0xff], REG_GCROMCTRL & 0xfff, val);Modified: trunk/desmume/src/MMU.h===================================================================--- trunk/desmume/src/MMU.h2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/MMU.h2008-09-27 06:52:33 UTC (rev 1006)@@ -33,7 +33,7 @@ extern char szRomPath[512]; extern char szRomBaseName[512]; -/* theses macros are designed for reading/writing in memory (m is a pointer to memory, like MMU.MMU_MEM[proc], and a is an adress, like 0x04000000 */+/* theses macros are designed for reading/writing in memory (m is a pointer to memory, like MMU.MMU_MEM[proc], and a is an address, like 0x04000000 */ #define MEM_8(m, a) (((u8*)(m[((a)>>20)&0xff]))[((a)&0xfff)]) /* theses ones for reading in rom data */@@ -43,61 +43,60 @@ //#define MAIN_MEMORY_DISP_FIFO 2 typedef struct {- //ARM7 mem- u8 ARM7_BIOS[0x4000];- u8 ARM7_ERAM[0x10000];- u8 ARM7_REG[0x10000];- u8 ARM7_WIRAM[0x10000];+ //ARM7 mem+ u8 ARM7_BIOS[0x4000];+ u8 ARM7_ERAM[0x10000];+ u8 ARM7_REG[0x10000];+ u8 ARM7_WIRAM[0x10000]; u8 vram_mode[9];-u8 vScreen; - //Shared ram- u8 SWIRAM[0x8000];- - //Card rom & ram- u8 * CART_ROM;- u8 CART_RAM[0x10000];+ //Shared ram+ u8 SWIRAM[0x8000];+ + //Card rom & ram+ u8 * CART_ROM;+ u8 CART_RAM[0x10000]; //Unused ram u8 UNUSED_RAM[4]; - u8 * * MMU_MEM[2];- u32 * MMU_MASK[2];- - u8 ARM9_RW_MODE;+ u8 * * MMU_MEM[2];+ u32 * MMU_MASK[2];+ + u8 ARM9_RW_MODE; -FIFOfifos[2];// 0 - ARM9 FIFO-// 1 - ARM7 FIFO+FIFOfifos[2];// 0 - ARM9 FIFO+// 1 - ARM7 FIFO - u32 * MMU_WAIT16[2];- u32 * MMU_WAIT32[2];+ u32 * MMU_WAIT16[2];+ u32 * MMU_WAIT32[2]; - u32 DTCMRegion;- u32 ITCMRegion;- - u16 timer[2][4];- s32 timerMODE[2][4];- u32 timerON[2][4];- u32 timerRUN[2][4];- u16 timerReload[2][4];- - u32 reg_IME[2];- u32 reg_IE[2];- u32 reg_IF[2];- - u32 DMAStartTime[2][4];- s32 DMACycle[2][4];- u32 DMACrt[2][4];- BOOL DMAing[2][4];+ u32 DTCMRegion;+ u32 ITCMRegion;+ + u16 timer[2][4];+ s32 timerMODE[2][4];+ u32 timerON[2][4];+ u32 timerRUN[2][4];+ u16 timerReload[2][4];+ + u32 reg_IME[2];+ u32 reg_IE[2];+ u32 reg_IF[2];+ + u32 DMAStartTime[2][4];+ s32 DMACycle[2][4];+ u32 DMACrt[2][4];+ BOOL DMAing[2][4];+ + memory_chip_t fw;+ memory_chip_t bupmem;+ + nds_dscarddscard[2];+u32CheckTimers;+u32CheckDMAs; - memory_chip_t fw;- memory_chip_t bupmem;- - nds_dscarddscard[2];-u32CheckTimers;-u32CheckDMAs;- } MMU_struct; extern MMU_struct MMU;Modified: trunk/desmume/src/SPU.cpp===================================================================--- trunk/desmume/src/SPU.cpp2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/SPU.cpp2008-09-27 06:52:33 UTC (rev 1006)@@ -1502,7 +1502,7 @@ //copy the core spu (the more accurate) to the user spu if(SPU_user) {-memcpy(SPU_core->channels,SPU_user->channels,sizeof(SPU_core->channels));+memcpy(SPU_user->channels,SPU_core->channels,sizeof(SPU_core->channels)); } return true;Modified: trunk/desmume/src/dscard.h===================================================================--- trunk/desmume/src/dscard.h2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/dscard.h2008-09-27 06:52:33 UTC (rev 1006)@@ -23,7 +23,7 @@ typedef struct { -u32 adress;+u32 address; u32 transfer_count; } nds_dscard;Modified: trunk/desmume/src/gfx3d.cpp===================================================================--- trunk/desmume/src/gfx3d.cpp2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/gfx3d.cpp2008-09-27 06:52:33 UTC (rev 1006)@@ -1472,71 +1472,71 @@ SFORMAT SF_GFX3D[]={-{ &control, 4|SS_RLSB, "GCTL" },-{ &polyAttr, 4|SS_RLSB, "GPAT" },-{ &textureFormat, 4|SS_RLSB, "GTFM" },-{ &texturePalette, 4|SS_RLSB, "GTPA" },-{ &mode, 4|SS_RLSB, "GMOD" },-{ mtxTemporal, 4|SS_MULT(16), "GMTM" },-{ mtxCurrent, 4|SS_MULT(64), "GMCU" },-{ &mtxStack[0].position, 4|SS_RLSB, "GM0P" },-{ mtxStack[0].matrix, 4|SS_MULT(16), "GM1M" },-{ &mtxStack[1].position, 4|SS_RLSB, "GM1P" },-{ mtxStack[1].matrix, 4|SS_MULT(16*31), "GM1M" },-{ &mtxStack[2].position, 4|SS_RLSB, "GM2P" },-{ mtxStack[2].matrix, 4|SS_MULT(16*31), "GM2M" },-{ &mtxStack[3].position, 4|SS_RLSB, "GM3P" },-{ mtxStack[3].matrix, 4|SS_MULT(16), "GM3M" },-{ &ML4x4ind, 1, "ML4I" },-{ &ML4x3_c, 1, "ML3C" },-{ &ML4x3_l, 1, "ML3L" },-{ &MM4x4ind, 1, "MM4I" },-{ &MM4x3_c, 1, "MM3C" },-{ &MM4x3_l, 1, "MM3L" },-{ &MM3x3_c, 1, "MMxC" },-{ &MM3x3_l, 1, "MMxL" },-{ coord, 4|SS_MULT(4), "GCOR" },-{ &coordind, 1, "GCOI" },-{ &vtxFormat, 4|SS_RLSB, "GCOI" },-{ trans, 4|SS_MULT(4), "GTRN" },-{ &transind, 1, "GTRI" },-{ scale, 4|SS_MULT(4), "GSCA" },-{ &scaleind, 1, "GSCI" },-{ &_t, 4|SS_RLSB, "G_T_" },-{ &_s, 4|SS_RLSB, "G_S_" },-{ &last_t, 4|SS_RLSB, "GL_T" },-{ &last_s, 4|SS_RLSB, "GL_S" },-{ &clCmd, 4|SS_RLSB, "GLCM" },-{ &clInd, 4|SS_RLSB, "GLIN" },-{ &clInd2, 4|SS_RLSB, "GLI2" },-{ colorRGB, 4, "GCOL" },-{ lightColor, 4|SS_MULT(4), "GLCO" },-{ lightDirection, 4|SS_MULT(4), "GLDI" },-{ &dsDiffuse, 2|SS_RLSB, "GMDI" },-{ &dsAmbient, 2|SS_RLSB, "GMAM" },-{ &dsSpecular, 2|SS_RLSB, "GMSP" },-{ &dsEmission, 2|SS_RLSB, "GMEM" },-{ &triStripToggle, 4|SS_RLSB, "GTST" },-{ &listTwiddle, 4|SS_RLSB, "GLTW" },-{ &flushPending, 4|SS_RLSB, "GFLP" },-{ &gfx3d.enableTexturing, 4|SS_RLSB, "GSET" },-{ &gfx3d.enableAlphaTest, 4|SS_RLSB, "GSEA" },-{ &gfx3d.enableAlphaBlending, 4|SS_RLSB, "GSEB" },-{ &gfx3d.enableAntialiasing, 4|SS_RLSB, "GSEX" },-{ &gfx3d.enableEdgeMarking, 4|SS_RLSB, "GSEE" },-{ &gfx3d.shading, 4|SS_RLSB, "GSSH" },-{ &gfx3d.wbuffer, 4|SS_RLSB, "GSWB" },-{ &gfx3d.sortmode, 4|SS_RLSB, "GSSM" },-{ &gfx3d.alphaTestRef, 4|SS_RLSB, "GSAR" },-{ &gfx3d.viewport.x, 4|SS_RLSB, "GSVX" },-{ &gfx3d.viewport.y, 4|SS_RLSB, "GSVY" },-{ &gfx3d.viewport.width, 4|SS_RLSB, "GSVW" },-{ &gfx3d.viewport.height, 4|SS_RLSB, "GSVH" },-{ gfx3d.clearColor, 4|SS_MULT(4), "GSCC" },-{ &gfx3d.clearDepth , 4|SS_RLSB, "GSCD" },-{ gfx3d.fogColor, 4|SS_MULT(4), "GSFC" },-{ &gfx3d.fogOffset, 4|SS_RLSB, "GSFO" },-{ gfx3d.rgbToonTable, 4|SS_MULT(32), "GSTT" },+{ "GCTL", 4, 1, &control},+{ "GPAT", 4, 1, &polyAttr},+{ "GTFM", 4, 1, &textureFormat},+{ "GTPA", 4, 1, &texturePalette},+{ "GMOD", 4, 1, &mode},+{ "GMTM", 4,16, mtxTemporal},+{ "GMCU", 4,64, mtxCurrent},+{ "GM0P", 4, 1, &mtxStack[0].position},+{ "GM1M", 4,16, mtxStack[0].matrix},+{ "GM1P", 4, 1, &mtxStack[1].position},+{ "GM1M", 4,496,mtxStack[1].matrix},+{ "GM2P", 4, 1, &mtxStack[2].position},+{ "GM2M", 4,496,mtxStack[2].matrix},+{ "GM3P", 4, 1, &mtxStack[3].position},+{ "GM3M", 4,16, mtxStack[3].matrix},+{ "ML4I", 1, 1, &ML4x4ind},+{ "ML3C", 1, 1, &ML4x3_c},+{ "ML3L", 1, 1, &ML4x3_l},+{ "MM4I", 1, 1, &MM4x4ind},+{ "MM3C", 1, 1, &MM4x3_c},+{ "MM3L", 1, 1, &MM4x3_l},+{ "MMxC", 1, 1, &MM3x3_c},+{ "MMxL", 1, 1, &MM3x3_l},+{ "GCOR", 4, 1, coord},+{ "GCOI", 1, 1, &coordind},+{ "GVFM", 4, 1, &vtxFormat},+{ "GTRN", 4, 4, trans},+{ "GTRI", 1, 1, &transind},+{ "GSCA", 4, 4, scale},+{ "GSCI", 1, 1, &scaleind},+{ "G_T_", 4, 1, &_t},+{ "G_S_", 4, 1, &_s},+{ "GL_T", 4, 1, &last_t},+{ "GL_S", 4, 1, &last_s},+{ "GLCM", 4, 1, &clCmd},+{ "GLIN", 4, 1, &clInd},+{ "GLI2", 4, 1, &clInd2},+{ "GCOL", 1, 4, colorRGB},+{ "GLCO", 4, 4, lightColor},+{ "GLDI", 4, 4, lightDirection},+{ "GMDI", 2, 1, &dsDiffuse},+{ "GMAM", 2, 1, &dsAmbient},+{ "GMSP", 2, 1, &dsSpecular},+{ "GMEM", 2, 1, &dsEmission},+{ "GTST", 4, 1, &triStripToggle},+{ "GLTW", 4, 1, &listTwiddle},+{ "GFLP", 4, 1, &flushPending},+{ "GSET", 4, 1, &gfx3d.enableTexturing},+{ "GSEA", 4, 1, &gfx3d.enableAlphaTest},+{ "GSEB", 4, 1, &gfx3d.enableAlphaBlending},+{ "GSEX", 4, 1, &gfx3d.enableAntialiasing},+{ "GSEE", 4, 1, &gfx3d.enableEdgeMarking},+{ "GSSH", 4, 1, &gfx3d.shading},+{ "GSWB", 4, 1, &gfx3d.wbuffer},+{ "GSSM", 4, 1, &gfx3d.sortmode},+{ "GSAR", 4, 1, &gfx3d.alphaTestRef},+{ "GSVX", 4, 1, &gfx3d.viewport.x},+{ "GSVY", 4, 1, &gfx3d.viewport.y},+{ "GSVW", 4, 1, &gfx3d.viewport.width},+{ "GSVH", 4, 1, &gfx3d.viewport.height},+{ "GSCC", 4, 4, gfx3d.clearColor},+{ "GSCD", 4, 1, &gfx3d.clearDepth},+{ "GSFC", 4, 4, gfx3d.fogColor},+{ "GSFO", 4, 1, &gfx3d.fogOffset},+{ "GSTT", 4, 32, gfx3d.rgbToonTable}, { 0 } }; Modified: trunk/desmume/src/saves.cpp===================================================================--- trunk/desmume/src/saves.cpp2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/saves.cpp2008-09-27 06:52:33 UTC (rev 1006)@@ -51,120 +51,188 @@ SFORMAT SF_ARM7[]={-{ &NDS_ARM7.instruction, 4|SS_RLSB, "7INS" },-{ &NDS_ARM7.instruct_adr, 4|SS_RLSB, "7INA" },-{ &NDS_ARM7.next_instruction, 4|SS_RLSB, "7INN" },-{ NDS_ARM7.R, 4|SS_MULT(16), "7REG" },-{ &NDS_ARM7.CPSR, 4|SS_RLSB, "7CPS" },-{ &NDS_ARM7.SPSR, 4|SS_RLSB, "7SPS" },-{ &NDS_ARM7.R13_usr, 4|SS_RLSB, "7DUS" },-{ &NDS_ARM7.R14_usr, 4|SS_RLSB, "7EUS" },-{ &NDS_ARM7.R13_svc, 4|SS_RLSB, "7DSV" },-{ &NDS_ARM7.R14_svc, 4|SS_RLSB, "7ESV" },-{ &NDS_ARM7.R13_abt, 4|SS_RLSB, "7DAB" },-{ &NDS_ARM7.R14_abt, 4|SS_RLSB, "7EAB" },-{ &NDS_ARM7.R13_und, 4|SS_RLSB, "7DUN" },-{ &NDS_ARM7.R14_und, 4|SS_RLSB, "7EUN" },-{ &NDS_ARM7.R13_irq, 4|SS_RLSB, "7DIR" },-{ &NDS_ARM7.R14_irq, 4|SS_RLSB, "7EIR" },-{ &NDS_ARM7.R8_fiq, 4|SS_RLSB, "78FI" },-{ &NDS_ARM7.R9_fiq, 4|SS_RLSB, "79FI" },-{ &NDS_ARM7.R10_fiq, 4|SS_RLSB, "7AFI" },-{ &NDS_ARM7.R11_fiq, 4|SS_RLSB, "7BFI" },-{ &NDS_ARM7.R12_fiq, 4|SS_RLSB, "7CFI" },-{ &NDS_ARM7.R13_fiq, 4|SS_RLSB, "7DFI" },-{ &NDS_ARM7.R14_fiq, 4|SS_RLSB, "7EFI" },-{ &NDS_ARM7.SPSR_svc, 4|SS_RLSB, "7SVC" },-{ &NDS_ARM7.SPSR_abt, 4|SS_RLSB, "7ABT" },-{ &NDS_ARM7.SPSR_und, 4|SS_RLSB, "7UND" },-{ &NDS_ARM7.SPSR_irq, 4|SS_RLSB, "7IRQ" },-{ &NDS_ARM7.SPSR_fiq, 4|SS_RLSB, "7FIQ" },-{ &NDS_ARM7.intVector, 4|SS_RLSB, "7int" },-{ &NDS_ARM7.LDTBit, 1, "7LDT" },-{ &NDS_ARM7.waitIRQ, 4|SS_RLSB, "7Wai" },-{ &NDS_ARM7.wIRQ, 4|SS_RLSB, "7wIR" },-{ &NDS_ARM7.wirq, 4|SS_RLSB, "7wir" },+{ "7INS", 4, 1, &NDS_ARM7.instruction },+{ "7INA", 4, 1, &NDS_ARM7.instruct_adr },+{ "7INN", 4, 1, &NDS_ARM7.next_instruction },+{ "7REG", 4,16, NDS_ARM7.R },+{ "7CPS", 4, 1, &NDS_ARM7.CPSR },+{ "7SPS", 4, 1, &NDS_ARM7.SPSR },+{ "7DUS", 4, 1, &NDS_ARM7.R13_usr },+{ "7EUS", 4, 1, &NDS_ARM7.R14_usr },+{ "7DSV", 4, 1, &NDS_ARM7.R13_svc },+{ "7ESV", 4, 1, &NDS_ARM7.R14_svc },+{ "7DAB", 4, 1, &NDS_ARM7.R13_abt },+{ "7EAB", 4, 1, &NDS_ARM7.R14_abt },+{ "7DUN", 4, 1, &NDS_ARM7.R13_und },+{ "7EUN", 4, 1, &NDS_ARM7.R14_und },+{ "7DIR", 4, 1, &NDS_ARM7.R13_irq },+{ "7EIR", 4, 1, &NDS_ARM7.R14_irq },+{ "78FI", 4, 1, &NDS_ARM7.R8_fiq },+{ "79FI", 4, 1, &NDS_ARM7.R9_fiq },+{ "7AFI", 4, 1, &NDS_ARM7.R10_fiq },+{ "7BFI", 4, 1, &NDS_ARM7.R11_fiq },+{ "7CFI", 4, 1, &NDS_ARM7.R12_fiq },+{ "7DFI", 4, 1, &NDS_ARM7.R13_fiq },+{ "7EFI", 4, 1, &NDS_ARM7.R14_fiq },+{ "7SVC", 4, 1, &NDS_ARM7.SPSR_svc },+{ "7ABT", 4, 1, &NDS_ARM7.SPSR_abt },+{ "7UND", 4, 1, &NDS_ARM7.SPSR_und },+{ "7IRQ", 4, 1, &NDS_ARM7.SPSR_irq },+{ "7FIQ", 4, 1, &NDS_ARM7.SPSR_fiq },+{ "7int", 4, 1, &NDS_ARM7.intVector },+{ "7LDT", 1, 1, &NDS_ARM7.LDTBit },+{ "7Wai", 4, 1, &NDS_ARM7.waitIRQ },+{ "7wIR", 4, 1, &NDS_ARM7.wIRQ, },+{ "7wir", 4, 1, &NDS_ARM7.wirq, }, { 0 } }; SFORMAT SF_ARM9[]={-{ &NDS_ARM9.instruction, 4|SS_RLSB, "9INS" },-{ &NDS_ARM9.instruct_adr, 4|SS_RLSB, "9INA" },-{ &NDS_ARM9.next_instruction, 4|SS_RLSB, "9INN" },-{ NDS_ARM9.R, 4|SS_MULT(16), "9REG" },-{ &NDS_ARM9.CPSR, 4|SS_RLSB, "9CPS" },-{ &NDS_ARM9.SPSR, 4|SS_RLSB, "9SPS" },-{ &NDS_ARM9.R13_usr, 4|SS_RLSB, "9DUS" },-{ &NDS_ARM9.R14_usr, 4|SS_RLSB, "9EUS" },-{ &NDS_ARM9.R13_svc, 4|SS_RLSB, "9DSV" },-{ &NDS_ARM9.R14_svc, 4|SS_RLSB, "9ESV" },-{ &NDS_ARM9.R13_abt, 4|SS_RLSB, "9DAB" },-{ &NDS_ARM9.R14_abt, 4|SS_RLSB, "9EAB" },-{ &NDS_ARM9.R13_und, 4|SS_RLSB, "9DUN" },-{ &NDS_ARM9.R14_und, 4|SS_RLSB, "9EUN" },-{ &NDS_ARM9.R13_irq, 4|SS_RLSB, "9DIR" },-{ &NDS_ARM9.R14_irq, 4|SS_RLSB, "9EIR" },-{ &NDS_ARM9.R8_fiq, 4|SS_RLSB, "98FI" },-{ &NDS_ARM9.R9_fiq, 4|SS_RLSB, "99FI" },-{ &NDS_ARM9.R10_fiq, 4|SS_RLSB, "9AFI" },-{ &NDS_ARM9.R11_fiq, 4|SS_RLSB, "9BFI" },-{ &NDS_ARM9.R12_fiq, 4|SS_RLSB, "9CFI" },-{ &NDS_ARM9.R13_fiq, 4|SS_RLSB, "9DFI" },-{ &NDS_ARM9.R14_fiq, 4|SS_RLSB, "9EFI" },-{ &NDS_ARM9.SPSR_svc, 4|SS_RLSB, "9SVC" },-{ &NDS_ARM9.SPSR_abt, 4|SS_RLSB, "9ABT" },-{ &NDS_ARM9.SPSR_und, 4|SS_RLSB, "9UND" },-{ &NDS_ARM9.SPSR_irq, 4|SS_RLSB, "9IRQ" },-{ &NDS_ARM9.SPSR_fiq, 4|SS_RLSB, "9FIQ" },-{ &NDS_ARM9.intVector, 4|SS_RLSB, "9int" },-{ &NDS_ARM9.LDTBit, 1, "9LDT" },-{ &NDS_ARM9.waitIRQ, 4|SS_RLSB, "9Wai" },-{ &NDS_ARM9.wIRQ, 4|SS_RLSB, "9wIR" },-{ &NDS_ARM9.wirq, 4|SS_RLSB, "9wir" },+{ "9INS", 4, 1, &NDS_ARM9.instruction},+{ "9INA", 4, 1, &NDS_ARM9.instruct_adr},+{ "9INN", 4, 1, &NDS_ARM9.next_instruction},+{ "9REG", 4,16, NDS_ARM9.R},+{ "9CPS", 4, 1, &NDS_ARM9.CPSR},+{ "9SPS", 4, 1, &NDS_ARM9.SPSR},+{ "9DUS", 4, 1, &NDS_ARM9.R13_usr},+{ "9EUS", 4, 1, &NDS_ARM9.R14_usr},+{ "9DSV", 4, 1, &NDS_ARM9.R13_svc},+{ "9ESV", 4, 1, &NDS_ARM9.R14_svc},+{ "9DAB", 4, 1, &NDS_ARM9.R13_abt},+{ "9EAB", 4, 1, &NDS_ARM9.R14_abt},+{ "9DUN", 4, 1, &NDS_ARM9.R13_und},+{ "9EUN", 4, 1, &NDS_ARM9.R14_und},+{ "9DIR", 4, 1, &NDS_ARM9.R13_irq},+{ "9EIR", 4, 1, &NDS_ARM9.R14_irq},+{ "98FI", 4, 1, &NDS_ARM9.R8_fiq},+{ "99FI", 4, 1, &NDS_ARM9.R9_fiq},+{ "9AFI", 4, 1, &NDS_ARM9.R10_fiq},+{ "9BFI", 4, 1, &NDS_ARM9.R11_fiq},+{ "9CFI", 4, 1, &NDS_ARM9.R12_fiq},+{ "9DFI", 4, 1, &NDS_ARM9.R13_fiq},+{ "9EFI", 4, 1, &NDS_ARM9.R14_fiq},+{ "9SVC", 4, 1, &NDS_ARM9.SPSR_svc},+{ "9ABT", 4, 1, &NDS_ARM9.SPSR_abt},+{ "9UND", 4, 1, &NDS_ARM9.SPSR_und},+{ "9IRQ", 4, 1, &NDS_ARM9.SPSR_irq},+{ "9FIQ", 4, 1, &NDS_ARM9.SPSR_fiq},+{ "9int", 4, 1, &NDS_ARM9.intVector},+{ "9LDT", 1, 1, &NDS_ARM9.LDTBit},+{ "9Wai", 4, 1, &NDS_ARM9.waitIRQ},+{ "9wIR", 4, 1, &NDS_ARM9.wIRQ},+{ "9wir", 4, 1, &NDS_ARM9.wirq}, { 0 } }; SFORMAT SF_MEM[]={-{ ARM9Mem.ARM9_ITCM, 0x8000, "ITCM" },-{ ARM9Mem.ARM9_DTCM, 0x4000, "DTCM" },-{ ARM9Mem.MAIN_MEM, 0x400000, "WRAM" },+{ "ITCM", 1, 0x8000, ARM9Mem.ARM9_ITCM},+{ "DTCM", 1, 0x4000, ARM9Mem.ARM9_DTCM},+{ "WRAM", 1, 0x400000, ARM9Mem.MAIN_MEM}, //NOTE - this is not as large as the allocated memory. //the memory is overlarge due to the way our memory map system is setup //but there are actually no more registers than this-{ ARM9Mem.ARM9_REG, 0x2000, "9REG" }, +{ "9REG", 1, 0x2000, ARM9Mem.ARM9_REG}, -{ ARM9Mem.ARM9_VMEM, 0x800, "VMEM" },-{ ARM9Mem.ARM9_OAM, 0x800, "OAMS" },-{ ARM9Mem.ARM9_ABG, 0x80000, "ABGM" },-{ ARM9Mem.ARM9_BBG, 0x20000, "BBGM" },-{ ARM9Mem.ARM9_AOBJ, 0x40000, "AOBJ" },-{ ARM9Mem.ARM9_BOBJ, 0x20000, "BOBJ" },-{ ARM9Mem.ARM9_LCD, 0xA4000, "LCDM" },-{ MMU.ARM7_ERAM, 0x10000, "ERAM" },-{ MMU.ARM7_REG, 0x10000, "7REG" },-{ MMU.ARM7_WIRAM, 0x10000, "WIRA" },-{ MMU.SWIRAM, 0x8000, "SWIR" },-{ MMU.CART_RAM, SRAM_SIZE, "SRAM" },+{ "VMEM", 1, 0x800, ARM9Mem.ARM9_VMEM},+{ "OAMS", 1, 0x800, ARM9Mem.ARM9_OAM},+{ "ABGM", 1, 0x80000, ARM9Mem.ARM9_ABG},+{ "BBGM", 1, 0x20000, ARM9Mem.ARM9_BBG},+{ "AOBJ", 1, 0x40000, ARM9Mem.ARM9_AOBJ},+{ "BOBJ", 1, 0x20000, ARM9Mem.ARM9_BOBJ},+{ "LCDM", 1, 0xA4000, ARM9Mem.ARM9_LCD}, { 0 } }; SFORMAT SF_NDS[]={-{ &nds.ARM9Cycle, 4|SS_RLSB, "_9CY" },-{ &nds.ARM7Cycle, 4|SS_RLSB, "_7CY" },-{ &nds.cycles, 4|SS_RLSB, "_CYC" },-{ nds.timerCycle, 4|SS_MULT(8), "_TCY" },-{ nds.timerOver, 4|SS_MULT(8), "_TOV" },-{ &nds.nextHBlank, 4|SS_RLSB, "_NHB" },-{ &nds.VCount, 4|SS_RLSB, "_VCT" },-{ &nds.old, 4|SS_RLSB, "_OLD" },-{ &nds.diff, 4|SS_RLSB, "_DIF" },-{ &nds.lignerendu, 4|SS_RLSB, "_LIG" },-{ &nds.touchX, 2|SS_RLSB, "_TPX" },-{ &nds.touchY, 2|SS_RLSB, "_TPY" },+{ "_9CY", 4, 1, &nds.ARM9Cycle},+{ "_7CY", 4, 1, &nds.ARM7Cycle},+{ "_CYC", 4, 1, &nds.cycles},+{ "_TCY", 4, 8, nds.timerCycle},+{ "_TOV", 4, 8, nds.timerOver},+{ "_NHB", 4, 1, &nds.nextHBlank},+{ "_VCT", 4, 1, &nds.VCount},+{ "_OLD", 4, 1, &nds.old},+{ "_DIF", 4, 1, &nds.diff},+{ "_LIG", 4, 1, &nds.lignerendu},+{ "_TPX", 2, 1, &nds.touchX},+{ "_TPY", 2, 1, &nds.touchY}, { 0 } }; +SFORMAT SF_MMU[]={+{ "M7BI", 1, 0x4000, MMU.ARM7_BIOS},+{ "M7ER", 1, 0x10000, MMU.ARM7_ERAM},+{ "M7RG", 1, 0x10000, MMU.ARM7_REG},+{ "M7WI", 1, 0x10000, MMU.ARM7_WIRAM},+{ "MVRM", 1, 9, MMU.vram_mode},+{ "MSWI", 1, 0x8000, MMU.SWIRAM},+{ "MCRA", 1, 0x10000, MMU.CART_RAM},+{ "M9RW", 1, 1, &MMU.ARM9_RW_MODE},+{ "MDTC", 4, 1, &MMU.DTCMRegion},+{ "MITC", 4, 1, &MMU.ITCMRegion},+{ "MTIM", 2, 8, MMU.timer},+{ "MTMO", 4, 8, MMU.timerMODE},+{ "MTON", 4, 8, MMU.timerON},+{ "MTRN", 4, 8, MMU.timerRUN},+{ "MTRL", 2, 8, MMU.timerReload},+{ "MIME", 4, 2, MMU.reg_IME},+{ "MIE_", 4, 2, MMU.reg_IE},+{ "MIF_", 4, 2, MMU.reg_IF},+{ "MDST", 4, 8, MMU.DMAStartTime},+{ "MDCY", 4, 8, MMU.DMACycle},+{ "MDCR", 4, 8, MMU.DMACrt},+{ "MDMA", 4, 8, MMU.DMAing},++//begin memory chips+//we are skipping the firmware, because we really don't want to save the firmware to the savestate+//but, we will need to think about the philosophy of this.+//should we perhaps hash the current firmware and save it, so that we can match it against the loader's firmware?+{ "BUCO", 1, 1, &MMU.bupmem.com},+{ "BUAD", 4, 1, &MMU.bupmem.addr},+{ "BUAS", 1, 1, &MMU.bupmem.addr_shift},+{ "BUAZ", 1, 1, &MMU.bupmem.addr_size},+{ "BUWE", 4, 1, &MMU.bupmem.write_enable},+//writeable_buffer ???+//end memory chips++{ "MC0A", 4, 1, &MMU.dscard[0].address},+{ "MC0T", 4, 1, &MMU.dscard[0].transfer_count},+{ "MC1A", 4, 1, &MMU.dscard[1].address},+{ "MC1T", 4, 1, &MMU.dscard[1].transfer_count},+{ "MCHT", 4, 1, &MMU.CheckTimers},+{ "MCHD", 4, 1, &MMU.CheckDMAs},+{ 0 }+};+++void mmu_savestate(std::ostream* os)+{+//version+write32le(0,os);++write32le(MMU.bupmem.size,os);+os->write((char*)MMU.bupmem.data,MMU.bupmem.size);+}++bool mmu_loadstate(std::istream* is)+{+//read version+int version;+if(read32le(&version,is) != 1) return false;+if(version != 0) return false;++u32 bupmem_size;+if(read32le(&bupmem_size,is) != 1) return false;+if(bupmem_size != MMU.bupmem.size) return false; //mismatch between current initialized and saved size++is->read((char*)MMU.bupmem.data,bupmem_size);+if(is->fail()) return false;++return true;+}++ /* Format time and convert to string */ char * format_time(time_t cal_time) {@@ -281,27 +349,28 @@ } -static SFORMAT *CheckS(SFORMAT *sf, u32 tsize, char *desc)+static SFORMAT *CheckS(SFORMAT *sf, u32 size, u32 count, char *desc) { while(sf->v) {-if(sf->s==~0)// Link to another SFORMAT structure.-{-SFORMAT *tmp;-if((tmp= CheckS((SFORMAT *)sf->v, tsize, desc) ))-return(tmp);-sf++;-continue;-}+//NOT SUPPORTED RIGHT NOW+//if(sf->size==~0)// Link to another SFORMAT structure.+//{+//SFORMAT *tmp;+//if((tmp= CheckS((SFORMAT *)sf->v, tsize, desc) ))+//return(tmp);+//sf++;+//continue;+//} if(!memcmp(desc,sf->desc,4)) {-if(tsize!=(sf->s))-return(0);-return(sf);+if(sf->size != size || sf->count != count)+return 0;+return sf; } sf++; }-return(0);+return 0; } @@ -312,34 +381,31 @@ while(is->tellg()<temp+size) {-u32 tsize;+u32 size, count;+ char toa[4]; is->read(toa,4); if(is->fail()) return false; -read32le(&tsize,is);-int count = SS_UNMULT(tsize);-int size = tsize & ~SS_FLAGS;-bool rlsb = (count!=0);+if(!read32le(&size,is)) return false;+if(!read32le(&count,is)) return false; -if((tmp=CheckS(sf,tsize,toa)))+if((tmp=CheckS(sf,size,count,toa))) {---if(count == 0) count=1;--for(int i=0;i<count;i++) {--if(tmp->s&SS_INDIRECT)-is->read(*(char **)tmp->v,size);-else+if(size == 1) {+//special case: read a huge byte array+is->read((char *)tmp->v,count);+} else {+for(int i=0;i<count;i++)+{ is->read((char *)tmp->v + i*size,size); -#ifndef LOCAL_LE-if(rlsb)-FlipByteOrder((u8*)tmp->v + i*size,size);-#endif+#ifndef LOCAL_LE+if(rlsb)+FlipByteOrder((u8*)tmp->v + i*size,size);+#endif+} } } else@@ -356,50 +422,49 @@ while(sf->v) {-if(sf->s==~0)//Link to another struct-{-uint32 tmp;+//not supported right now+//if(sf->size==~0)//Link to another struct+//{+//uint32 tmp; -if(!(tmp=SubWrite(os,(SFORMAT *)sf->v)))-return(0);-acc+=tmp;-sf++;-continue;-}+//if(!(tmp=SubWrite(os,(SFORMAT *)sf->v)))+//return(0);+//acc+=tmp;+//sf++;+//continue;+//} -int count = SS_UNMULT(sf->s);-int size = sf->s & ~SS_FLAGS;-bool rlsb = (count!=0);+int count = sf->count;+int size = sf->size; -acc+=8;//Description + size+acc+=12;//Description + size + count -if(count==0) count=1;- acc += count * size; if(os)//Are we writing or calculating the size of this block? { os->write(sf->desc,4);-write32le(sf->s,os);+write32le(sf->size,os);+write32le(sf->count,os); -for(int i=0;i<count;i++) {+if(size == 1) {+//special case: write a huge byte array+os->write((char *)sf->v,count);+} else {+for(int i=0;i<count;i++) { -#ifndef LOCAL_LE-if(rlsb)+#ifndef LOCAL_LE FlipByteOrder((u8*)sf->v,sf->s&(~SS_FLAGS));-#endif+#endif -if(sf->s&SS_INDIRECT)-os->write(*(char **)sf->v,size);-else os->write((char*)sf->v + i*size,size); -//Now restore the original byte order.-#ifndef LOCAL_LE-if(rlsb)-FlipByteOrder((u8*)sf->v,sf->s&(~SS_FLAGS));-#endif-+//Now restore the original byte order.+#ifndef LOCAL_LE+if(rlsb)+FlipByteOrder((u8*)sf->v,sf->s&(~SS_FLAGS));+#endif+} } } sf++;@@ -508,10 +573,12 @@ savestate_WriteChunk(os,2,SF_ARM7); savestate_WriteChunk(os,3,SF_MEM); savestate_WriteChunk(os,4,SF_NDS);-savestate_WriteChunk(os,5,gpu_savestate);+savestate_WriteChunk(os,50,SF_MMU);+savestate_WriteChunk(os,51,mmu_savestate);+savestate_WriteChunk(os,6,gpu_savestate); savestate_WriteChunk(os,7,spu_savestate);-savestate_WriteChunk(os,60,SF_GFX3D);-savestate_WriteChunk(os,61,gfx3d_savestate);+savestate_WriteChunk(os,80,SF_GFX3D);+savestate_WriteChunk(os,81,gfx3d_savestate); savestate_WriteChunk(os,0xFFFFFFFF,(SFORMAT*)0); } @@ -531,10 +598,12 @@ case 2: if(!ReadStateChunk(is,SF_ARM7,size)) ret=false; break; case 3: if(!ReadStateChunk(is,SF_MEM,size)) ret=false; break; case 4: if(!ReadStateChunk(is,SF_NDS,size)) ret=false; break;-case 5: if(!gpu_loadstate(is)) ret=false; break;+case 50: if(!ReadStateChunk(is,SF_MMU,size)) ret=false; break;+case 51: if(!mmu_loadstate(is)) ret=false; break;+case 6: if(!gpu_loadstate(is)) ret=false; break; case 7: if(!spu_loadstate(is)) ret=false; break;-case 60: if(!ReadStateChunk(is,SF_GFX3D,size)) ret=false; break;-case 61: if(!gfx3d_loadstate(is)) ret=false; break;+case 80: if(!ReadStateChunk(is,SF_GFX3D,size)) ret=false; break;+case 81: if(!gfx3d_loadstate(is)) ret=false; break; default: ret=false; break;Modified: trunk/desmume/src/saves.h===================================================================--- trunk/desmume/src/saves.h2008-09-26 06:36:18 UTC (rev 1005)+++ trunk/desmume/src/saves.h2008-09-27 06:52:33 UTC (rev 1006)@@ -36,32 +36,19 @@ struct SFORMAT {-//a void* to the data or a void** to the data-void *v;--//size, plus flags-uint32 s;- //a string description of the element char *desc;-};--//X multiple multibyte elements-#define SS_MULT(X)(X<<24) -//indicates that the value is a multibyte integer that needs to be put in the correct byte order-//this is the same as SS_MULT(1)-#define SS_RLSB SS_MULT(1)+//the size of each element+u32 size; +//the number of each element+u32 count; --//all flags together so that we can mask them out and get the size-#define SS_FLAGS (SS_INDIRECT|SS_MULT(127))+//a void* to the data or a void** to the data+void *v;+}; -//extract the multiplier-#define SS_UNMULT(X)((X>>24)&0x7F)-- extern savestates_t savestates[NB_STATES]; void clear_savestates();This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1007] trunk/desmume/src

From: <ze...@us...> - 2008-09-28 04:48:57

Revision: 1007 Author: zeromusDate: 2008-09-28 04:48:46 +0000 (Sun, 28 Sep 2008)Log Message:-----------add fifo and cp15 to savestate. i believe it is mostly complete now, except for the 3d backbuffers (so the first frame after a load wont have 3d.) but i skipped this because the format will definitely change. ... ...and once more your savestates are invalidated.Modified Paths:-------------- trunk/desmume/src/FIFO.h trunk/desmume/src/NDSSystem.cpp trunk/desmume/src/cp15.h trunk/desmume/src/saves.cppModified: trunk/desmume/src/FIFO.h===================================================================--- trunk/desmume/src/FIFO.h2008-09-27 06:52:33 UTC (rev 1006)+++ trunk/desmume/src/FIFO.h2008-09-28 04:48:46 UTC (rev 1007)@@ -28,12 +28,12 @@ typedef struct {-boolerror;-boolenable;+BOOLerror;+BOOLenable; -boolempty;-boolhalf;-boolfull;+BOOLempty;+BOOLhalf;+BOOLfull; u8irq; u8sendPos;Modified: trunk/desmume/src/NDSSystem.cpp===================================================================--- trunk/desmume/src/NDSSystem.cpp2008-09-27 06:52:33 UTC (rev 1006)+++ trunk/desmume/src/NDSSystem.cpp2008-09-28 04:48:46 UTC (rev 1007)@@ -424,11 +424,8 @@ MMU.bupmem.fp = NULL; } - - void NDS_Reset( void) {- BOOL oldexecute=execute; int i; u32 src; u32 dst;@@ -436,8 +433,6 @@ if (!header) return ; - execute = FALSE;- MMU_clearMem(); src = header->ARM9src;@@ -460,6 +455,7 @@ src += 4; } + armcpu_init(&NDS_ARM7, header->ARM7exe); armcpu_init(&NDS_ARM9, header->ARM9exe); @@ -543,8 +539,6 @@ gfx3d_reset(); gpu3D->NDS_3D_Reset(); SPU_Reset();-- execute = oldexecute; } int NDS_ImportSave(const char *filename)Modified: trunk/desmume/src/cp15.h===================================================================--- trunk/desmume/src/cp15.h2008-09-27 06:52:33 UTC (rev 1006)+++ trunk/desmume/src/cp15.h2008-09-28 04:48:46 UTC (rev 1007)@@ -24,7 +24,7 @@ #include "armcpu.h" -typedef struct+struct armcp15_t { u32 IDCode; u32 cacheType;@@ -70,7 +70,7 @@ armcpu_t * cpu; -} armcp15_t;+}; armcp15_t *armcp15_new(armcpu_t *c); BOOL armcp15_dataProcess(armcp15_t *armcp15, u8 CRd, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2);Modified: trunk/desmume/src/saves.cpp===================================================================--- trunk/desmume/src/saves.cpp2008-09-27 06:52:33 UTC (rev 1006)+++ trunk/desmume/src/saves.cpp2008-09-28 04:48:46 UTC (rev 1007)@@ -24,12 +24,14 @@ #endif #include <stdio.h> #include <string.h>+#include <sys/stat.h>+#include <time.h>+#include <fstream> #include "saves.h" #include "MMU.h" #include "NDSSystem.h"-#include <sys/stat.h>-#include <time.h>-#include <fstream>+#include "render3D.h"+#include "cp15.h" #include "memorystream.h" #include "readwrite.h"@@ -202,6 +204,26 @@ { "MC1T", 4, 1, &MMU.dscard[1].transfer_count}, { "MCHT", 4, 1, &MMU.CheckTimers}, { "MCHD", 4, 1, &MMU.CheckDMAs},++//fifos+{ "F0ER", 4, 1, &MMU.fifos[0].error},+{ "F0EN", 4, 1, &MMU.fifos[0].enable},+{ "F0EM", 4, 1, &MMU.fifos[0].empty},+{ "F0HA", 4, 1, &MMU.fifos[0].half},+{ "F0FU", 4, 1, &MMU.fifos[0].full},+{ "F0IR", 1, 1, &MMU.fifos[0].irq},+{ "F0SP", 1, 1, &MMU.fifos[0].sendPos},+{ "F0RP", 1, 1, &MMU.fifos[0].recvPos},+{ "F0BU", 1, 0x8000, &MMU.fifos[0].buf},+{ "F1ER", 4, 1, &MMU.fifos[1].error},+{ "F1EN", 4, 1, &MMU.fifos[1].enable},+{ "F1EM", 4, 1, &MMU.fifos[1].empty},+{ "F1HA", 4, 1, &MMU.fifos[1].half},+{ "F1FU", 4, 1, &MMU.fifos[1].full},+{ "F1IR", 1, 1, &MMU.fifos[1].irq},+{ "F1SP", 1, 1, &MMU.fifos[1].sendPos},+{ "F1RP", 1, 1, &MMU.fifos[1].recvPos},+{ "F1BU", 1, 0x8000, &MMU.fifos[1].buf}, { 0 } }; @@ -232,7 +254,118 @@ return true; } +static void cp15_saveone(armcp15_t *cp15, std::ostream* os)+{+write32le(cp15->IDCode,os);+write32le(cp15->cacheType,os);+ write32le(cp15->TCMSize,os);+ write32le(cp15->ctrl,os);+ write32le(cp15->DCConfig,os);+ write32le(cp15->ICConfig,os);+ write32le(cp15->writeBuffCtrl,os);+ write32le(cp15->und,os);+ write32le(cp15->DaccessPerm,os);+ write32le(cp15->IaccessPerm,os);+ write32le(cp15->protectBaseSize0,os);+ write32le(cp15->protectBaseSize1,os);+ write32le(cp15->protectBaseSize2,os);+ write32le(cp15->protectBaseSize3,os);+ write32le(cp15->protectBaseSize4,os);+ write32le(cp15->protectBaseSize5,os);+ write32le(cp15->protectBaseSize6,os);+ write32le(cp15->protectBaseSize7,os);+ write32le(cp15->cacheOp,os);+ write32le(cp15->DcacheLock,os);+ write32le(cp15->IcacheLock,os);+ write32le(cp15->ITCMRegion,os);+ write32le(cp15->DTCMRegion,os);+ write32le(cp15->processID,os);+ write32le(cp15->RAM_TAG,os);+ write32le(cp15->testState,os);+ write32le(cp15->cacheDbg,os);+ for(int i=0;i<8;i++) write32le(cp15->regionWriteMask_USR[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionWriteMask_SYS[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionReadMask_USR[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionReadMask_SYS[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionExecuteMask_USR[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionExecuteMask_SYS[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionWriteSet_USR[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionWriteSet_SYS[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionReadSet_USR[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionReadSet_SYS[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionExecuteSet_USR[i],os);+ for(int i=0;i<8;i++) write32le(cp15->regionExecuteSet_SYS[i],os);+} +void cp15_savestate(std::ostream* os)+{+//version+write32le(0,os);++cp15_saveone((armcp15_t *)NDS_ARM9.coproc[15],os);+cp15_saveone((armcp15_t *)NDS_ARM7.coproc[15],os);+}++static bool cp15_loadone(armcp15_t *cp15, std::istream* is)+{+if(!read32le(&cp15->IDCode,is)) return false;+if(!read32le(&cp15->cacheType,is)) return false;+ if(!read32le(&cp15->TCMSize,is)) return false;+ if(!read32le(&cp15->ctrl,is)) return false;+ if(!read32le(&cp15->DCConfig,is)) return false;+ if(!read32le(&cp15->ICConfig,is)) return false;+ if(!read32le(&cp15->writeBuffCtrl,is)) return false;+ if(!read32le(&cp15->und,is)) return false;+ if(!read32le(&cp15->DaccessPerm,is)) return false;+ if(!read32le(&cp15->IaccessPerm,is)) return false;+ if(!read32le(&cp15->protectBaseSize0,is)) return false;+ if(!read32le(&cp15->protectBaseSize1,is)) return false;+ if(!read32le(&cp15->protectBaseSize2,is)) return false;+ if(!read32le(&cp15->protectBaseSize3,is)) return false;+ if(!read32le(&cp15->protectBaseSize4,is)) return false;+ if(!read32le(&cp15->protectBaseSize5,is)) return false;+ if(!read32le(&cp15->protectBaseSize6,is)) return false;+ if(!read32le(&cp15->protectBaseSize7,is)) return false;+ if(!read32le(&cp15->cacheOp,is)) return false;+ if(!read32le(&cp15->DcacheLock,is)) return false;+ if(!read32le(&cp15->IcacheLock,is)) return false;+ if(!read32le(&cp15->ITCMRegion,is)) return false;+ if(!read32le(&cp15->DTCMRegion,is)) return false;+ if(!read32le(&cp15->processID,is)) return false;+ if(!read32le(&cp15->RAM_TAG,is)) return false;+ if(!read32le(&cp15->testState,is)) return false;+ if(!read32le(&cp15->cacheDbg,is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionWriteMask_USR[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionWriteMask_SYS[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionReadMask_USR[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionReadMask_SYS[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionExecuteMask_USR[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionExecuteMask_SYS[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionWriteSet_USR[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionWriteSet_SYS[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionReadSet_USR[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionReadSet_SYS[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionExecuteSet_USR[i],is)) return false;+ for(int i=0;i<8;i++) if(!read32le(&cp15->regionExecuteSet_SYS[i],is)) return false;++return true;+}++bool cp15_loadstate(std::istream* is)+{+//read version+int version;+if(read32le(&version,is) != 1) return false;+if(version != 0) return false;++if(!cp15_loadone((armcp15_t *)NDS_ARM9.coproc[15],is)) return false;+if(!cp15_loadone((armcp15_t *)NDS_ARM7.coproc[15],is)) return false;++return true;+}+++ /* Format time and convert to string */ char * format_time(time_t cal_time) {@@ -571,14 +704,15 @@ static void writechunks(std::ostream* os) { savestate_WriteChunk(os,1,SF_ARM9); savestate_WriteChunk(os,2,SF_ARM7);-savestate_WriteChunk(os,3,SF_MEM);-savestate_WriteChunk(os,4,SF_NDS);-savestate_WriteChunk(os,50,SF_MMU);-savestate_WriteChunk(os,51,mmu_savestate);-savestate_WriteChunk(os,6,gpu_savestate);-savestate_WriteChunk(os,7,spu_savestate);-savestate_WriteChunk(os,80,SF_GFX3D);-savestate_WriteChunk(os,81,gfx3d_savestate);+savestate_WriteChunk(os,3,cp15_savestate);+savestate_WriteChunk(os,4,SF_MEM);+savestate_WriteChunk(os,5,SF_NDS);+savestate_WriteChunk(os,60,SF_MMU);+savestate_WriteChunk(os,61,mmu_savestate);+savestate_WriteChunk(os,7,gpu_savestate);+savestate_WriteChunk(os,8,spu_savestate);+savestate_WriteChunk(os,90,SF_GFX3D);+savestate_WriteChunk(os,91,gfx3d_savestate); savestate_WriteChunk(os,0xFFFFFFFF,(SFORMAT*)0); } @@ -596,14 +730,15 @@ { case 1: if(!ReadStateChunk(is,SF_ARM9,size)) ret=false; break; case 2: if(!ReadStateChunk(is,SF_ARM7,size)) ret=false; break;-case 3: if(!ReadStateChunk(is,SF_MEM,size)) ret=false; break;-case 4: if(!ReadStateChunk(is,SF_NDS,size)) ret=false; break;-case 50: if(!ReadStateChunk(is,SF_MMU,size)) ret=false; break;-case 51: if(!mmu_loadstate(is)) ret=false; break;-case 6: if(!gpu_loadstate(is)) ret=false; break;-case 7: if(!spu_loadstate(is)) ret=false; break;-case 80: if(!ReadStateChunk(is,SF_GFX3D,size)) ret=false; break;-case 81: if(!gfx3d_loadstate(is)) ret=false; break;+case 3: if(!cp15_loadstate(is)) ret=false; break;+case 4: if(!ReadStateChunk(is,SF_MEM,size)) ret=false; break;+case 5: if(!ReadStateChunk(is,SF_NDS,size)) ret=false; break;+case 60: if(!ReadStateChunk(is,SF_MMU,size)) ret=false; break;+case 61: if(!mmu_loadstate(is)) ret=false; break;+case 7: if(!gpu_loadstate(is)) ret=false; break;+case 8: if(!spu_loadstate(is)) ret=false; break;+case 90: if(!ReadStateChunk(is,SF_GFX3D,size)) ret=false; break;+case 91: if(!gfx3d_loadstate(is)) ret=false; break; default: ret=false; break;@@ -670,15 +805,19 @@ //GO!! READ THE SAVESTATE //THERE IS NO GOING BACK NOW //reset the emulator first to clean out the host's state-//NDS_Reset();-//************* OH NO **********************-//we arent saving something we need to!-//maybe MMU state or maybe FIFO-//I will have to look into this soon++//while the series of resets below should work,+//we are testing the robustness of the savestate system with this full reset.+//the full reset wipes more things, so we can make sure that they are being restored correctly+NDS_Reset(); -//hack-SPU_Reset();+//GPU_Reset(MainScreen.gpu, 0);+//GPU_Reset(SubScreen.gpu, 1);+//gfx3d_reset();+//gpu3D->NDS_3D_Reset();+//SPU_Reset(); + memorystream mstemp(&buf); bool x = ReadStateChunks(&mstemp,(s32)len); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

[Desmume-cvs] SF.net SVN: desmume:[1020] trunk/desmume/src

From: <ya...@us...> - 2008-10-06 19:38:28

Revision: 1020 Author: yabauseDate: 2008-10-06 19:35:46 +0000 (Mon, 06 Oct 2008)Log Message:-----------Checked in 4 more patches by Magliocchetti RiccardoThose are mostly fixes for gtk and gtk-glade ports.See patch descriptions on sourceforge for details:patches ID: 2149139 2149460 2149470 2149537Modified Paths:-------------- trunk/desmume/src/NDSSystem.cpp trunk/desmume/src/gtk/main.cpp trunk/desmume/src/gtk-glade/gdk_gl.cppModified: trunk/desmume/src/NDSSystem.cpp===================================================================--- trunk/desmume/src/NDSSystem.cpp2008-10-06 12:01:47 UTC (rev 1019)+++ trunk/desmume/src/NDSSystem.cpp2008-10-06 19:35:46 UTC (rev 1020)@@ -334,11 +334,18 @@ if (!file) {+ reader->DeInit(file); free(noext); return -1; } size = reader->Size(file); + if (size < 1) {+ reader->DeInit(file);+ free(noext);+ return -1;+ }+ if(type == ROM_DSGBA) { reader->Seek(file, DSGBA_LOADER_SIZE, SEEK_SET);Modified: trunk/desmume/src/gtk/main.cpp===================================================================--- trunk/desmume/src/gtk/main.cpp2008-10-06 12:01:47 UTC (rev 1019)+++ trunk/desmume/src/gtk/main.cpp2008-10-06 19:35:46 UTC (rev 1020)@@ -447,13 +447,14 @@ /* Choose a file then load it */ static void *Open_Select(GtkWidget* widget, gpointer data) {-Pause();- GtkFileFilter *pFilter_nds, *pFilter_dsgba, *pFilter_any; GtkWidget *pFileSelection; GtkWidget *pParent; gchar *sChemin; +if (desmume_running())+Pause();+ pParent = GTK_WIDGET(data); pFilter_nds = gtk_file_filter_new();@@ -503,6 +504,9 @@ "Unable to load :\n%s", sChemin); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog);+} else {+gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "run"), TRUE);+gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "reset"), TRUE); } //Launch(NULL, pWindow);@@ -513,10 +517,6 @@ break; } gtk_widget_destroy(pFileSelection);--// FIXME: should be set sensitive only if a file was really loaded-gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "run"), TRUE);-gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "reset"), TRUE); } static void Close()@@ -554,9 +554,7 @@ //printf("Doing GL init\n"); - for ( i = 0; i < 256 * 512; i++) {- blank_texture[i] = 0x001f;- }+ memset(blank_texture, 0x001f, sizeof(blank_texture)); /* Enable Texture Mapping */ glEnable( GL_TEXTURE_2D );@@ -1019,7 +1017,7 @@ { char YouPressed[128]; Modify_Key_Chosen = e->keyval;-sprintf(YouPressed, "You pressed : %d\nClick OK to keep this key.", e->keyval);+sprintf(YouPressed, "You pressed : %s\nClick OK to keep this key.", gdk_keyval_name(e->keyval)); gtk_label_set(GTK_LABEL(mkLabel), YouPressed); } @@ -1084,7 +1082,7 @@ for(i = 0; i < NB_KEYS; i++) {-sprintf(Key_Label, "%s (%d)", key_names[i], Keypad_Temp[i]);+sprintf(Key_Label, "%s (%s)", key_names[i], gdk_keyval_name(Keypad_Temp[i])); ecKey = gtk_button_new_with_label(Key_Label); g_signal_connect(G_OBJECT(ecKey), "clicked", G_CALLBACK(Modify_Key), GINT_TO_POINTER(i)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(ecDialog)->vbox), ecKey,TRUE, FALSE, 0);Modified: trunk/desmume/src/gtk-glade/gdk_gl.cpp===================================================================--- trunk/desmume/src/gtk-glade/gdk_gl.cpp2008-10-06 12:01:47 UTC (rev 1019)+++ trunk/desmume/src/gtk-glade/gdk_gl.cpp2008-10-06 19:35:46 UTC (rev 1020)@@ -173,7 +173,7 @@ void init_GL_capabilities( int use_software_convert) { - uint16_t blank_texture[256 * 512];+uint16_t blank_texture[256 * 512]; my_glConfig = gdk_gl_config_new_by_mode ( (GdkGLConfigMode) (GDK_GL_MODE_RGBA | GDK_GL_MODE_DEPTH @@ -191,11 +191,12 @@ glGenTextures(2, Textures); /* Generate The Texture */- glBindTexture( GL_TEXTURE_2D, Textures[0]);- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 512,- 0, GL_RGBA,- GL_UNSIGNED_SHORT_1_5_5_5_REV,- blank_texture);+glBindTexture( GL_TEXTURE_2D, Textures[0]);+memset(blank_texture, 0x001f, sizeof(blank_texture));+glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 512,+ 0, GL_RGBA,+ GL_UNSIGNED_SHORT_1_5_5_5_REV,+ blank_texture); my_gl_End(0); // initialize 2nd drawing area (sharing context)This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

<< < 1 2 3 4 .. 46 > >> (Page 2 of 46)

Thread: [Desmume-cvs] SF.net SVN: desmume:[1254] trunk/desmume/src (Page 2) (2024)
Top Articles
Latest Posts
Article information

Author: Annamae Dooley

Last Updated:

Views: 6355

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Annamae Dooley

Birthday: 2001-07-26

Address: 9687 Tambra Meadow, Bradleyhaven, TN 53219

Phone: +9316045904039

Job: Future Coordinator

Hobby: Archery, Couponing, Poi, Kite flying, Knitting, Rappelling, Baseball

Introduction: My name is Annamae Dooley, I am a witty, quaint, lovely, clever, rich, sparkling, powerful person who loves writing and wants to share my knowledge and understanding with you.