r2572 <- r2574,r2578-r2579,r2581,r2592-r2595,r2601,r2603-r2604,r2619,r2624-r2625,r2628-r2631,r2633,r2635-r2639,r2641-r2643,r2646-r2647,r2651-r2652,r2665-r2666(r2668),r2674,r2676,r2679(-single_core things),r2681(GPU_osd.cpp only),r2685,r2692,r2703,r2711-r2712,r2725-r2726,r2730,r2745,r2756-r2759, some other sugars and salts a little (Win VS2008)
This commit is contained in:
parent
eb2b400ea8
commit
d566ea3fc7
|
@ -15,7 +15,6 @@ adelikat
|
|||
matusz
|
||||
pa__
|
||||
gocha
|
||||
nitsuja
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
@ -41,3 +40,4 @@ Thanks to our super testers for this release
|
|||
nash679
|
||||
pokefan999
|
||||
dottorleo
|
||||
lbalbalba
|
|
@ -1,44 +1,13 @@
|
|||
0.9.4 -> ??? (r2437-r???)
|
||||
0.9.4+
|
||||
|
||||
??? introduces an entirely rewritten main emulation loop.
|
||||
This totally changes the timing, and totally breaks old savestates.
|
||||
|
||||
Highlights:
|
||||
* win32: lua engine, path configuration, 7z dearchiving support
|
||||
* rewritten main emulation loop
|
||||
|
||||
General/Core:
|
||||
bug: fix cflash directory support for non-windows
|
||||
bug: fix freeze in cart irq
|
||||
bug: correctly emulate dma to/from tcm
|
||||
bug: fix in thumb LSR carryflag
|
||||
enh: add guitar grip emulation
|
||||
enh: add more powerful antigrain-based drawing library and rewrite OSD system
|
||||
enh: ideas-style debugging prints
|
||||
|
||||
Graphics:
|
||||
bug: fixing of obj blending, bmp obj rendering, and some obj window cases
|
||||
bug: fix backdrop blending with garbage
|
||||
bug: fix 256B granularity sprite addressing for sub gpu
|
||||
bug: fix 128-wide captures
|
||||
bug: fix color overflow in capture blending
|
||||
bug: fix disp fifo capture
|
||||
bug: fix simultaneous vram display and capture via same bank
|
||||
bug: fix 3d overflow acknowledge registers
|
||||
bug: change 3d cores to use 18bit color
|
||||
bug: swrast: add clear image and scroll emulation
|
||||
bug: swrast: add fog emulation
|
||||
bug: swrast: fixes to shadow rendering
|
||||
|
||||
Windows:
|
||||
bug: improve map view tool to support more modes
|
||||
enh: added 2x resizing filters (hq2x, 2xsai, supereagle, scanlines)
|
||||
enh: soundview can now mute channels
|
||||
enh: multicore optimization for filters, rotation, OSD
|
||||
|
||||
Linux:
|
||||
enh: alsa microphone support
|
||||
enh: hud and osd notification for gtk and cli frontends
|
||||
- [2468] port r2466 from trunk (permit osd on bottom screen, fix stylus input display)
|
||||
- [2645] port some of small fixes from trunk:
|
||||
disable autohold while playing a movie (r2624)
|
||||
fix movie length (r2629)
|
||||
keyrepeat improvement (r2641-2643)
|
||||
- [2665]
|
||||
fix nitsuja's desynch bugreports (SF 2827543)
|
||||
fix desynch caused by spu_core forgetting to save a variable
|
||||
|
||||
0.9.2 -> 0.9.4 (r1844->r2352->r2437)
|
||||
|
|
@ -169,14 +169,10 @@ fi
|
|||
AM_CONDITIONAL([HAVE_LIBAGG], [test "${HAVE_LIBAGG}" = "yes"])
|
||||
if test "x$HAVE_LIBAGG" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBAGG])
|
||||
else
|
||||
AC_MSG_ERROR([Antigrain library is required to build desmume])
|
||||
fi
|
||||
|
||||
dnl - depends on glib, reference pkg-config since it is needed for checking glib
|
||||
if test "x$FOUND_GLIB" = "xno"; then
|
||||
AC_MSG_ERROR([Glib and pkg-config are required to build desmume])
|
||||
fi
|
||||
dnl - set conditional for glib, needed to avoid commandline.cpp compilation for cli frontend since it depends on glib
|
||||
AM_CONDITIONAL([HAVE_GLIB], [test "${FOUND_GLIB}" = "yes"])
|
||||
|
||||
dnl - If the gtkGLext package is available define the corresponding C macro
|
||||
if test "x$HAVE_GTKGLEXT" = "xyes"; then
|
||||
|
@ -277,8 +273,7 @@ if test "x[$]ENABLE_HARDCORE" = "x1"; then
|
|||
dnl - only valid for C with newer gcc's
|
||||
CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
|
||||
fi
|
||||
dnl - -Wshadow
|
||||
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
|
||||
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wshadow -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
|
||||
fi
|
||||
|
||||
dnl - Enable debug mode
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
FAT.H
|
||||
Mic, 2006
|
||||
Structures taken from Michael Chisholm's FAT library
|
||||
*/
|
||||
|
||||
#ifndef __FAT_H__
|
||||
#define __FAT_H__
|
||||
|
||||
#include "types.h"
|
||||
#include "PACKED.h"
|
||||
#include "PACKED_END.h"
|
||||
|
||||
#define ATTRIB_DIR 0x10
|
||||
#define ATTRIB_LFN 0x0F
|
||||
|
||||
#define FILE_FREE 0xE5
|
||||
/* Name and extension maximum length */
|
||||
#define NAME_LEN 8
|
||||
#define EXT_LEN 3
|
||||
|
||||
// Boot Sector - must be packed
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define DIR_SEP "\\"
|
||||
#else
|
||||
#define DIR_SEP "/"
|
||||
#endif
|
||||
|
||||
#include "PACKED.h"
|
||||
struct boot_record
|
||||
{
|
||||
u8 jmpBoot[3];
|
||||
u8 OEMName[8];
|
||||
// BIOS Parameter Block
|
||||
u16 bytesPerSector;
|
||||
u8 sectorsPerCluster;
|
||||
u16 reservedSectors;
|
||||
u8 numFATs;
|
||||
u16 rootEntries;
|
||||
u16 numSectorsSmall;
|
||||
u8 mediaDesc;
|
||||
u16 sectorsPerFAT;
|
||||
u16 sectorsPerTrk;
|
||||
u16 numHeads;
|
||||
u32 numHiddenSectors;
|
||||
u32 numSectors;
|
||||
|
||||
struct
|
||||
{
|
||||
// Ext BIOS Parameter Block for FAT16
|
||||
u8 driveNumber;
|
||||
u8 reserved1;
|
||||
u8 extBootSig;
|
||||
u32 volumeID;
|
||||
u8 volumeLabel[11];
|
||||
u8 fileSysType[8];
|
||||
// Bootcode
|
||||
u8 bootCode[448];
|
||||
u16 signature;
|
||||
} __PACKED fat16;
|
||||
|
||||
} __PACKED;
|
||||
typedef struct boot_record BOOT_RECORD;
|
||||
#include "PACKED_END.h"
|
||||
|
||||
// Directory entry - must be packed
|
||||
#include "PACKED.h"
|
||||
struct dir_ent
|
||||
{
|
||||
u8 name[NAME_LEN];
|
||||
u8 ext[EXT_LEN];
|
||||
u8 attrib;
|
||||
u8 reserved;
|
||||
u8 cTime_ms;
|
||||
u16 cTime;
|
||||
u16 cDate;
|
||||
u16 aDate;
|
||||
u16 startClusterHigh;
|
||||
u16 mTime;
|
||||
u16 mDate;
|
||||
u16 startCluster;
|
||||
u32 fileSize;
|
||||
} __PACKED;
|
||||
typedef struct dir_ent DIR_ENT;
|
||||
#include "PACKED_END.h"
|
||||
|
||||
#endif //
|
|
@ -1,317 +0,0 @@
|
|||
/* Copyright (C) 2006-2007 shash
|
||||
Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef MATRIX_H
|
||||
#define MATRIX_H
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "mem.h"
|
||||
|
||||
#ifdef ENABLE_SSE
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SSE2
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
struct MatrixStack
|
||||
{
|
||||
MatrixStack(int size);
|
||||
float *matrix;
|
||||
int position;
|
||||
int size;
|
||||
};
|
||||
|
||||
void MatrixInit (float *matrix);
|
||||
|
||||
//In order to conditionally use these asm optimized functions in visual studio
|
||||
//without having to make new build types to exclude the assembly files.
|
||||
//a bit sloppy, but there aint much to it
|
||||
|
||||
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
||||
void MatrixSet (float *matrix, int x, int y, float value);
|
||||
void MatrixCopy (float * matrixDST, const float * matrixSRC);
|
||||
int MatrixCompare (const float * matrixDST, const float * matrixSRC);
|
||||
void MatrixIdentity (float *matrix);
|
||||
|
||||
void MatrixTranspose (float *matrix);
|
||||
void MatrixStackInit (MatrixStack *stack);
|
||||
void MatrixStackSetMaxSize (MatrixStack *stack, int size);
|
||||
void MatrixStackSetStackPosition (MatrixStack *stack, int pos);
|
||||
void MatrixStackPushMatrix (MatrixStack *stack, const float *ptr);
|
||||
float* MatrixStackPopMatrix (MatrixStack *stack, int size);
|
||||
float* MatrixStackGetPos (MatrixStack *stack, int pos);
|
||||
float* MatrixStackGet (MatrixStack *stack);
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const float *ptr);
|
||||
|
||||
void Vector2Copy(float *dst, const float *src);
|
||||
void Vector2Add(float *dst, const float *src);
|
||||
void Vector2Subtract(float *dst, const float *src);
|
||||
float Vector2Dot(const float *a, const float *b);
|
||||
float Vector2Cross(const float *a, const float *b);
|
||||
|
||||
float Vector3Dot(const float *a, const float *b);
|
||||
void Vector3Cross(float* dst, const float *a, const float *b);
|
||||
float Vector3Length(const float *a);
|
||||
void Vector3Add(float *dst, const float *src);
|
||||
void Vector3Subtract(float *dst, const float *src);
|
||||
void Vector3Scale(float *dst, const float scale);
|
||||
void Vector3Copy(float *dst, const float *src);
|
||||
void Vector3Normalize(float *dst);
|
||||
|
||||
void Vector4Copy(float *dst, const float *src);
|
||||
|
||||
//these functions are an unreliable, inaccurate floor.
|
||||
//it should only be used for positive numbers
|
||||
//this isnt as fast as it could be if we used a visual c++ intrinsic, but those appear not to be universally available
|
||||
FORCEINLINE u32 u32floor(float f)
|
||||
{
|
||||
#ifdef ENABLE_SSE2
|
||||
return (u32)_mm_cvtt_ss2si(_mm_set_ss(f));
|
||||
#else
|
||||
return (u32)f;
|
||||
#endif
|
||||
}
|
||||
FORCEINLINE u32 u32floor(double d)
|
||||
{
|
||||
#ifdef ENABLE_SSE2
|
||||
return (u32)_mm_cvttsd_si32(_mm_set_sd(d));
|
||||
#else
|
||||
return (u32)d;
|
||||
#endif
|
||||
}
|
||||
|
||||
//same as above but works for negative values too.
|
||||
//be sure that the results are the same thing as floorf!
|
||||
FORCEINLINE s32 s32floor(float f)
|
||||
{
|
||||
#ifdef ENABLE_SSE2
|
||||
return _mm_cvtss_si32( _mm_add_ss(_mm_set_ss(-0.5f),_mm_add_ss(_mm_set_ss(f), _mm_set_ss(f))) ) >> 1;
|
||||
#else
|
||||
return (s32)floorf(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
//switched SSE2 functions
|
||||
//-------------
|
||||
#ifdef ENABLE_SSE
|
||||
|
||||
template<int NUM>
|
||||
FORCEINLINE void memset_u16_le(void* dst, u16 val)
|
||||
{
|
||||
u32 u32val;
|
||||
//just for the endian safety
|
||||
T1WriteWord((u8*)&u32val,0,val);
|
||||
T1WriteWord((u8*)&u32val,2,val);
|
||||
////const __m128i temp = _mm_set_epi32(u32val,u32val,u32val,u32val);
|
||||
__m128 temp; temp.m128_i32[0] = u32val;
|
||||
//MACRODO_N(NUM/8,_mm_store_si128((__m128i*)((u8*)dst+(X)*16), temp));
|
||||
MACRODO_N(NUM/8,_mm_store_ps1((float*)((u8*)dst+(X)*16), temp));
|
||||
}
|
||||
|
||||
#else //no sse2
|
||||
|
||||
template<int NUM>
|
||||
static FORCEINLINE void memset_u16_le(void* dst, u16 val)
|
||||
{
|
||||
for(int i=0;i<NUM;i++)
|
||||
T1WriteWord((u8*)dst,i<<1,val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//---------------------------
|
||||
//switched SSE functions
|
||||
#ifdef ENABLE_SSE
|
||||
|
||||
struct SSE_MATRIX
|
||||
{
|
||||
SSE_MATRIX(const float *matrix)
|
||||
: row0(_mm_load_ps(matrix))
|
||||
, row1(_mm_load_ps(matrix+4))
|
||||
, row2(_mm_load_ps(matrix+8))
|
||||
, row3(_mm_load_ps(matrix+12))
|
||||
{}
|
||||
|
||||
union {
|
||||
__m128 rows[4];
|
||||
struct { __m128 row0; __m128 row1; __m128 row2; __m128 row3; };
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
FORCEINLINE __m128 _util_MatrixMultVec4x4_(const SSE_MATRIX &mat, __m128 vec)
|
||||
{
|
||||
__m128 xmm5 = _mm_shuffle_ps(vec, vec, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(vec, vec, B8(10101010));
|
||||
__m128 xmm7 = _mm_shuffle_ps(vec, vec, B8(11111111));
|
||||
__m128 xmm4 = _mm_shuffle_ps(vec, vec, B8(00000000));
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,mat.row0);
|
||||
xmm5 = _mm_mul_ps(xmm5,mat.row1);
|
||||
xmm6 = _mm_mul_ps(xmm6,mat.row2);
|
||||
xmm7 = _mm_mul_ps(xmm7,mat.row3);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm5);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm6);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm7);
|
||||
return xmm4;
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixMultiply(float * matrix, const float * rightMatrix)
|
||||
{
|
||||
//this seems to generate larger code, including many movaps, but maybe it is less harsh on the registers than the
|
||||
//more hand-tailored approach
|
||||
__m128 row0 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix));
|
||||
__m128 row1 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+4));
|
||||
__m128 row2 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+8));
|
||||
__m128 row3 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+12));
|
||||
_mm_store_ps(matrix,row0);
|
||||
_mm_store_ps(matrix+4,row1);
|
||||
_mm_store_ps(matrix+8,row2);
|
||||
_mm_store_ps(matrix+12,row3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
FORCEINLINE void MatrixMultVec4x4(const float *matrix, float *vecPtr)
|
||||
{
|
||||
_mm_store_ps(vecPtr,_util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(vecPtr)));
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixMultVec4x4_M2(const float *matrix, float *vecPtr)
|
||||
{
|
||||
//there are hardly any gains from merging these manually
|
||||
MatrixMultVec4x4(matrix+16,vecPtr);
|
||||
MatrixMultVec4x4(matrix,vecPtr);
|
||||
}
|
||||
|
||||
|
||||
FORCEINLINE void MatrixMultVec3x3(const float * matrix, float * vecPtr)
|
||||
{
|
||||
const __m128 vec = _mm_load_ps(vecPtr);
|
||||
|
||||
__m128 xmm5 = _mm_shuffle_ps(vec, vec, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(vec, vec, B8(10101010));
|
||||
__m128 xmm4 = _mm_shuffle_ps(vec, vec, B8(00000000));
|
||||
|
||||
const SSE_MATRIX mat(matrix);
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,mat.row0);
|
||||
xmm5 = _mm_mul_ps(xmm5,mat.row1);
|
||||
xmm6 = _mm_mul_ps(xmm6,mat.row2);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm5);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm6);
|
||||
|
||||
_mm_store_ps(vecPtr,xmm4);
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixTranslate(float *matrix, const float *ptr)
|
||||
{
|
||||
__m128 xmm4 = _mm_load_ps(ptr);
|
||||
__m128 xmm5 = _mm_shuffle_ps(xmm4, xmm4, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(xmm4, xmm4, B8(10101010));
|
||||
xmm4 = _mm_shuffle_ps(xmm4, xmm4, B8(00000000));
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,_mm_load_ps(matrix));
|
||||
xmm5 = _mm_mul_ps(xmm5,_mm_load_ps(matrix+4));
|
||||
xmm6 = _mm_mul_ps(xmm6,_mm_load_ps(matrix+8));
|
||||
xmm4 = _mm_add_ps(xmm4,xmm5);
|
||||
xmm4 = _mm_add_ps(xmm4,xmm6);
|
||||
xmm4 = _mm_add_ps(xmm4,_mm_load_ps(matrix+12));
|
||||
_mm_store_ps(matrix+12,xmm4);
|
||||
}
|
||||
|
||||
FORCEINLINE void MatrixScale(float *matrix, const float *ptr)
|
||||
{
|
||||
__m128 xmm4 = _mm_load_ps(ptr);
|
||||
__m128 xmm5 = _mm_shuffle_ps(xmm4, xmm4, B8(01010101));
|
||||
__m128 xmm6 = _mm_shuffle_ps(xmm4, xmm4, B8(10101010));
|
||||
xmm4 = _mm_shuffle_ps(xmm4, xmm4, B8(00000000));
|
||||
|
||||
xmm4 = _mm_mul_ps(xmm4,_mm_load_ps(matrix));
|
||||
xmm5 = _mm_mul_ps(xmm5,_mm_load_ps(matrix+4));
|
||||
xmm6 = _mm_mul_ps(xmm6,_mm_load_ps(matrix+8));
|
||||
_mm_store_ps(matrix,xmm4);
|
||||
_mm_store_ps(matrix+4,xmm5);
|
||||
_mm_store_ps(matrix+8,xmm6);
|
||||
}
|
||||
|
||||
template<int NUM_ROWS>
|
||||
FORCEINLINE void vector_fix2float(float* matrix, const float divisor)
|
||||
{
|
||||
CTASSERT(NUM_ROWS==3 || NUM_ROWS==4);
|
||||
|
||||
const __m128 val = _mm_set_ps1(divisor);
|
||||
|
||||
_mm_store_ps(matrix,_mm_div_ps(_mm_load_ps(matrix),val));
|
||||
_mm_store_ps(matrix+4,_mm_div_ps(_mm_load_ps(matrix+4),val));
|
||||
_mm_store_ps(matrix+8,_mm_div_ps(_mm_load_ps(matrix+8),val));
|
||||
if(NUM_ROWS==4)
|
||||
_mm_store_ps(matrix+12,_mm_div_ps(_mm_load_ps(matrix+12),val));
|
||||
}
|
||||
|
||||
//WARNING: I do not think this is as fast as a memset, for some reason.
|
||||
//at least in vc2005 with sse enabled. better figure out why before using it
|
||||
template<int NUM>
|
||||
static FORCEINLINE void memset_u8(void* _dst, u8 val)
|
||||
{
|
||||
memset(_dst,val,NUM);
|
||||
//const u8* dst = (u8*)_dst;
|
||||
//u32 u32val = (val<<24)|(val<<16)|(val<<8)|val;
|
||||
//const __m128i temp = _mm_set_epi32(u32val,u32val,u32val,u32val);
|
||||
//MACRODO_N(NUM/16,_mm_store_si128((__m128i*)(dst+(X)*16), temp));
|
||||
}
|
||||
|
||||
#else //no sse
|
||||
|
||||
void MatrixMultVec4x4 (const float *matrix, float *vecPtr);
|
||||
void MatrixMultVec3x3(const float * matrix, float * vecPtr);
|
||||
void MatrixMultiply(float * matrix, const float * rightMatrix);
|
||||
void MatrixTranslate(float *matrix, const float *ptr);
|
||||
void MatrixScale(float * matrix, const float * ptr);
|
||||
|
||||
FORCEINLINE void MatrixMultVec4x4_M2(const float *matrix, float *vecPtr)
|
||||
{
|
||||
//there are hardly any gains from merging these manually
|
||||
MatrixMultVec4x4(matrix+16,vecPtr);
|
||||
MatrixMultVec4x4(matrix,vecPtr);
|
||||
}
|
||||
|
||||
template<int NUM_ROWS>
|
||||
FORCEINLINE void vector_fix2float(float* matrix, const float divisor)
|
||||
{
|
||||
for(int i=0;i<NUM_ROWS*4;i++)
|
||||
matrix[i] /= divisor;
|
||||
}
|
||||
|
||||
template<int NUM>
|
||||
static FORCEINLINE void memset_u8(void* dst, u8 val)
|
||||
{
|
||||
memset(dst,val,NUM);
|
||||
}
|
||||
|
||||
#endif //switched SSE functions
|
||||
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,314 +0,0 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "mapView.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include "../MMU.h"
|
||||
#include "../NDSSystem.h"
|
||||
#include "debug.h"
|
||||
#include "windriver.h"
|
||||
|
||||
using namespace GPU_EXT;
|
||||
|
||||
struct mapview_struct
|
||||
{
|
||||
u32 autoup_secs;
|
||||
bool autoup;
|
||||
|
||||
u8 map;
|
||||
u16 lcd;
|
||||
u16 bitmap[1024*1024];
|
||||
bool clear;
|
||||
|
||||
void render()
|
||||
{
|
||||
//we're going to make a copy of the gpu so that we don't wreck affine scroll params
|
||||
//hopefully we won't mess up anything else
|
||||
GPU *realGpu;
|
||||
if(lcd) realGpu = SubScreen.gpu;
|
||||
else realGpu = MainScreen.gpu;
|
||||
GPU &gpu = *realGpu;
|
||||
|
||||
//forgive the gyrations, some of this junk in here is to remind us of gyrations we might have to go
|
||||
//through to avoid breaking the gpu struct
|
||||
|
||||
gpu.currBgNum = map;
|
||||
gpu.debug = true;
|
||||
|
||||
for(u32 i = 0; i < gpu.BGSize[map][1]; ++i)
|
||||
{
|
||||
gpu.currDst = (u8 *)bitmap + i*gpu.BGSize[map][0]*2;
|
||||
gpu.currLine = i;
|
||||
gpu.modeRender<false>(map);
|
||||
}
|
||||
gpu.debug = false;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
mapview_struct *MapView = NULL;
|
||||
|
||||
|
||||
LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Lock lock;
|
||||
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
char text[80];
|
||||
u32 dispcnt = ((volatile u32 *)MMU.ARM9_REG)[(win->lcd*0x400)];
|
||||
u32 bgcnt = ((volatile u16 *)MMU.ARM9_REG)[(8 + (win->map<<1) + (win->lcd*0x1000))>>1];
|
||||
BITMAPV4HEADER bmi;
|
||||
u16 lg;
|
||||
u16 ht;
|
||||
BGxPARMS * parms;
|
||||
|
||||
//CreateBitmapIndirect(&bmi);
|
||||
memset(&bmi, 0, sizeof(bmi));
|
||||
bmi.bV4Size = sizeof(bmi);
|
||||
bmi.bV4Planes = 1;
|
||||
bmi.bV4BitCount = 16;
|
||||
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
|
||||
bmi.bV4RedMask = 0x001F;
|
||||
bmi.bV4GreenMask = 0x03E0;
|
||||
bmi.bV4BlueMask = 0x7C00;
|
||||
|
||||
if(win->lcd)
|
||||
{
|
||||
lg = SubScreen.gpu->BGSize[win->map][0];
|
||||
ht = SubScreen.gpu->BGSize[win->map][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
lg = MainScreen.gpu->BGSize[win->map][0];
|
||||
ht = MainScreen.gpu->BGSize[win->map][1];
|
||||
}
|
||||
bmi.bV4Width = lg;
|
||||
bmi.bV4Height = -ht;
|
||||
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
sprintf(text, "%d %08X, %08X", (int)(dispcnt&7), (int)dispcnt, (int)bgcnt);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_MODE), text);
|
||||
|
||||
if(!(bgcnt&(1<<7)))
|
||||
sprintf(text, "normal 16");
|
||||
else
|
||||
{
|
||||
if(!(dispcnt&(1<<30)))
|
||||
sprintf(text, "normal 256");
|
||||
else
|
||||
{
|
||||
switch(win->map)
|
||||
{
|
||||
case 0 :
|
||||
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?2:0);
|
||||
break;
|
||||
case 1 :
|
||||
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?3:1);
|
||||
break;
|
||||
default :
|
||||
sprintf(text, "extended slot %d", MainScreen.gpu->BGExtPalSlot[win->map]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_PAL), text);
|
||||
|
||||
sprintf(text, "%d", (int)(bgcnt&3));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
||||
|
||||
|
||||
if((dispcnt>>8>>win->map)&1)
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "true");
|
||||
else
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "false");
|
||||
|
||||
sprintf(text, "0x%08X", (int)(0x6000000 + ((bgcnt>>2)&0xF)*0x4000 + win->lcd*0x200000 +((dispcnt>>24)&7)*0x10000));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_CHAR), text);
|
||||
|
||||
sprintf(text, "0x%08X", (int)(0x6000000 + 0x800*((bgcnt>>8)&0x1F) + win->lcd*0x200000 + ((dispcnt>>27)&7)*0x10000));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_SCR), text);
|
||||
|
||||
//sprintf(text, "%d x %d", MainScreen.gpu->BGPA[win->map], MainScreen.gpu->BGPB[win->map]);
|
||||
sprintf(text, "%d x %d", (int)MainScreen.gpu->BGSize[win->map][0], (int)MainScreen.gpu->BGSize[win->map][1]);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_MSIZE), text);
|
||||
|
||||
//if (win->map==2) {
|
||||
// parms = &(MainScreen.gpu->dispx_st)->dispx_BG2PARMS;
|
||||
//} else {
|
||||
// parms = &(MainScreen.gpu->dispx_st)->dispx_BG3PARMS;
|
||||
//}
|
||||
//sprintf(text, "%d x %d", parms->BGxX, parms->BGxY);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), "useless");
|
||||
|
||||
for(int i = 0; i < ARRAY_SIZE(win->bitmap); i++)
|
||||
win->bitmap[i] = 0x7C1F;
|
||||
|
||||
win->render();
|
||||
|
||||
if(win->clear)
|
||||
{
|
||||
RECT r;
|
||||
r.left = 200;
|
||||
r.top = 4;
|
||||
r.right = 200 + 1024;
|
||||
r.bottom = 200 + 1024;
|
||||
HBRUSH brush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
||||
FillRect(hdc, &r, brush);
|
||||
DeleteObject(brush);
|
||||
win->clear = false;
|
||||
}
|
||||
|
||||
SetDIBitsToDevice(hdc, 200, 4, lg, ht, 0, 0, 0, ht, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||
|
||||
EndPaint(hwnd, &ps);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
//bail out early if the dialog isnt initialized
|
||||
if(!MapView && message != WM_INITDIALOG)
|
||||
return false;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
MapView = new mapview_struct;
|
||||
memset(MapView, 0, sizeof(MapView));
|
||||
MapView->clear = true;
|
||||
MapView->autoup_secs = 1;
|
||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||
UDM_SETRANGE, 0, MAKELONG(99, 1));
|
||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||
UDM_SETPOS32, 0, MapView->autoup_secs);
|
||||
HWND combo = GetDlgItem(hwnd, IDC_BG_SELECT);
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 0");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 1");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 2");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 3");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 0");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 1");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 2");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 3");
|
||||
SendMessage(combo, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
return 1;
|
||||
case WM_CLOSE :
|
||||
{
|
||||
if(MapView->autoup)
|
||||
{
|
||||
KillTimer(hwnd, IDT_VIEW_MAP);
|
||||
MapView->autoup = false;
|
||||
}
|
||||
if (MapView!=NULL)
|
||||
{
|
||||
delete MapView;
|
||||
MapView = NULL;
|
||||
}
|
||||
//INFO("Close Map view dialog\n");
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
case WM_PAINT:
|
||||
MapView_OnPaint(MapView, hwnd, wParam, lParam);
|
||||
return 1;
|
||||
case WM_TIMER:
|
||||
SendMessage(hwnd, WM_COMMAND, IDC_REFRESH, 0);
|
||||
return 1;
|
||||
case WM_COMMAND :
|
||||
switch (LOWORD (wParam))
|
||||
{
|
||||
case IDC_FERMER :
|
||||
SendMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
return 1;
|
||||
case IDC_AUTO_UPDATE :
|
||||
if(MapView->autoup)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), false);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), false);
|
||||
KillTimer(hwnd, IDT_VIEW_MAP);
|
||||
MapView->autoup = FALSE;
|
||||
return 1;
|
||||
}
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), true);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), true);
|
||||
MapView->autoup = TRUE;
|
||||
SetTimer(hwnd, IDT_VIEW_MAP, MapView->autoup_secs*20, (TIMERPROC) NULL);
|
||||
return 1;
|
||||
case IDC_AUTO_UPDATE_SECS:
|
||||
{
|
||||
int t = GetDlgItemInt(hwnd, IDC_AUTO_UPDATE_SECS, FALSE, TRUE);
|
||||
if (!MapView)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
}
|
||||
if (t != MapView->autoup_secs)
|
||||
{
|
||||
MapView->autoup_secs = t;
|
||||
if (MapView->autoup)
|
||||
SetTimer(hwnd, IDT_VIEW_MAP,
|
||||
MapView->autoup_secs*20, (TIMERPROC) NULL);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
case IDC_REFRESH:
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return 1;
|
||||
case IDC_BG_SELECT :
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
case CBN_SELCHANGE :
|
||||
case CBN_CLOSEUP :
|
||||
{
|
||||
u32 sel= SendMessage(GetDlgItem(hwnd, IDC_BG_SELECT), CB_GETCURSEL, 0, 0);
|
||||
switch(sel)
|
||||
{
|
||||
case 0 :
|
||||
case 1 :
|
||||
case 2 :
|
||||
case 3 :
|
||||
MapView->map = sel;
|
||||
MapView->lcd = 0;
|
||||
break;
|
||||
case 4 :
|
||||
case 5 :
|
||||
case 6 :
|
||||
case 7 :
|
||||
MapView->map = sel-4;
|
||||
MapView->lcd = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MapView->clear = true;
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return 1;
|
||||
}//switch et case
|
||||
}//switch
|
||||
return 1;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ARM9_H
|
||||
#define ARM9_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
struct ALIGN(16) ARM9_struct {
|
||||
//ARM9 mem
|
||||
u8 ARM9_ITCM[0x8000];
|
||||
u8 ARM9_DTCM[0x4000];
|
||||
u8 MAIN_MEM[0x800000]; //this has been expanded to 8MB to support debug consoles
|
||||
u8 ARM9_REG[0x1000000];
|
||||
u8 ARM9_BIOS[0x8000];
|
||||
u8 ARM9_VMEM[0x800];
|
||||
|
||||
#include "PACKED.h"
|
||||
struct {
|
||||
u8 ARM9_LCD[0xA4000];
|
||||
//an extra 128KB for blank memory, directly after arm9_lcd, so that
|
||||
//we can easily map things to the end of arm9_lcd to represent
|
||||
//an unmapped state
|
||||
u8 blank_memory[0x20000];
|
||||
};
|
||||
#include "PACKED_END.h"
|
||||
|
||||
u8 ARM9_OAM[0x800];
|
||||
|
||||
u8* ExtPal[2][4];
|
||||
u8* ObjExtPal[2][2];
|
||||
|
||||
struct TextureInfo {
|
||||
u8* texPalSlot[6];
|
||||
u8* textureSlotAddr[4];
|
||||
} texInfo;
|
||||
|
||||
};
|
||||
|
||||
extern ARM9_struct ARM9Mem;
|
||||
|
||||
#endif
|
|
@ -265,7 +265,7 @@ const char MSR_FIELD[16][5] = {
|
|||
}\
|
||||
}\
|
||||
}\
|
||||
if(*lreg) lreg[strlen(lreg)-1]='\0';
|
||||
lreg[strlen(lreg)-1]='\0';
|
||||
|
||||
static char * OP_UND(u32 adr, u32 i, char * txt)
|
||||
{
|
|
@ -28,19 +28,11 @@
|
|||
#include "debug.h"
|
||||
#include "mem.h"
|
||||
#include "MMU.h"
|
||||
#include "NDSSystem.h"
|
||||
|
||||
// ========================================================= IPC FIFO
|
||||
IPC_FIFO ipc_fifo[2]; // 0 - ARM9
|
||||
// 1 - ARM7
|
||||
|
||||
u8 FORCEINLINE IPC_FIFOgetSize(u8 proc)
|
||||
{
|
||||
if (ipc_fifo[proc].head < ipc_fifo[proc].tail) return (ipc_fifo[proc].tail - ipc_fifo[proc].head);
|
||||
if (ipc_fifo[proc].head > ipc_fifo[proc].tail) return (16 - (ipc_fifo[proc].head - ipc_fifo[proc].tail));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IPC_FIFOinit(u8 proc)
|
||||
{
|
||||
memset(&ipc_fifo[proc], 0, sizeof(IPC_FIFO));
|
||||
|
@ -53,7 +45,7 @@ void IPC_FIFOsend(u8 proc, u32 val)
|
|||
if (!(cnt_l & 0x8000)) return; // FIFO disabled
|
||||
u8 proc_remote = proc ^ 1;
|
||||
|
||||
if (ipc_fifo[proc].size > 15)
|
||||
if (ipc_fifo[proc].tail > 15)
|
||||
{
|
||||
cnt_l |= 0x4000;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
|
@ -67,12 +59,9 @@ void IPC_FIFOsend(u8 proc, u32 val)
|
|||
|
||||
cnt_l &= 0xBFFC; // clear send empty bit & full
|
||||
cnt_r &= 0xBCFF; // set recv empty bit & full
|
||||
ipc_fifo[proc].buf[ipc_fifo[proc].tail] = val;
|
||||
ipc_fifo[proc].tail++;
|
||||
ipc_fifo[proc].size = IPC_FIFOgetSize(proc);
|
||||
if (ipc_fifo[proc].tail > 15) ipc_fifo[proc].tail = 0;
|
||||
ipc_fifo[proc].buf[ipc_fifo[proc].tail++] = val;
|
||||
|
||||
if (ipc_fifo[proc].size > 15)
|
||||
if (ipc_fifo[proc].tail > 15)
|
||||
{
|
||||
cnt_l |= 0x0002; // set send full bit
|
||||
cnt_r |= 0x0200; // set recv full bit
|
||||
|
@ -81,7 +70,7 @@ void IPC_FIFOsend(u8 proc, u32 val)
|
|||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
|
||||
|
||||
setIF(proc_remote, ((cnt_l & 0x0400)<<8)); // IRQ18: recv not empty
|
||||
setIF(proc_remote, ((cnt_l & 0x0400)<<8));
|
||||
}
|
||||
|
||||
u32 IPC_FIFOrecv(u8 proc)
|
||||
|
@ -92,7 +81,7 @@ u32 IPC_FIFOrecv(u8 proc)
|
|||
|
||||
u32 val = 0;
|
||||
|
||||
if ( ipc_fifo[proc_remote].size == 0 ) // remote FIFO error
|
||||
if ( ipc_fifo[proc_remote].tail == 0 ) // remote FIFO error
|
||||
{
|
||||
cnt_l |= 0x4000;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
|
@ -104,15 +93,16 @@ u32 IPC_FIFOrecv(u8 proc)
|
|||
cnt_l &= 0xBCFF; // clear send full bit & empty
|
||||
cnt_r &= 0xBFFC; // set recv full bit & empty
|
||||
|
||||
val = ipc_fifo[proc_remote].buf[ipc_fifo[proc_remote].head];
|
||||
ipc_fifo[proc_remote].head++;
|
||||
ipc_fifo[proc_remote].size = IPC_FIFOgetSize(proc_remote);
|
||||
if (ipc_fifo[proc_remote].head > 15) ipc_fifo[proc_remote].head = 0;
|
||||
val = ipc_fifo[proc_remote].buf[0];
|
||||
|
||||
//LOG("IPC%s recv FIFO 0x%08X (l 0x%X, tail %02i) (r 0x%X, tail %02i)\n",
|
||||
// proc?"7":"9", val, cnt_l, ipc_fifo[proc].tail, cnt_r, ipc_fifo[proc^1].tail);
|
||||
|
||||
if ( ipc_fifo[proc_remote].size == 0 ) // FIFO empty
|
||||
ipc_fifo[proc_remote].tail--;
|
||||
for (int i = 0; i < ipc_fifo[proc_remote].tail; i++)
|
||||
ipc_fifo[proc_remote].buf[i] = ipc_fifo[proc_remote].buf[i+1];;
|
||||
|
||||
if ( ipc_fifo[proc_remote].tail == 0 ) // FIFO empty
|
||||
{
|
||||
cnt_l |= 0x0100;
|
||||
cnt_r |= 0x0001;
|
||||
|
@ -121,7 +111,7 @@ u32 IPC_FIFOrecv(u8 proc)
|
|||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
|
||||
|
||||
setIF(proc_remote, ((cnt_l & 0x0004)<<15)); // IRQ17: send empty
|
||||
setIF(proc_remote, ((cnt_l & 0x0004)<<15));
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
@ -146,205 +136,116 @@ void IPC_FIFOcnt(u8 proc, u16 val)
|
|||
}
|
||||
|
||||
// ========================================================= GFX FIFO
|
||||
GFX_PIPE gxPIPE;
|
||||
GFX_FIFO gxFIFO;
|
||||
|
||||
void GFX_PIPEclear()
|
||||
{
|
||||
gxPIPE.head = 0;
|
||||
gxPIPE.tail = 0;
|
||||
gxPIPE.size = 0;
|
||||
}
|
||||
|
||||
void GFX_FIFOclear()
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0x0000FFFF;
|
||||
|
||||
gxFIFO.head = 0;
|
||||
gxFIFO.tail = 0;
|
||||
gxFIFO.size = 0;
|
||||
gxstat |= 0x06000000;
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//INFO("gxFIFO: send 0x%02X = 0x%08X (size %03i/0x%02X) gxstat 0x%08X\n", cmd, param, gxFIFO.size, gxFIFO.size, gxstat);
|
||||
if (gxstat & 0x01000000) return; // full
|
||||
|
||||
gxstat &= 0xF000FFFF;
|
||||
|
||||
if (gxFIFO.size == 0) // FIFO empty
|
||||
{
|
||||
gxstat |= 0x06000000;
|
||||
if (gxPIPE.size < 4) // pipe not full
|
||||
{
|
||||
gxPIPE.cmd[gxPIPE.tail] = cmd;
|
||||
gxPIPE.param[gxPIPE.tail] = param;
|
||||
gxPIPE.tail++;
|
||||
gxPIPE.size++;
|
||||
if (gxPIPE.tail > 3) gxPIPE.tail = 0;
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x08000000; // set busy flag
|
||||
#endif
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
NDS_RescheduleGXFIFO();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gxFIFO.size > 255)
|
||||
{
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x01000000; // full
|
||||
gxstat |= 0x08000000; // busy
|
||||
#else
|
||||
gxstat |= 0x02000000; // this is hack (must be removed later)
|
||||
#endif
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
NDS_RescheduleGXFIFO();
|
||||
//INFO("ERROR: gxFIFO is full (cmd 0x%02X = 0x%08X) (prev cmd 0x%02X = 0x%08X)\n", cmd, param, gxFIFO.cmd[255], gxFIFO.param[255]);
|
||||
return;
|
||||
}
|
||||
|
||||
gxFIFO.cmd[gxFIFO.tail] = cmd;
|
||||
gxFIFO.param[gxFIFO.tail] = param;
|
||||
gxFIFO.tail++;
|
||||
gxFIFO.size++;
|
||||
if (gxFIFO.tail > 255) gxFIFO.tail = 0;
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x08000000; // set busy flag
|
||||
#endif
|
||||
|
||||
gxstat |= ((gxFIFO.size & 0x1FF) << 16);
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
|
||||
if (gxFIFO.size < 128) // less half
|
||||
{
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
}
|
||||
|
||||
#ifndef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x02000000; // this is hack (must be removed later)
|
||||
#endif
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
NDS_RescheduleGXFIFO();
|
||||
}
|
||||
|
||||
// this function used ONLY in gxFIFO
|
||||
BOOL GFX_PIPErecv(u8 *cmd, u32 *param)
|
||||
BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0xF7FFFFFF; // clear busy flag
|
||||
|
||||
if (gxPIPE.size > 0)
|
||||
{
|
||||
*cmd = gxPIPE.cmd[gxPIPE.head];
|
||||
*param = gxPIPE.param[gxPIPE.head];
|
||||
gxPIPE.head++;
|
||||
gxPIPE.size--;
|
||||
if (gxPIPE.head > 3) gxPIPE.head = 0;
|
||||
|
||||
if (gxPIPE.size < 3)
|
||||
{
|
||||
if (gxFIFO.size > 0)
|
||||
{
|
||||
gxstat &= 0xF000FFFF;
|
||||
|
||||
gxPIPE.cmd[gxPIPE.tail] = gxFIFO.cmd[gxFIFO.head];
|
||||
gxPIPE.param[gxPIPE.tail] = gxFIFO.param[gxFIFO.head];
|
||||
gxPIPE.tail++;
|
||||
gxPIPE.size++;
|
||||
if (gxPIPE.tail > 3) gxPIPE.tail = 0;
|
||||
|
||||
gxFIFO.head++;
|
||||
gxFIFO.size--;
|
||||
if (gxFIFO.head > 255) gxFIFO.head = 0;
|
||||
|
||||
if (gxFIFO.size > 0)
|
||||
{
|
||||
gxPIPE.cmd[gxPIPE.tail] = gxFIFO.cmd[gxFIFO.head];
|
||||
gxPIPE.param[gxPIPE.tail] = gxFIFO.param[gxFIFO.head];
|
||||
gxPIPE.tail++;
|
||||
gxPIPE.size++;
|
||||
if (gxPIPE.tail > 3) gxPIPE.tail = 0;
|
||||
|
||||
gxFIFO.head++;
|
||||
gxFIFO.size--;
|
||||
if (gxFIFO.head > 255) gxFIFO.head = 0;
|
||||
}
|
||||
|
||||
gxstat |= ((gxFIFO.size & 0x1FF) << 16);
|
||||
|
||||
if (gxFIFO.size < 128)
|
||||
{
|
||||
gxstat |= 0x02000000;
|
||||
if (gxstat & 0x40000000) // IRQ: less half
|
||||
#if 0
|
||||
if (gxstat & 0xC0000000)
|
||||
{
|
||||
setIF(0, (1<<21));
|
||||
}
|
||||
execHardware_doAllDma(EDMAMode_GXFifo);
|
||||
}
|
||||
|
||||
if (gxFIFO.size == 0) // empty
|
||||
{
|
||||
gxstat |= 0x04000000;
|
||||
if (gxstat & 0x80000000) // IRQ: empty
|
||||
setIF(0, (1<<21));
|
||||
}
|
||||
}
|
||||
else // FIFO empty
|
||||
#endif
|
||||
if (gxFIFO.tail == 0) // empty
|
||||
{
|
||||
gxstat &= 0xF000FFFF;
|
||||
gxstat |= 0x06000000;
|
||||
if (gxstat & 0x80000000) // IRQ: empty
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
if ((gxstat & 0x80000000)) // empty
|
||||
{
|
||||
setIF(0, (1<<21));
|
||||
}
|
||||
}
|
||||
|
||||
if (gxPIPE.size > 0)
|
||||
gxstat |= 0x08000000; // set busy flag
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
if (gxstat & 0x80000000) // IRQ: empty
|
||||
setIF(0, (1<<21));
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gxstat & 0x40000000) // IRQ: less half
|
||||
{
|
||||
if (gxstat & 0x02000000) setIF(0, (1<<21));
|
||||
}
|
||||
|
||||
if ((gxstat & 0x80000000)) // IRQ: empty
|
||||
{
|
||||
if (gxstat & 0x04000000) setIF(0, (1<<21));
|
||||
}
|
||||
|
||||
gxstat &= 0xF000FFFF;
|
||||
*cmd = gxFIFO.cmd[0];
|
||||
*param = gxFIFO.param[0];
|
||||
gxFIFO.tail--;
|
||||
for (int i=0; i < gxFIFO.tail; i++)
|
||||
{
|
||||
gxFIFO.cmd[i] = gxFIFO.cmd[i+1];
|
||||
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;
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern void gfx3d_ClearStack();
|
||||
void GFX_FIFOcnt(u32 val)
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
//INFO("gxFIFO: write cnt 0x%08X (prev 0x%08X) FIFO size %03i PIPE size %03i\n", val, gxstat, gxFIFO.size, gxPIPE.size);
|
||||
|
||||
if (val & (1<<29)) // clear? (only in homebrew?)
|
||||
//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;
|
||||
}
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
if (val & (1<<15)) // projection stack pointer reset
|
||||
/*if (gxstat & 0xC0000000)
|
||||
{
|
||||
gfx3d_ClearStack();
|
||||
val &= 0xFFFF5FFF; // clear reset (bit15) & stack level (bit13)
|
||||
}
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, val);
|
||||
|
||||
if (gxFIFO.size == 0) // empty
|
||||
{
|
||||
if (val & 0x80000000) // IRQ: empty
|
||||
setIF(0, (1<<21));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// ========================================================= DISP FIFO
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef FIFO_H
|
||||
#define FIFO_H
|
||||
|
||||
//#define USE_GEOMETRY_FIFO_EMULATION //enable gxFIFO emulation
|
||||
//#define USE_GEOMETRY_FIFO_EMULATION //enables new experimental gxFIFO
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
@ -35,9 +35,7 @@ typedef struct
|
|||
{
|
||||
u32 buf[16];
|
||||
|
||||
u8 head;
|
||||
u8 tail;
|
||||
u8 size;
|
||||
} IPC_FIFO;
|
||||
|
||||
extern IPC_FIFO ipc_fifo[2];
|
||||
|
@ -49,30 +47,16 @@ extern void IPC_FIFOcnt(u8 proc, u16 val);
|
|||
//=================================================== GFX FIFO
|
||||
typedef struct
|
||||
{
|
||||
u8 cmd[256];
|
||||
u32 param[256];
|
||||
u8 cmd[261];
|
||||
u32 param[261];
|
||||
|
||||
u16 head; // start position
|
||||
u16 tail; // tail
|
||||
u16 size; // size FIFO buffer
|
||||
} GFX_FIFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 cmd[4];
|
||||
u32 param[4];
|
||||
|
||||
u8 head;
|
||||
u8 tail;
|
||||
u8 size;
|
||||
} 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_PIPErecv(u8 *cmd, u32 *param);
|
||||
extern BOOL GFX_FIFOrecv(u8 *cmd, u32 *param);
|
||||
extern void GFX_FIFOcnt(u32 val);
|
||||
|
||||
//=================================================== Display memory FIFO
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,7 @@
|
|||
#ifndef GPU_H
|
||||
#define GPU_H
|
||||
|
||||
#include "ARM9.h"
|
||||
#include <stdio.h>
|
||||
#include "mem.h"
|
||||
#include "common.h"
|
||||
|
@ -122,10 +123,6 @@ typedef union
|
|||
#define BGxENABLED(cnt,num) ((num<8)? ((cnt.val>>8) & num):0)
|
||||
|
||||
|
||||
enum BlendFunc
|
||||
{
|
||||
None, Blend, Increase, Decrease
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -364,6 +361,8 @@ struct DISPCAPCNT
|
|||
u8 readBlock;
|
||||
u8 readOffset;
|
||||
u8 capSrc;
|
||||
u8 *dst;
|
||||
u8 *src;
|
||||
} ;
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -604,25 +603,16 @@ typedef struct
|
|||
#define NB_BG 4
|
||||
typedef struct
|
||||
{
|
||||
u8 PixelsX[256];
|
||||
u8 BGs[NB_BG], nbBGs;
|
||||
u8 pad[1];
|
||||
u8 PixelsX[256];
|
||||
// doh ! yoda says : 256 pixels we can have...
|
||||
u16 nbPixelsX;
|
||||
//256+8:
|
||||
u8 pad2[248];
|
||||
|
||||
//things were slower when i organized this struct this way. whatever.
|
||||
//u8 PixelsX[256];
|
||||
//int BGs[NB_BG], nbBGs;
|
||||
//int nbPixelsX;
|
||||
////<-- 256 + 24
|
||||
//u8 pad2[256-24];
|
||||
} itemsForPriority_t;
|
||||
#define MMU_ABG 0x06000000
|
||||
#define MMU_BBG 0x06200000
|
||||
#define MMU_AOBJ 0x06400000
|
||||
#define MMU_BOBJ 0x06600000
|
||||
#define MMU_LCDC 0x06800000
|
||||
#define ARM9MEM_ABG 0x06000000
|
||||
#define ARM9MEM_BBG 0x06200000
|
||||
#define ARM9MEM_AOBJ 0x06400000
|
||||
#define ARM9MEM_BOBJ 0x06600000
|
||||
#define ARM9MEM_LCDC 0x06800000
|
||||
|
||||
extern CACHE_ALIGN u8 gpuBlendTable555[17][17][32][32];
|
||||
|
||||
|
@ -715,14 +705,14 @@ struct GPU
|
|||
u8 WIN1V1;
|
||||
|
||||
u8 WININ0;
|
||||
bool WININ0_SPECIAL;
|
||||
u8 WININ0_SPECIAL;
|
||||
u8 WININ1;
|
||||
bool WININ1_SPECIAL;
|
||||
u8 WININ1_SPECIAL;
|
||||
|
||||
u8 WINOUT;
|
||||
bool WINOUT_SPECIAL;
|
||||
u8 WINOUT_SPECIAL;
|
||||
u8 WINOBJ;
|
||||
bool WINOBJ_SPECIAL;
|
||||
u8 WINOBJ_SPECIAL;
|
||||
|
||||
u8 WIN0_ENABLED;
|
||||
u8 WIN1_ENABLED;
|
||||
|
@ -738,14 +728,15 @@ struct GPU
|
|||
u8 MasterBrightMode;
|
||||
u32 MasterBrightFactor;
|
||||
|
||||
CACHE_ALIGN u8 bgPixels[1024]; //yes indeed, this is oversized. map debug tools try to write to it
|
||||
u8 bgPixels[256];
|
||||
|
||||
u32 currLine;
|
||||
u8 currLine;
|
||||
u8 currBgNum;
|
||||
bool blend1;
|
||||
u8* currDst;
|
||||
|
||||
u8* _3dColorLine;
|
||||
u16* _3dColorLine;
|
||||
u8* _3dAlphaLine;
|
||||
|
||||
|
||||
static struct MosaicLookup {
|
||||
|
@ -772,16 +763,13 @@ struct GPU
|
|||
|
||||
u16 blend(u16 colA, u16 colB);
|
||||
|
||||
template<bool BACKDROP, BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL bool _master_setFinalBGColor(u16 &color, const u32 x);
|
||||
|
||||
template<BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL void _master_setFinal3dColor(int dstX, int srcX);
|
||||
typedef void (*FinalOBJColFunct)(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u8 type, u16 x);
|
||||
typedef void (*Final3DColFunct)(GPU *gpu, int dstX, int srcX);
|
||||
|
||||
int setFinalColorBck_funcNum;
|
||||
int bgFunc;
|
||||
int setFinalColor3d_funcNum;
|
||||
int setFinalColorSpr_funcNum;
|
||||
FinalOBJColFunct setFinalColorSpr;
|
||||
//Final3DColFunct setFinalColor3D;
|
||||
enum SpriteRenderMode {
|
||||
SPRITE_1D, SPRITE_2D
|
||||
|
@ -789,22 +777,31 @@ struct GPU
|
|||
|
||||
template<GPU::SpriteRenderMode MODE>
|
||||
void _spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab);
|
||||
void spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab);
|
||||
|
||||
inline void spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab)
|
||||
{
|
||||
if(spriteRenderMode == SPRITE_1D)
|
||||
_spriteRender<SPRITE_1D>(dst,dst_alpha,typeTab, prioTab);
|
||||
else
|
||||
_spriteRender<SPRITE_2D>(dst,dst_alpha,typeTab, prioTab);
|
||||
}
|
||||
|
||||
|
||||
template<bool BACKDROP> void setFinalColorBG(u16 color, u8 x);
|
||||
void setFinalColor3d(int dstX, int srcX);
|
||||
|
||||
template<bool BACKDROP, int FUNCNUM> void setFinalColorBG(u16 color, const u32 x);
|
||||
template<bool MOSAIC, bool BACKDROP> FORCEINLINE void __setFinalColorBck(u16 color, const u32 x, const int opaque);
|
||||
template<bool MOSAIC, bool BACKDROP, int FUNCNUM> FORCEINLINE void ___setFinalColorBck(u16 color, const u32 x, const int opaque);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialNone(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialBlend(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialIncrease(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialDecrease(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialNoneWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialBlendWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialIncreaseWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialDecreaseWnd(u16 &color, u8 x);
|
||||
|
||||
FORCEINLINE void setFinal3DColorSpecialNone(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialBlend(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialIncrease(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialDecrease(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialNoneWnd(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialBlendWnd(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialIncreaseWnd(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialDecreaseWnd(int dstX, int srcX);
|
||||
|
||||
|
||||
template<bool MOSAIC, bool BACKDROP> void __setFinalColorBck(u16 color, const u8 x, const bool opaque);
|
||||
void setAffineStart(int layer, int xy, u32 val);
|
||||
void setAffineStartWord(int layer, int xy, u16 val, int word);
|
||||
u32 getAffineStart(int layer, int xy);
|
||||
|
@ -819,7 +816,7 @@ struct GPU
|
|||
|
||||
// check whether (x,y) is within the rectangle (including wraparounds)
|
||||
template<int WIN_NUM>
|
||||
u8 withinRect(u16 x) const;
|
||||
bool withinRect(u8 x) const;
|
||||
|
||||
void setBLDALPHA(u16 val)
|
||||
{
|
||||
|
@ -936,7 +933,7 @@ 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, bool skip = false) ;
|
||||
void GPU_ligne(NDS_Screen * screen, u16 l) ;
|
||||
void GPU_setMasterBrightness (GPU *gpu, u16 val);
|
||||
|
||||
inline void GPU_setWIN0_H(GPU* gpu, u16 val) { gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF; gpu->need_update_winh[0] = true; }
|
||||
|
@ -957,9 +954,9 @@ inline void GPU_setWIN1_V1(GPU* gpu, u8 val) { gpu->WIN1V1 = val; }
|
|||
|
||||
inline void GPU_setWININ(GPU* gpu, u16 val) {
|
||||
gpu->WININ0=val&0x1F;
|
||||
gpu->WININ0_SPECIAL=((val>>5)&1)!=0;
|
||||
gpu->WININ0_SPECIAL=(val>>5)&1;
|
||||
gpu->WININ1=(val>>8)&0x1F;
|
||||
gpu->WININ1_SPECIAL=((val>>13)&1)!=0;
|
||||
gpu->WININ1_SPECIAL=(val>>13)&1;
|
||||
}
|
||||
|
||||
inline void GPU_setWININ0(GPU* gpu, u8 val) { gpu->WININ0 = val&0x1F; gpu->WININ0_SPECIAL = (val>>5)&1; }
|
||||
|
@ -967,9 +964,9 @@ inline void GPU_setWININ1(GPU* gpu, u8 val) { gpu->WININ1 = val&0x1F; gpu->WININ
|
|||
|
||||
inline void GPU_setWINOUT16(GPU* gpu, u16 val) {
|
||||
gpu->WINOUT=val&0x1F;
|
||||
gpu->WINOUT_SPECIAL=((val>>5)&1)!=0;
|
||||
gpu->WINOUT_SPECIAL=(val>>5)&1;
|
||||
gpu->WINOBJ=(val>>8)&0x1F;
|
||||
gpu->WINOBJ_SPECIAL=((val>>13)&1)!=0;
|
||||
gpu->WINOBJ_SPECIAL=(val>>13)&1;
|
||||
}
|
||||
inline void GPU_setWINOUT(GPU* gpu, u8 val) { gpu->WINOUT = val&0x1F; gpu->WINOUT_SPECIAL = (val>>5)&1; }
|
||||
inline void GPU_setWINOBJ(GPU* gpu, u8 val) { gpu->WINOBJ = val&0x1F; gpu->WINOBJ_SPECIAL = (val>>5)&1; }
|
|
@ -45,13 +45,13 @@ HudStruct Hud;
|
|||
//contains a timer to be used for well-timed hud components
|
||||
static s64 hudTimer;
|
||||
|
||||
static void SetHudDummy (HudCoordinates *hud)
|
||||
void SetHudDummy (HudCoordinates *hud)
|
||||
{
|
||||
hud->x=666;
|
||||
hud->y=666;
|
||||
}
|
||||
|
||||
static bool IsHudDummy (HudCoordinates *hud)
|
||||
bool IsHudDummy (HudCoordinates *hud)
|
||||
{
|
||||
return (hud->x == 666 && hud->y == 666);
|
||||
}
|
||||
|
@ -123,11 +123,6 @@ void HudStruct::reset()
|
|||
InputDisplay.xsize=120;
|
||||
InputDisplay.ysize=10;
|
||||
|
||||
GraphicalInputDisplay.x=8;
|
||||
GraphicalInputDisplay.y=328;
|
||||
GraphicalInputDisplay.xsize=100;
|
||||
GraphicalInputDisplay.ysize=40;
|
||||
|
||||
LagFrameCounter.x=0;
|
||||
LagFrameCounter.y=65;
|
||||
LagFrameCounter.xsize=30;
|
||||
|
@ -146,78 +141,6 @@ void HudStruct::reset()
|
|||
SetHudDummy(&Dummy);
|
||||
}
|
||||
|
||||
void joyFill(int n) {
|
||||
|
||||
if(nds.pad & (1 << n))
|
||||
aggDraw.hud->fillColor(0,0,0,255);
|
||||
else
|
||||
aggDraw.hud->fillColor(255,255,255,255);
|
||||
}
|
||||
|
||||
void joyEllipse(double ex, double ey, int xc, int yc, int x, int y, double ratio, double rad, int button) {
|
||||
|
||||
joyFill(button);
|
||||
aggDraw.hud->ellipse(x+((xc*ex)*ratio), y+((yc*ey)*ratio), rad*ratio, rad*ratio);
|
||||
}
|
||||
|
||||
void gradientFill(double x1,double y1,double x2,double y2,AggColor c1,AggColor c2, int n) {
|
||||
|
||||
if(nds.pad & (1 << n))
|
||||
aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,c1,c2);
|
||||
else
|
||||
aggDraw.hud->fillColor(255,255,255,255);
|
||||
}
|
||||
|
||||
void drawPad(int x, int y, double ratio) {
|
||||
|
||||
int xc = 41;
|
||||
int yc = 20;
|
||||
|
||||
aggDraw.hud->lineColor(128,128,128,255);
|
||||
|
||||
aggDraw.hud->fillLinearGradient(x, y, x+(xc*ratio), y+(yc*ratio), agg::rgba8(222,222,222,128), agg::rgba8(255,255,255,255));
|
||||
|
||||
if(nds.pad & (1 << 2))
|
||||
aggDraw.hud->fillLinearGradient(x, y, x+(xc*ratio), y+(yc*ratio), agg::rgba8(0,0,0,128), agg::rgba8(255,255,255,255));
|
||||
|
||||
if(nds.pad & (1 << 1))
|
||||
aggDraw.hud->fillLinearGradient(x+(xc*ratio), y+(yc*ratio), x, y, agg::rgba8(0,0,0,128), agg::rgba8(255,255,255,255));
|
||||
|
||||
aggDraw.hud->roundedRect (x, y, x+(xc*ratio), y+(yc*ratio), 1);
|
||||
|
||||
aggDraw.hud->fillLinearGradient(x+(xc*.25*ratio), y+(yc*.1*ratio), x+(xc*.75*ratio), y+(yc*.85*ratio), agg::rgba8(128,128,128,128), agg::rgba8(255,255,255,255));
|
||||
|
||||
aggDraw.hud->roundedRect (x+(xc*.25*ratio), y+(yc*.1*ratio), x+(xc*.75*ratio),y+(yc*.85*ratio), 1);
|
||||
|
||||
joyEllipse(.89,.45,xc,yc,x,y,ratio,1,6);//B
|
||||
joyEllipse(.89,.22,xc,yc,x,y,ratio,1,3);//X
|
||||
joyEllipse(.83,.34,xc,yc,x,y,ratio,1,4);//Y
|
||||
joyEllipse(.95,.34,xc,yc,x,y,ratio,1,5);//A
|
||||
joyEllipse(.82,.72,xc,yc,x,y,ratio,.5,7);//Start
|
||||
joyEllipse(.82,.85,xc,yc,x,y,ratio,.5,8);//Select
|
||||
|
||||
aggDraw.hud->noLine();
|
||||
aggDraw.hud->fillColor(255,255,255,200);
|
||||
|
||||
//left
|
||||
gradientFill(x+(xc*.04*ratio), y+(yc*.33*ratio), x+(xc*.17*ratio), y+(yc*.43*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255),11);
|
||||
|
||||
//right
|
||||
if(nds.pad & (1 << 12))
|
||||
aggDraw.hud->fillLinearGradient(x+(xc*.17*ratio), y+(yc*.43*ratio), x+(xc*.04*ratio), y+(yc*.33*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255));
|
||||
|
||||
aggDraw.hud->roundedRect (x+(xc*.04*ratio), y+(yc*.33*ratio), x+(xc*.17*ratio), y+(yc*.43*ratio), 1);
|
||||
|
||||
//down
|
||||
gradientFill(x+(xc*.13*ratio), y+(yc*.52*ratio), x+(xc*.08*ratio), y+(yc*.23*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255),10);
|
||||
|
||||
//up
|
||||
if(nds.pad & (1<< 9))
|
||||
aggDraw.hud->fillLinearGradient(x+(xc*.08*ratio), y+(yc*.23*ratio), x+(xc*.13*ratio), y+(yc*.52*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255));
|
||||
|
||||
aggDraw.hud->roundedRect (x+(xc*.08*ratio), y+(yc*.23*ratio), x+(xc*.13*ratio), y+(yc*.52*ratio), 1);
|
||||
}
|
||||
|
||||
|
||||
struct TouchInfo{
|
||||
u16 X;
|
||||
|
@ -340,9 +263,6 @@ void DrawHUD()
|
|||
osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
|
||||
}
|
||||
|
||||
if (CommonSettings.hud.ShowGraphicalInputDisplay)
|
||||
drawPad(Hud.GraphicalInputDisplay.x, Hud.GraphicalInputDisplay.y, 2.5);
|
||||
|
||||
#ifdef WIN32
|
||||
if (CommonSettings.hud.ShowMicrophone)
|
||||
{
|
|
@ -56,7 +56,6 @@ public:
|
|||
HudCoordinates FpsDisplay;
|
||||
HudCoordinates FrameCounter;
|
||||
HudCoordinates InputDisplay;
|
||||
HudCoordinates GraphicalInputDisplay;
|
||||
HudCoordinates LagFrameCounter;
|
||||
HudCoordinates Microphone;
|
||||
HudCoordinates Dummy;
|
||||
|
@ -67,6 +66,7 @@ public:
|
|||
int fps, fps3d;
|
||||
};
|
||||
|
||||
void ResetHud(HudStruct *hudstruct);
|
||||
void EditHud(s32 x, s32 y, HudStruct *hudstruct);
|
||||
void HudClickRelease(HudStruct *hudstruct);
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -26,65 +26,28 @@
|
|||
#define MMU_H
|
||||
|
||||
#include "FIFO.h"
|
||||
#include "dscard.h"
|
||||
#include "mem.h"
|
||||
|
||||
#include "ARM9.h"
|
||||
#include "mc.h"
|
||||
|
||||
//HACK!!!! REMOVE ME SOON!
|
||||
#ifndef ARMCPU_ARM7
|
||||
#define ARMCPU_ARM7 1
|
||||
#define ARMCPU_ARM9 0
|
||||
#define ARMPROC (PROCNUM ? NDS_ARM7:NDS_ARM9)
|
||||
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
#define ROM_8(m, a) (((u8*)(m))[(a)])
|
||||
|
||||
typedef const u8 TWaitState;
|
||||
|
||||
enum ECardMode
|
||||
{
|
||||
CardMode_Normal = 0,
|
||||
CardMode_KEY1,
|
||||
CardMode_KEY2,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
u8 command[8];
|
||||
|
||||
u32 address;
|
||||
u32 transfer_count;
|
||||
|
||||
ECardMode mode;
|
||||
|
||||
} nds_dscard;
|
||||
|
||||
struct MMU_struct
|
||||
{
|
||||
//ARM9 mem
|
||||
u8 ARM9_ITCM[0x8000];
|
||||
u8 ARM9_DTCM[0x4000];
|
||||
u8 MAIN_MEM[0x800000]; //this has been expanded to 8MB to support debug consoles
|
||||
u8 ARM9_REG[0x1000000];
|
||||
u8 ARM9_BIOS[0x8000];
|
||||
u8 ARM9_VMEM[0x800];
|
||||
|
||||
#include "PACKED.h"
|
||||
struct {
|
||||
u8 ARM9_LCD[0xA4000];
|
||||
//an extra 128KB for blank memory, directly after arm9_lcd, so that
|
||||
//we can easily map things to the end of arm9_lcd to represent
|
||||
//an unmapped state
|
||||
u8 blank_memory[0x20000];
|
||||
};
|
||||
#include "PACKED_END.h"
|
||||
|
||||
u8 ARM9_OAM[0x800];
|
||||
|
||||
u8* ExtPal[2][4];
|
||||
u8* ObjExtPal[2][2];
|
||||
|
||||
struct TextureInfo {
|
||||
u8* texPalSlot[6];
|
||||
u8* textureSlotAddr[4];
|
||||
} texInfo;
|
||||
|
||||
struct MMU_struct {
|
||||
//ARM7 mem
|
||||
u8 ARM7_BIOS[0x4000];
|
||||
u8 ARM7_ERAM[0x10000];
|
||||
|
@ -134,28 +97,29 @@ struct MMU_struct
|
|||
u32 reg_IF[2];
|
||||
|
||||
u32 DMAStartTime[2][4];
|
||||
u64 DMACycle[2][4];
|
||||
s32 DMACycle[2][4];
|
||||
u32 DMACrt[2][4];
|
||||
BOOL DMAing[2][4];
|
||||
BOOL DMACompleted[2][4];
|
||||
|
||||
BOOL divRunning;
|
||||
s64 divResult;
|
||||
s64 divMod;
|
||||
u32 divCnt;
|
||||
u64 divCycles;
|
||||
s32 divCycles;
|
||||
|
||||
BOOL sqrtRunning;
|
||||
u32 sqrtResult;
|
||||
u32 sqrtCnt;
|
||||
u64 sqrtCycles;
|
||||
s32 sqrtCycles;
|
||||
|
||||
u16 SPI_CNT;
|
||||
u16 SPI_CMD;
|
||||
u16 AUX_SPI_CNT;
|
||||
u16 AUX_SPI_CMD;
|
||||
|
||||
u64 gfx3dCycles;
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
s32 gfx3dCycles;
|
||||
#endif
|
||||
|
||||
u8 powerMan_CntReg;
|
||||
BOOL powerMan_CntRegWritten;
|
||||
|
@ -205,7 +169,7 @@ struct armcpu_memory_iface {
|
|||
void MMU_Init(void);
|
||||
void MMU_DeInit(void);
|
||||
|
||||
void MMU_Reset( void);
|
||||
void MMU_clearMem( void);
|
||||
|
||||
void MMU_setRom(u8 * rom, u32 mask);
|
||||
void MMU_unsetRom( void);
|
||||
|
@ -227,52 +191,15 @@ extern struct armcpu_memory_iface arm9_base_memory_iface;
|
|||
extern struct armcpu_memory_iface arm7_base_memory_iface;
|
||||
extern struct armcpu_memory_iface arm9_direct_memory_iface;
|
||||
|
||||
#define VRAM_BANKS 9
|
||||
#define VRAM_BANK_A 0
|
||||
#define VRAM_BANK_B 1
|
||||
#define VRAM_BANK_C 2
|
||||
#define VRAM_BANK_D 3
|
||||
#define VRAM_BANK_E 4
|
||||
#define VRAM_BANK_F 5
|
||||
#define VRAM_BANK_G 6
|
||||
#define VRAM_BANK_H 7
|
||||
#define VRAM_BANK_I 8
|
||||
|
||||
#define VRAM_PAGE_ABG 0
|
||||
#define VRAM_PAGE_BBG 128
|
||||
#define VRAM_PAGE_AOBJ 256
|
||||
#define VRAM_PAGE_BOBJ 384
|
||||
|
||||
|
||||
struct VramConfiguration {
|
||||
|
||||
enum Purpose {
|
||||
OFF, INVALID, ABG, BBG, AOBJ, BOBJ, LCDC, ARM7, TEX, TEXPAL, ABGEXTPAL, BBGEXTPAL, AOBJEXTPAL, BOBJEXTPAL
|
||||
};
|
||||
|
||||
struct BankInfo {
|
||||
Purpose purpose;
|
||||
int ofs;
|
||||
} banks[VRAM_BANKS];
|
||||
|
||||
inline void clear() {
|
||||
for(int i=0;i<VRAM_BANKS;i++) {
|
||||
banks[i].ofs = 0;
|
||||
banks[i].purpose = OFF;
|
||||
}
|
||||
}
|
||||
|
||||
std::string describePurpose(Purpose p);
|
||||
std::string describe();
|
||||
};
|
||||
|
||||
extern VramConfiguration vramConfiguration;
|
||||
extern u8 *MMU_RenderMapToLCD(u32 vram_addr);
|
||||
|
||||
#define VRAM_ARM9_PAGES 512
|
||||
extern u8 vram_arm9_map[VRAM_ARM9_PAGES];
|
||||
FORCEINLINE void* MMU_gpu_map(u32 vram_addr)
|
||||
{
|
||||
//this is supposed to map a single gpu vram address to emulator host memory
|
||||
//THIS FUNCTION IS NOT AS DANGEROUS!
|
||||
//as an alternative to the above, use this:
|
||||
//it is supposed to map a single gpu vram address to emulator host memory
|
||||
//but it returns a pointer to some zero memory in case of accesses to unmapped memory.
|
||||
//this correctly handles the case with tile accesses to unmapped memory.
|
||||
//it could also potentially go through a different LUT than vram_arm9_map in case we discover
|
||||
|
@ -288,7 +215,7 @@ FORCEINLINE void* MMU_gpu_map(u32 vram_addr)
|
|||
vram_page = vram_arm9_map[vram_page];
|
||||
//blank pages are handled by the extra 16KB of blank memory at the end of ARM9_LCD
|
||||
//and the fact that blank pages are mapped to appear at that location
|
||||
return MMU.ARM9_LCD + (vram_page<<14) + ofs;
|
||||
return ARM9Mem.ARM9_LCD + (vram_page<<14) + ofs;
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,7 +255,7 @@ u32 FASTCALL _MMU_ARM7_read32(u32 adr);
|
|||
extern u32 partie;
|
||||
|
||||
extern u32 _MMU_MAIN_MEM_MASK;
|
||||
inline void SetupMMU(BOOL debugConsole) {
|
||||
inline void SetupMMU(bool debugConsole) {
|
||||
if(debugConsole) _MMU_MAIN_MEM_MASK = 0x7FFFFF;
|
||||
else _MMU_MAIN_MEM_MASK = 0x3FFFFF;
|
||||
}
|
||||
|
@ -339,20 +266,6 @@ inline void SetupMMU(BOOL debugConsole) {
|
|||
//T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][(adr >> 20) & 0xFF],
|
||||
// adr & MMU.MMU_MASK[ARMCPU_ARM7][(adr >> 20) & 0xFF]);
|
||||
|
||||
enum EDMAMode
|
||||
{
|
||||
EDMAMode_Immediate = 0,
|
||||
EDMAMode_VBlank = 1,
|
||||
EDMAMode_HBlank = 2,
|
||||
EDMAMode_HStart = 3,
|
||||
EDMAMode_MemDisplay = 4,
|
||||
EDMAMode_Card = 5,
|
||||
EDMAMode_GBASlot = 6,
|
||||
EDMAMode_GXFifo = 7,
|
||||
EDMAMode7_Wifi = 8,
|
||||
EDMAMode7_GBASlot = 9,
|
||||
};
|
||||
|
||||
FORCEINLINE u8 _MMU_read08(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u32 addr)
|
||||
{
|
||||
//special handling for DMA: read 0 from TCM
|
||||
|
@ -366,11 +279,11 @@ FORCEINLINE u8 _MMU_read08(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u3
|
|||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadByte(MMU.ARM9_DTCM, addr & 0x3FFF);
|
||||
return T1ReadByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadByte( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
return T1ReadByte( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read08(addr);
|
||||
else return _MMU_ARM7_read08(addr);
|
||||
|
@ -389,10 +302,10 @@ FORCEINLINE u16 _MMU_read16(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u
|
|||
if(PROCNUM==ARMCPU_ARM9 && AT == MMU_AT_CODE)
|
||||
{
|
||||
if ((addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadWord_guaranteedAligned( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
return T1ReadWord_guaranteedAligned( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(addr<0x02000000)
|
||||
return T1ReadWord_guaranteedAligned(MMU.ARM9_ITCM, addr&0x7FFF);
|
||||
return T1ReadWord_guaranteedAligned(ARM9Mem.ARM9_ITCM, addr&0x7FFF);
|
||||
|
||||
goto dunno;
|
||||
}
|
||||
|
@ -401,11 +314,11 @@ FORCEINLINE u16 _MMU_read16(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u
|
|||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadWord(MMU.ARM9_DTCM, addr & 0x3FFF);
|
||||
return T1ReadWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadWord( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
return T1ReadWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
dunno:
|
||||
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read16(addr);
|
||||
|
@ -425,10 +338,10 @@ FORCEINLINE u32 _MMU_read32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u
|
|||
if(PROCNUM==ARMCPU_ARM9 && AT == MMU_AT_CODE)
|
||||
{
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadLong_guaranteedAligned( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
return T1ReadLong_guaranteedAligned( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(addr<0x02000000)
|
||||
return T1ReadLong_guaranteedAligned(MMU.ARM9_ITCM, addr&0x7FFF);
|
||||
return T1ReadLong_guaranteedAligned(ARM9Mem.ARM9_ITCM, addr&0x7FFF);
|
||||
|
||||
goto dunno;
|
||||
}
|
||||
|
@ -437,7 +350,7 @@ FORCEINLINE u32 _MMU_read32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u
|
|||
if(PROCNUM==ARMCPU_ARM7)
|
||||
{
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadLong_guaranteedAligned( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
return T1ReadLong_guaranteedAligned( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
else if((addr & 0xFF800000) == 0x03800000)
|
||||
return T1ReadLong_guaranteedAligned(MMU.ARM7_ERAM, addr&0xFFFF);
|
||||
else if((addr & 0xFF800000) == 0x03000000)
|
||||
|
@ -451,11 +364,11 @@ FORCEINLINE u32 _MMU_read32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u
|
|||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadLong(MMU.ARM9_DTCM, addr & 0x3FFF);
|
||||
return T1ReadLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadLong( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
return T1ReadLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
}
|
||||
|
||||
dunno:
|
||||
|
@ -475,12 +388,12 @@ FORCEINLINE void _MMU_write08(const int PROCNUM, const MMU_ACCESS_TYPE AT, const
|
|||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteByte(MMU.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
T1WriteByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteByte( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
T1WriteByte( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -500,12 +413,12 @@ FORCEINLINE void _MMU_write16(const int PROCNUM, const MMU_ACCESS_TYPE AT, const
|
|||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteWord(MMU.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
T1WriteWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteWord( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
T1WriteWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -525,12 +438,12 @@ FORCEINLINE void _MMU_write32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const
|
|||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteLong(MMU.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
T1WriteLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteLong( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
T1WriteLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -573,22 +486,22 @@ FORCEINLINE void _MMU_write32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const
|
|||
#endif
|
||||
|
||||
template<int PROCNUM, MMU_ACCESS_TYPE AT>
|
||||
FORCEINLINE u8 _MMU_read08(u32 addr) { return _MMU_read08(PROCNUM, AT, addr); }
|
||||
u8 _MMU_read08(u32 addr) { return _MMU_read08(PROCNUM, AT, addr); }
|
||||
|
||||
template<int PROCNUM, MMU_ACCESS_TYPE AT>
|
||||
FORCEINLINE u16 _MMU_read16(u32 addr) { return _MMU_read16(PROCNUM, AT, addr); }
|
||||
u16 _MMU_read16(u32 addr) { return _MMU_read16(PROCNUM, AT, addr); }
|
||||
|
||||
template<int PROCNUM, MMU_ACCESS_TYPE AT>
|
||||
FORCEINLINE u32 _MMU_read32(u32 addr) { return _MMU_read32(PROCNUM, AT, addr); }
|
||||
u32 _MMU_read32(u32 addr) { return _MMU_read32(PROCNUM, AT, addr); }
|
||||
|
||||
template<int PROCNUM, MMU_ACCESS_TYPE AT>
|
||||
FORCEINLINE void _MMU_write08(u32 addr, u8 val) { _MMU_write08(PROCNUM, AT, addr, val); }
|
||||
void _MMU_write08(u32 addr, u8 val) { _MMU_write08(PROCNUM, AT, addr, val); }
|
||||
|
||||
template<int PROCNUM, MMU_ACCESS_TYPE AT>
|
||||
FORCEINLINE void _MMU_write16(u32 addr, u16 val) { _MMU_write16(PROCNUM, AT, addr, val); }
|
||||
void _MMU_write16(u32 addr, u16 val) { _MMU_write16(PROCNUM, AT, addr, val); }
|
||||
|
||||
template<int PROCNUM, MMU_ACCESS_TYPE AT>
|
||||
FORCEINLINE void _MMU_write32(u32 addr, u32 val) { _MMU_write32(PROCNUM, AT, addr, val); }
|
||||
void _MMU_write32(u32 addr, u32 val) { _MMU_write32(PROCNUM, AT, addr, val); }
|
||||
|
||||
void FASTCALL MMU_DumpMemBlock(u8 proc, u32 address, u32 size, u8 *buffer);
|
||||
|
|
@ -2,7 +2,8 @@ include $(top_srcdir)/src/desmume.mk
|
|||
|
||||
AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(LUA_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS)
|
||||
|
||||
EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.cpp fs-windows.cpp
|
||||
EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.cpp fs-windows.cpp \
|
||||
matrix_sse2-x64.asm matrix_sse2-x86.asm
|
||||
if HAVE_GDB_STUB
|
||||
SUBDIRS = . gdbstub $(UI_DIR)
|
||||
else
|
||||
|
@ -14,7 +15,6 @@ libdesmume_a_SOURCES = \
|
|||
armcpu.cpp armcpu.h ARM9.h \
|
||||
arm_instructions.cpp arm_instructions.h \
|
||||
bios.cpp bios.h bits.h cp15.cpp cp15.h \
|
||||
commandline.h commandline.cpp \
|
||||
common.cpp common.h \
|
||||
debug.cpp debug.h driver.h \
|
||||
Disassembler.cpp Disassembler.h \
|
||||
|
@ -50,6 +50,9 @@ libdesmume_a_SOURCES = \
|
|||
texcache.cpp texcache.h rasterize.cpp rasterize.h \
|
||||
version.h
|
||||
|
||||
if HAVE_GLIB
|
||||
libdesmume_a_SOURCES += commandline.h commandline.cpp
|
||||
endif
|
||||
if HAVE_ALSA
|
||||
libdesmume_a_SOURCES += mic_alsa.cpp
|
||||
else
|
File diff suppressed because it is too large
Load Diff
|
@ -98,7 +98,7 @@ extern autohold AutoHold;
|
|||
|
||||
int NDS_WritePNG(const char *fname);
|
||||
|
||||
extern volatile bool execute;
|
||||
extern volatile BOOL execute;
|
||||
extern BOOL click;
|
||||
|
||||
/*
|
||||
|
@ -171,19 +171,19 @@ struct NDS_header
|
|||
extern void debug();
|
||||
void emu_halt();
|
||||
|
||||
extern u64 nds_timer;
|
||||
void NDS_Reschedule();
|
||||
void NDS_RescheduleGXFIFO();
|
||||
void NDS_RescheduleDMA();
|
||||
void NDS_RescheduleTimers();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s32 ARM9Cycle;
|
||||
s32 ARM7Cycle;
|
||||
s32 wifiCycle;
|
||||
s32 cycles;
|
||||
u64 timerCycle[2][4];
|
||||
s32 timerCycle[2][4];
|
||||
BOOL timerOver[2][4];
|
||||
s32 nextHBlank;
|
||||
u32 VCount;
|
||||
u32 old;
|
||||
s32 diff;
|
||||
BOOL lignerendu;
|
||||
|
||||
u16 touchX;
|
||||
u16 touchY;
|
||||
|
@ -293,22 +293,6 @@ struct GameInfo
|
|||
int romsize;
|
||||
};
|
||||
|
||||
typedef struct TSCalInfo
|
||||
{
|
||||
struct adc
|
||||
{
|
||||
u16 x1, x2;
|
||||
u16 y1, y2;
|
||||
} adc;
|
||||
|
||||
struct scr
|
||||
{
|
||||
u8 x1, x2;
|
||||
u8 y1, y2;
|
||||
} scr;
|
||||
|
||||
} TSCalInfo;
|
||||
|
||||
extern GameInfo gameInfo;
|
||||
void NDS_setTouchPos(u16 x, u16 y);
|
||||
void NDS_releaseTouch(void);
|
||||
|
@ -321,9 +305,6 @@ void NDS_Reset();
|
|||
int NDS_ImportSave(const char *filename);
|
||||
bool NDS_ExportSave(const char *filename);
|
||||
|
||||
void nds_savestate(std::ostream* os);
|
||||
bool nds_loadstate(std::istream* is, int size);
|
||||
|
||||
int NDS_WriteBMP(const char *filename);
|
||||
int NDS_LoadFirmware(const char *filename);
|
||||
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
|
||||
|
@ -333,15 +314,13 @@ void NDS_Sleep();
|
|||
void NDS_SkipNextFrame();
|
||||
#define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame();
|
||||
|
||||
void execHardware_doAllDma(EDMAMode modeNum);
|
||||
|
||||
template<bool FORCE> void NDS_exec(s32 nb = 560190<<1);
|
||||
|
||||
extern int lagframecounter;
|
||||
|
||||
static INLINE void NDS_ARM9HBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(MMU.ARM9_REG, 4) & 0x10)
|
||||
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x10)
|
||||
{
|
||||
//MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1));
|
||||
setIF(0, 2);
|
||||
|
@ -361,7 +340,7 @@ static INLINE void NDS_ARM7HBlankInt(void)
|
|||
|
||||
static INLINE void NDS_ARM9VBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(MMU.ARM9_REG, 4) & 0x8)
|
||||
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8)
|
||||
{
|
||||
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
|
||||
setIF(0, 1);
|
||||
|
@ -399,7 +378,7 @@ extern struct TCommonSettings {
|
|||
, UseExtFirmware(false)
|
||||
, BootFromFirmware(false)
|
||||
, DebugConsole(false)
|
||||
, single_core(true)
|
||||
, wifiBridgeAdapterNum(0)
|
||||
, spuInterpolationMode(SPUInterpolation_Linear)
|
||||
, spuAdpcmCache(false)
|
||||
, gfx3d_flushMode(0)
|
||||
|
@ -408,12 +387,6 @@ extern struct TCommonSettings {
|
|||
strcpy(ARM9BIOS, "biosnds9.bin");
|
||||
strcpy(ARM7BIOS, "biosnds7.bin");
|
||||
strcpy(Firmware, "firmware.bin");
|
||||
|
||||
wifi.mode = 0;
|
||||
wifi.adhocMode = 0;
|
||||
strcpy(wifi.adhocServerName, "");
|
||||
wifi.infraBridgeAdapter = 0;
|
||||
|
||||
for(int i=0;i<16;i++)
|
||||
spu_muteChannels[i] = false;
|
||||
}
|
||||
|
@ -430,16 +403,7 @@ extern struct TCommonSettings {
|
|||
|
||||
bool DebugConsole;
|
||||
|
||||
bool single_core;
|
||||
|
||||
struct _Wifi {
|
||||
int mode;
|
||||
|
||||
int adhocMode;
|
||||
char adhocServerName[64];
|
||||
|
||||
int infraBridgeAdapter;
|
||||
} wifi;
|
||||
int wifiBridgeAdapterNum;
|
||||
|
||||
SPUInterpolationMode spuInterpolationMode;
|
||||
bool spuAdpcmCache;
|
||||
|
@ -463,13 +427,12 @@ extern struct TCommonSettings {
|
|||
struct _Hud {
|
||||
_Hud()
|
||||
: ShowInputDisplay(false)
|
||||
, ShowGraphicalInputDisplay(false)
|
||||
, FpsDisplay(false)
|
||||
, FrameCounterDisplay(false)
|
||||
, ShowLagFrameCounter(false)
|
||||
, ShowMicrophone(false)
|
||||
{}
|
||||
bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone;
|
||||
bool ShowInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone;
|
||||
} hud;
|
||||
|
||||
} CommonSettings;
|
|
@ -73,8 +73,15 @@ static void ENDGL() {
|
|||
#include "shaders.h"
|
||||
#include "texcache.h"
|
||||
|
||||
|
||||
|
||||
#ifndef CTASSERT
|
||||
#define CTASSERT(x) typedef char __assert ## y[(x) ? 1 : -1]
|
||||
#endif
|
||||
|
||||
static ALIGN(16) u8 GPU_screen3D [256*192*4];
|
||||
|
||||
|
||||
static const unsigned short map3d_cull[4] = {GL_FRONT_AND_BACK, GL_FRONT, GL_BACK, 0};
|
||||
static const int texEnv[4] = { GL_MODULATE, GL_DECAL, GL_MODULATE, GL_MODULATE };
|
||||
static const int depthFunc[2] = { GL_LESS, GL_EQUAL };
|
||||
|
@ -689,31 +696,6 @@ static void GL_ReadFramebuffer()
|
|||
glReadPixels(0,0,256,192,GL_BGRA_EXT, GL_UNSIGNED_BYTE, GPU_screen3D);
|
||||
ENDGL();
|
||||
|
||||
//convert the pixels to a different format which is more convenient
|
||||
//is it safe to modify the screen buffer? if not, we could make a temp copy
|
||||
for(int i=0,y=191;y>=0;y--)
|
||||
{
|
||||
u8* dst = gfx3d_convertedScreen + (y<<(8+2));
|
||||
|
||||
for(int x=0;x<256;x++,i++)
|
||||
{
|
||||
u32 &u32screen3D = ((u32*)GPU_screen3D)[i];
|
||||
u32screen3D>>=2;
|
||||
u32screen3D &= 0x3F3F3F3F;
|
||||
|
||||
const int t = i<<2;
|
||||
const u8 a = GPU_screen3D[t+3] >> 1;
|
||||
const u8 r = GPU_screen3D[t+2];
|
||||
const u8 g = GPU_screen3D[t+1];
|
||||
const u8 b = GPU_screen3D[t+0];
|
||||
*dst++ = r;
|
||||
*dst++ = g;
|
||||
*dst++ = b;
|
||||
*dst++ = a;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
//convert the pixels to a different format which is more convenient
|
||||
//is it safe to modify the screen buffer? if not, we could make a temp copy
|
||||
for(int i=0,y=191;y>=0;y--)
|
||||
|
@ -721,15 +703,14 @@ static void GL_ReadFramebuffer()
|
|||
u16* dst = gfx3d_convertedScreen + (y<<8);
|
||||
u8* dstAlpha = gfx3d_convertedAlpha + (y<<8);
|
||||
|
||||
#ifndef NOSSE2
|
||||
//I dont know much about this kind of stuff, but this seems to help
|
||||
//for some reason I couldnt make the intrinsics work
|
||||
//u8* u8screen3D = (u8*)&((u32*)GPU_screen3D)[i];
|
||||
/*#define PREFETCH32(X,Y) __asm { prefetchnta [u8screen3D+32*0x##X##Y] }
|
||||
#define PREFETCH128(X) PREFETCH32(X,0) PREFETCH32(X,1) PREFETCH32(X,2) PREFETCH32(X,3) \
|
||||
PREFETCH32(X,4) PREFETCH32(X,5) PREFETCH32(X,6) PREFETCH32(X,7) \
|
||||
PREFETCH32(X,8) PREFETCH32(X,9) PREFETCH32(X,A) PREFETCH32(X,B) \
|
||||
PREFETCH32(X,C) PREFETCH32(X,D) PREFETCH32(X,E) PREFETCH32(X,F)
|
||||
PREFETCH128(0); PREFETCH128(1);*/
|
||||
u8* wanx = (u8*)&((u32*)GPU_screen3D)[i];
|
||||
#define ASS(X,Y) __asm { prefetchnta [wanx+32*0x##X##Y] }
|
||||
#define PUNK(X) ASS(X,0) ASS(X,1) ASS(X,2) ASS(X,3) ASS(X,4) ASS(X,5) ASS(X,6) ASS(X,7) ASS(X,8) ASS(X,9) ASS(X,A) ASS(X,B) ASS(X,C) ASS(X,D) ASS(X,E) ASS(X,F)
|
||||
PUNK(0); PUNK(1);
|
||||
#endif
|
||||
|
||||
for(int x=0;x<256;x++,i++)
|
||||
{
|
||||
|
@ -743,10 +724,9 @@ static void GL_ReadFramebuffer()
|
|||
const u8 g = GPU_screen3D[t+1];
|
||||
const u8 b = GPU_screen3D[t+0];
|
||||
dst[x] = R5G5B5TORGB15(r,g,b) | alpha_lookup[a];
|
||||
dstAlpha[x] = a;
|
||||
dstAlpha[x] = alpha_5bit_to_4bit[a];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -855,32 +835,28 @@ static void OGLRender()
|
|||
|
||||
VERT *vert0 = &gfx3d.vertlist->list[poly->vertIndexes[0]];
|
||||
u8 alpha = material_5bit_to_8bit[poly->getAlpha()];
|
||||
if(wireframe) alpha = 255;
|
||||
u8 color0[4] = {
|
||||
vert0->color[0]<<2,
|
||||
vert0->color[1]<<2,
|
||||
vert0->color[2]<<2,
|
||||
material_5bit_to_8bit[vert0->color[0]],
|
||||
material_5bit_to_8bit[vert0->color[1]],
|
||||
material_5bit_to_8bit[vert0->color[2]],
|
||||
alpha
|
||||
};
|
||||
|
||||
//this draws things as a fan to prepare for the day when the clipping is done in gfx3d
|
||||
//and funny shaped polys find their way into here.
|
||||
//of course it could really be drawn as a fan, i suppose.. i dont remember why we did it this way
|
||||
for(int j = 1; j < (type-1); j++)
|
||||
{
|
||||
VERT *vert1 = &gfx3d.vertlist->list[poly->vertIndexes[j]];
|
||||
VERT *vert2 = &gfx3d.vertlist->list[poly->vertIndexes[j+1]];
|
||||
|
||||
u8 color1[4] = {
|
||||
vert1->color[0]<<2,
|
||||
vert1->color[1]<<2,
|
||||
vert1->color[2]<<2,
|
||||
material_5bit_to_8bit[vert1->color[0]],
|
||||
material_5bit_to_8bit[vert1->color[1]],
|
||||
material_5bit_to_8bit[vert1->color[2]],
|
||||
alpha
|
||||
};
|
||||
u8 color2[4] = {
|
||||
vert2->color[0]<<2,
|
||||
vert2->color[1]<<2,
|
||||
vert2->color[2]<<2,
|
||||
material_5bit_to_8bit[vert2->color[0]],
|
||||
material_5bit_to_8bit[vert2->color[1]],
|
||||
material_5bit_to_8bit[vert2->color[2]],
|
||||
alpha
|
||||
};
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#include "ARM9.h"
|
||||
#include "MMU.h"
|
||||
#include "SPU.h"
|
||||
#include "mem.h"
|
||||
|
@ -678,7 +679,7 @@ template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE s32 Interpola
|
|||
ratio = ratio - (int)ratio;
|
||||
double ratio2 = ((1.0 - cos(ratio * M_PI)) * 0.5);
|
||||
//double ratio2 = (1.0f - cos_lut[((int)(ratio*256.0))&0xFF]) / 2.0f;
|
||||
return (s32)(((1-ratio2)*a) + (ratio2*b));
|
||||
return (((1-ratio2)*a) + (ratio2*b));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1038,7 +1039,6 @@ void SPU_Emulate_user()
|
|||
|
||||
if (audiosize > 0)
|
||||
{
|
||||
//printf("mix %i samples\n", audiosize);
|
||||
if (audiosize > SPU_user->bufsize)
|
||||
audiosize = SPU_user->bufsize;
|
||||
SPU_MixAudio<true>(SPU_user,audiosize);
|
|
@ -144,7 +144,7 @@ void Agg_init()
|
|||
aggDraw.target = targets[0];
|
||||
|
||||
//if we're single core, we don't want to waste time compositing
|
||||
if(CommonSettings.single_core)
|
||||
//if(CommonSettings.single_core)
|
||||
aggDraw.hud = &agg_targetScreen;
|
||||
|
||||
//and the more clever compositing isnt supported in non-windows
|
|
@ -31,7 +31,7 @@
|
|||
#define cpu (&ARMPROC)
|
||||
#define TEMPLATE template<int PROCNUM>
|
||||
|
||||
extern volatile bool execute;
|
||||
extern volatile BOOL execute;
|
||||
|
||||
#define LSL_IMM shift_op = cpu->R[REG_POS(i,0)]<<((i>>7)&0x1F);
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
template<u32> static u32 armcpu_prefetch();
|
||||
|
||||
FORCEINLINE u32 armcpu_prefetch(armcpu_t *armcpu) {
|
||||
inline u32 armcpu_prefetch(armcpu_t *armcpu) {
|
||||
if(armcpu->proc_ID==0) return armcpu_prefetch<0>();
|
||||
else return armcpu_prefetch<1>();
|
||||
}
|
||||
|
@ -363,7 +363,8 @@ u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode)
|
|||
}
|
||||
|
||||
template<u32 PROCNUM>
|
||||
FORCEINLINE static u32 armcpu_prefetch()
|
||||
static u32
|
||||
armcpu_prefetch()
|
||||
{
|
||||
armcpu_t* const armcpu = &ARMPROC;
|
||||
#ifdef GDB_STUB
|
||||
|
@ -520,10 +521,7 @@ u32 armcpu_exec()
|
|||
|
||||
if(ARMPROC.CPSR.bits.T == 0)
|
||||
{
|
||||
if(
|
||||
CONDITION(ARMPROC.instruction) == 0x0E //fast path for unconditional instructions
|
||||
|| (TEST_COND(CONDITION(ARMPROC.instruction), CODE(ARMPROC.instruction), ARMPROC.CPSR)) //handles any condition
|
||||
)
|
||||
if((TEST_COND(CONDITION(ARMPROC.instruction), CODE(ARMPROC.instruction), ARMPROC.CPSR)))
|
||||
{
|
||||
if(PROCNUM==0) {
|
||||
#ifdef WANTASMLISTING
|
|
@ -22,6 +22,10 @@
|
|||
#ifndef ARM_CPU
|
||||
#define ARM_CPU
|
||||
|
||||
#define ARMCPU_ARM7 1
|
||||
#define ARMCPU_ARM9 0
|
||||
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
|
||||
|
||||
#include "types.h"
|
||||
#include "bits.h"
|
||||
#include "MMU.h"
|
||||
|
@ -230,8 +234,6 @@ static INLINE void setIF(int PROCNUM, u32 flag)
|
|||
|
||||
if(ARMPROC.waitIRQ)
|
||||
ARMPROC.newIrqFlags |= flag;
|
||||
extern void NDS_Reschedule();
|
||||
NDS_Reschedule();
|
||||
}
|
||||
|
||||
static INLINE void NDS_makeARM9Int(u32 num)
|
|
@ -327,7 +327,7 @@ TEMPLATE static u32 divide()
|
|||
|
||||
cpu->R[0] = (u32)(num / dnum);
|
||||
cpu->R[1] = (u32)(num % dnum);
|
||||
cpu->R[3] = (u32) (((s32)cpu->R[0])<0 ? -(s32)cpu->R[0] : cpu->R[0]);
|
||||
cpu->R[3] = (u32) (((s32)cpu->R[0])<0 ? -cpu->R[0] : cpu->R[0]);
|
||||
|
||||
return 6;
|
||||
}
|
|
@ -393,7 +393,7 @@ static void cheats_ARparser(CHEATS_LIST cheat)
|
|||
|
||||
static BOOL cheatsXXcodePreparser(CHEATS_LIST *cheat, char *code)
|
||||
{
|
||||
int count = 0;
|
||||
u16 count = 0;
|
||||
u16 t = 0;
|
||||
char tmp_buf[sizeof(cheat->hi)+sizeof(cheat->lo)];
|
||||
|
|
@ -36,7 +36,7 @@ typedef struct
|
|||
u32 hi[255];
|
||||
u32 lo[255];
|
||||
char description[75];
|
||||
int num;
|
||||
u8 num;
|
||||
u8 size;
|
||||
|
||||
} CHEATS_LIST;
|
|
@ -1,11 +1,11 @@
|
|||
SUBDIRS = doc
|
||||
include $(top_srcdir)/src/desmume.mk
|
||||
|
||||
AM_CPPFLAGS += $(SDL_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) $(GLIB_CFLAGS)
|
||||
AM_CFLAGS += $(SDL_CFLAGS) $(ALSA_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = desmume-cli
|
||||
desmume_cli_SOURCES = main.cpp ../sndsdl.cpp ../ctrlssdl.h ../ctrlssdl.cpp
|
||||
desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) $(GLIB_LIBS)
|
||||
desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS)
|
||||
if HAVE_GDB_STUB
|
||||
desmume_cli_LDADD += ../gdbstub/libgdbstub.a
|
||||
endif
|
|
@ -53,12 +53,11 @@
|
|||
#include "../rasterize.h"
|
||||
#include "../saves.h"
|
||||
#include "../mic.h"
|
||||
#include "../GPU_osd.h"
|
||||
#ifdef GDB_STUB
|
||||
#include "../gdbstub.h"
|
||||
#endif
|
||||
|
||||
volatile bool execute = false;
|
||||
volatile BOOL execute = FALSE;
|
||||
|
||||
static float nds_screen_size_ratio = 1.0f;
|
||||
|
||||
|
@ -672,7 +671,6 @@ static void desmume_cycle(int *sdl_quit, int *boost, struct my_config * my_confi
|
|||
{
|
||||
focused = 1;
|
||||
SPU_Pause(0);
|
||||
osd->addLine("Auto pause disabled\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -692,18 +690,10 @@ static void desmume_cycle(int *sdl_quit, int *boost, struct my_config * my_confi
|
|||
case SDLK_m:
|
||||
enable_fake_mic = !enable_fake_mic;
|
||||
Mic_DoNoise(enable_fake_mic);
|
||||
if (enable_fake_mic)
|
||||
osd->addLine("Fake mic enabled\n");
|
||||
else
|
||||
osd->addLine("Fake mic disabled\n");
|
||||
break;
|
||||
#endif
|
||||
case SDLK_o:
|
||||
*boost = !(*boost);
|
||||
if (*boost)
|
||||
osd->addLine("Boost mode enabled\n");
|
||||
else
|
||||
osd->addLine("Boost mode disabled\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -839,7 +829,7 @@ int main(int argc, char ** argv) {
|
|||
}
|
||||
#endif
|
||||
|
||||
execute = true;
|
||||
execute = TRUE;
|
||||
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1)
|
||||
{
|
||||
|
@ -945,14 +935,9 @@ int main(int argc, char ** argv) {
|
|||
loadstate_slot(my_config.load_slot);
|
||||
}
|
||||
|
||||
Desmume_InitOnce();
|
||||
Hud.reset();
|
||||
|
||||
while(!sdl_quit) {
|
||||
desmume_cycle(&sdl_quit, &boost, &my_config);
|
||||
|
||||
osd->update();
|
||||
DrawHUD();
|
||||
#ifdef INCLUDE_OPENGL_2D
|
||||
if ( my_config.opengl_2d) {
|
||||
opengl_Draw( screen_texture, my_config.soft_colour_convert);
|
||||
|
@ -960,7 +945,6 @@ int main(int argc, char ** argv) {
|
|||
else
|
||||
#endif
|
||||
Draw();
|
||||
osd->clear();
|
||||
|
||||
for ( int i = 0; i < my_config.frameskip; i++ ) {
|
||||
NDS_SkipNextFrame();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue