all .cpp .h files: convert to uniform EOLs and set svn:eol-style to native
This commit is contained in:
parent
cdef916569
commit
30ef5275d9
|
@ -1,268 +1,268 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 2007 shash
|
||||
Copyright 2007-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 "FIFO.h"
|
||||
#include <string.h>
|
||||
#include "armcpu.h"
|
||||
#include "debug.h"
|
||||
#include "mem.h"
|
||||
#include "MMU.h"
|
||||
|
||||
// ========================================================= IPC FIFO
|
||||
IPC_FIFO ipc_fifo[2]; // 0 - ARM9
|
||||
// 1 - ARM7
|
||||
|
||||
void IPC_FIFOinit(u8 proc)
|
||||
{
|
||||
memset(&ipc_fifo[proc], 0, sizeof(IPC_FIFO));
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, 0x00000101);
|
||||
}
|
||||
|
||||
void IPC_FIFOsend(u8 proc, u32 val)
|
||||
{
|
||||
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
|
||||
if (!(cnt_l & 0x8000)) return; // FIFO disabled
|
||||
u8 proc_remote = proc ^ 1;
|
||||
|
||||
if (ipc_fifo[proc].tail > 15)
|
||||
{
|
||||
cnt_l |= 0x4000;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
return;
|
||||
}
|
||||
|
||||
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
|
||||
|
||||
//LOG("IPC%s send 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);
|
||||
|
||||
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;
|
||||
|
||||
if (ipc_fifo[proc].tail > 15)
|
||||
{
|
||||
cnt_l |= 0x0002; // set send full bit
|
||||
cnt_r |= 0x0200; // set recv full bit
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
|
||||
|
||||
// MMU.reg_IF[proc_remote] |= ( (cnt_l & 0x0400) << 8 );
|
||||
setIF(proc_remote, ((cnt_l & 0x0400)<<8));
|
||||
}
|
||||
|
||||
u32 IPC_FIFOrecv(u8 proc)
|
||||
{
|
||||
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
|
||||
if (!(cnt_l & 0x8000)) return (0); // FIFO disabled
|
||||
u8 proc_remote = proc ^ 1;
|
||||
|
||||
u32 val = 0;
|
||||
|
||||
if ( ipc_fifo[proc_remote].tail == 0 ) // remote FIFO error
|
||||
{
|
||||
cnt_l |= 0x4000;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
return (0);
|
||||
}
|
||||
|
||||
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
|
||||
|
||||
cnt_l &= 0xBCFF; // clear send full bit & empty
|
||||
cnt_r &= 0xBFFC; // set recv full bit & empty
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
|
||||
|
||||
//MMU.reg_IF[proc_remote] |= ( (cnt_l & 0x0004) << 15);
|
||||
setIF(proc_remote, ((cnt_l & 0x0004)<<15));
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
||||
void IPC_FIFOcnt(u8 proc, u16 val)
|
||||
{
|
||||
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
|
||||
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);
|
||||
|
||||
//LOG("IPC%s FIFO context 0x%X (local 0x%04X, remote 0x%04X)\n", proc?"7":"9", val, cnt_l, cnt_r);
|
||||
if (val & 0x4008)
|
||||
{
|
||||
ipc_fifo[proc].tail = 0;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);
|
||||
T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0x8407) | 0x100);
|
||||
//MMU.reg_IF[proc^1] |= ((val & 0x0004) << 15);
|
||||
setIF(proc^1, ((val & 0x0004)<<15));
|
||||
return;
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val);
|
||||
}
|
||||
|
||||
// ========================================================= GFX FIFO
|
||||
GFX_FIFO gxFIFO;
|
||||
|
||||
void GFX_FIFOclear()
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0x0000FFFF;
|
||||
|
||||
gxFIFO.tail = 0;
|
||||
gxstat |= 0x06000000;
|
||||
gxstat |= 0x00000002; // this is hack (must be removed later)
|
||||
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);
|
||||
if (gxstat & 0x01000000) return; // full
|
||||
|
||||
gxstat &= 0x0000FFFF;
|
||||
gxstat |= 0x00000002; // this is hack (must be removed later)
|
||||
|
||||
gxFIFO.cmd[gxFIFO.tail] = cmd;
|
||||
gxFIFO.param[gxFIFO.tail] = param;
|
||||
gxFIFO.tail++;
|
||||
if (gxFIFO.tail > 256)
|
||||
gxFIFO.tail = 256;
|
||||
|
||||
// TODO: irq handle
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x08000000; // busy
|
||||
#else
|
||||
gxstat |= 0x02000000; // this is hack (must be removed later)
|
||||
#endif
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
}
|
||||
|
||||
BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0xF000FFFF;
|
||||
gxstat |= 0x00000002; // this is hack (must be removed later)
|
||||
if (!gxFIFO.tail) // empty
|
||||
{
|
||||
//gxstat |= (0x01FF << 16);
|
||||
gxstat |= 0x06000000;
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
return FALSE;
|
||||
}
|
||||
*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];
|
||||
}
|
||||
|
||||
if (gxFIFO.tail) // not empty
|
||||
{
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
gxstat |= 0x08000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
gxstat |= 0x04000000;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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)\n", val, gxstat);
|
||||
if (val & (1<<29)) // clear? (homebrew)
|
||||
{
|
||||
// need to flush before???
|
||||
GFX_FIFOclear();
|
||||
return;
|
||||
}
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
if (gxstat & 0xC0000000)
|
||||
{
|
||||
//NDS_makeARM9Int(21);
|
||||
//MMU.reg_IF[0] = (1<<21);
|
||||
setIF(0, (1<<21));
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================= DISP FIFO
|
||||
DISP_FIFO disp_fifo;
|
||||
|
||||
void DISP_FIFOinit()
|
||||
{
|
||||
memset(&disp_fifo, 0, sizeof(DISP_FIFO));
|
||||
}
|
||||
|
||||
void DISP_FIFOsend(u32 val)
|
||||
{
|
||||
//INFO("DISP_FIFO send value 0x%08X (head 0x%06X, tail 0x%06X)\n", val, disp_fifo.head, disp_fifo.tail);
|
||||
disp_fifo.buf[disp_fifo.tail] = val;
|
||||
disp_fifo.tail++;
|
||||
if (disp_fifo.tail > 0x5FFF)
|
||||
disp_fifo.tail = 0;
|
||||
}
|
||||
|
||||
u32 DISP_FIFOrecv()
|
||||
{
|
||||
//if (disp_fifo.tail == disp_fifo.head) return (0); // FIFO is empty
|
||||
u32 val = disp_fifo.buf[disp_fifo.head];
|
||||
disp_fifo.head++;
|
||||
if (disp_fifo.head > 0x5FFF)
|
||||
disp_fifo.head = 0;
|
||||
return (val);
|
||||
}
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 2007 shash
|
||||
Copyright 2007-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 "FIFO.h"
|
||||
#include <string.h>
|
||||
#include "armcpu.h"
|
||||
#include "debug.h"
|
||||
#include "mem.h"
|
||||
#include "MMU.h"
|
||||
|
||||
// ========================================================= IPC FIFO
|
||||
IPC_FIFO ipc_fifo[2]; // 0 - ARM9
|
||||
// 1 - ARM7
|
||||
|
||||
void IPC_FIFOinit(u8 proc)
|
||||
{
|
||||
memset(&ipc_fifo[proc], 0, sizeof(IPC_FIFO));
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, 0x00000101);
|
||||
}
|
||||
|
||||
void IPC_FIFOsend(u8 proc, u32 val)
|
||||
{
|
||||
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
|
||||
if (!(cnt_l & 0x8000)) return; // FIFO disabled
|
||||
u8 proc_remote = proc ^ 1;
|
||||
|
||||
if (ipc_fifo[proc].tail > 15)
|
||||
{
|
||||
cnt_l |= 0x4000;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
return;
|
||||
}
|
||||
|
||||
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
|
||||
|
||||
//LOG("IPC%s send 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);
|
||||
|
||||
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;
|
||||
|
||||
if (ipc_fifo[proc].tail > 15)
|
||||
{
|
||||
cnt_l |= 0x0002; // set send full bit
|
||||
cnt_r |= 0x0200; // set recv full bit
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
|
||||
|
||||
// MMU.reg_IF[proc_remote] |= ( (cnt_l & 0x0400) << 8 );
|
||||
setIF(proc_remote, ((cnt_l & 0x0400)<<8));
|
||||
}
|
||||
|
||||
u32 IPC_FIFOrecv(u8 proc)
|
||||
{
|
||||
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
|
||||
if (!(cnt_l & 0x8000)) return (0); // FIFO disabled
|
||||
u8 proc_remote = proc ^ 1;
|
||||
|
||||
u32 val = 0;
|
||||
|
||||
if ( ipc_fifo[proc_remote].tail == 0 ) // remote FIFO error
|
||||
{
|
||||
cnt_l |= 0x4000;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
return (0);
|
||||
}
|
||||
|
||||
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
|
||||
|
||||
cnt_l &= 0xBCFF; // clear send full bit & empty
|
||||
cnt_r &= 0xBFFC; // set recv full bit & empty
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
|
||||
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
|
||||
|
||||
//MMU.reg_IF[proc_remote] |= ( (cnt_l & 0x0004) << 15);
|
||||
setIF(proc_remote, ((cnt_l & 0x0004)<<15));
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
||||
void IPC_FIFOcnt(u8 proc, u16 val)
|
||||
{
|
||||
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
|
||||
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);
|
||||
|
||||
//LOG("IPC%s FIFO context 0x%X (local 0x%04X, remote 0x%04X)\n", proc?"7":"9", val, cnt_l, cnt_r);
|
||||
if (val & 0x4008)
|
||||
{
|
||||
ipc_fifo[proc].tail = 0;
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);
|
||||
T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0x8407) | 0x100);
|
||||
//MMU.reg_IF[proc^1] |= ((val & 0x0004) << 15);
|
||||
setIF(proc^1, ((val & 0x0004)<<15));
|
||||
return;
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val);
|
||||
}
|
||||
|
||||
// ========================================================= GFX FIFO
|
||||
GFX_FIFO gxFIFO;
|
||||
|
||||
void GFX_FIFOclear()
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0x0000FFFF;
|
||||
|
||||
gxFIFO.tail = 0;
|
||||
gxstat |= 0x06000000;
|
||||
gxstat |= 0x00000002; // this is hack (must be removed later)
|
||||
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);
|
||||
if (gxstat & 0x01000000) return; // full
|
||||
|
||||
gxstat &= 0x0000FFFF;
|
||||
gxstat |= 0x00000002; // this is hack (must be removed later)
|
||||
|
||||
gxFIFO.cmd[gxFIFO.tail] = cmd;
|
||||
gxFIFO.param[gxFIFO.tail] = param;
|
||||
gxFIFO.tail++;
|
||||
if (gxFIFO.tail > 256)
|
||||
gxFIFO.tail = 256;
|
||||
|
||||
// TODO: irq handle
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x08000000; // busy
|
||||
#else
|
||||
gxstat |= 0x02000000; // this is hack (must be removed later)
|
||||
#endif
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
}
|
||||
|
||||
BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0xF000FFFF;
|
||||
gxstat |= 0x00000002; // this is hack (must be removed later)
|
||||
if (!gxFIFO.tail) // empty
|
||||
{
|
||||
//gxstat |= (0x01FF << 16);
|
||||
gxstat |= 0x06000000;
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
return FALSE;
|
||||
}
|
||||
*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];
|
||||
}
|
||||
|
||||
if (gxFIFO.tail) // not empty
|
||||
{
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
gxstat |= 0x08000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
gxstat |= 0x04000000;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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)\n", val, gxstat);
|
||||
if (val & (1<<29)) // clear? (homebrew)
|
||||
{
|
||||
// need to flush before???
|
||||
GFX_FIFOclear();
|
||||
return;
|
||||
}
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
|
||||
|
||||
if (gxstat & 0xC0000000)
|
||||
{
|
||||
//NDS_makeARM9Int(21);
|
||||
//MMU.reg_IF[0] = (1<<21);
|
||||
setIF(0, (1<<21));
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================= DISP FIFO
|
||||
DISP_FIFO disp_fifo;
|
||||
|
||||
void DISP_FIFOinit()
|
||||
{
|
||||
memset(&disp_fifo, 0, sizeof(DISP_FIFO));
|
||||
}
|
||||
|
||||
void DISP_FIFOsend(u32 val)
|
||||
{
|
||||
//INFO("DISP_FIFO send value 0x%08X (head 0x%06X, tail 0x%06X)\n", val, disp_fifo.head, disp_fifo.tail);
|
||||
disp_fifo.buf[disp_fifo.tail] = val;
|
||||
disp_fifo.tail++;
|
||||
if (disp_fifo.tail > 0x5FFF)
|
||||
disp_fifo.tail = 0;
|
||||
}
|
||||
|
||||
u32 DISP_FIFOrecv()
|
||||
{
|
||||
//if (disp_fifo.tail == disp_fifo.head) return (0); // FIFO is empty
|
||||
u32 val = disp_fifo.buf[disp_fifo.head];
|
||||
disp_fifo.head++;
|
||||
if (disp_fifo.head > 0x5FFF)
|
||||
disp_fifo.head = 0;
|
||||
return (val);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#ifndef FIFO_H
|
||||
#define FIFO_H
|
||||
|
||||
|
||||
//#define USE_GEOMETRY_FIFO_EMULATION
|
||||
|
||||
#include "types.h"
|
||||
|
@ -69,7 +69,7 @@ typedef struct
|
|||
|
||||
extern DISP_FIFO disp_fifo;
|
||||
extern void DISP_FIFOinit();
|
||||
extern void DISP_FIFOsend(u32 val);
|
||||
extern void DISP_FIFOsend(u32 val);
|
||||
extern u32 DISP_FIFOrecv();
|
||||
|
||||
#endif
|
||||
|
|
6962
desmume/src/GPU.cpp
6962
desmume/src/GPU.cpp
File diff suppressed because it is too large
Load Diff
1844
desmume/src/GPU.h
1844
desmume/src/GPU.h
File diff suppressed because it is too large
Load Diff
|
@ -1,186 +1,186 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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
|
||||
*/
|
||||
|
||||
#include "GPU_osd.h"
|
||||
#include "GPU.h"
|
||||
#include "mem.h"
|
||||
#include <string.h> //mem funcs
|
||||
#include <stdarg.h> //va_start, etc
|
||||
#include "debug.h"
|
||||
|
||||
#include "softrender.h"
|
||||
|
||||
#include "softrender_v3sysfont.h"
|
||||
#include "softrender_desmumefont.h"
|
||||
|
||||
using namespace softrender;
|
||||
|
||||
image screenshell;
|
||||
|
||||
OSDCLASS::OSDCLASS(u8 core)
|
||||
{
|
||||
memset(screen, 0, sizeof(screen));
|
||||
memset(name,0,7);
|
||||
//memset(line, 0, sizeof(line));
|
||||
memset(timer, 0, sizeof(timer));
|
||||
memset(color, 0, sizeof(color));
|
||||
|
||||
old_msg = new char[512];
|
||||
memset(old_msg, 0, 512);
|
||||
|
||||
current_color = 0x8F;
|
||||
mode=core;
|
||||
offset=0;
|
||||
startline=0;
|
||||
lastline=0;
|
||||
|
||||
rotAngle = 0;
|
||||
|
||||
needUpdate = false;
|
||||
|
||||
if (core==0)
|
||||
memcpy(name,"Core A",6);
|
||||
else
|
||||
if (core==1)
|
||||
memcpy(name,"Core B",6);
|
||||
else
|
||||
{
|
||||
memcpy(name,"Main",6);
|
||||
mode=255;
|
||||
}
|
||||
|
||||
screenshell.shell = true;
|
||||
screenshell.data = screen;
|
||||
screenshell.bpp = 15;
|
||||
screenshell.width = 256;
|
||||
screenshell.height = 384;
|
||||
screenshell.pitch = 256;
|
||||
screenshell.cx1 = 0;
|
||||
screenshell.cx2 = 256-1;
|
||||
screenshell.cy1 = 0;
|
||||
screenshell.cy2 = 384-1;
|
||||
|
||||
LOG("OSD_Init (%s)\n",name);
|
||||
}
|
||||
|
||||
OSDCLASS::~OSDCLASS()
|
||||
{
|
||||
LOG("OSD_Deinit (%s)\n",name);
|
||||
|
||||
delete[] old_msg;
|
||||
}
|
||||
|
||||
void OSDCLASS::setOffset(u16 ofs)
|
||||
{
|
||||
offset=ofs;
|
||||
}
|
||||
|
||||
void OSDCLASS::setRotate(u16 angle)
|
||||
{
|
||||
rotAngle = angle;
|
||||
|
||||
switch(rotAngle)
|
||||
{
|
||||
case 0:
|
||||
case 180:
|
||||
{
|
||||
screenshell.width = 256;
|
||||
screenshell.height = 384;
|
||||
screenshell.pitch = 256;
|
||||
screenshell.cx1 = 0;
|
||||
screenshell.cx2 = 255;
|
||||
screenshell.cy1 = 0;
|
||||
screenshell.cy2 = 383;
|
||||
}
|
||||
break;
|
||||
case 90:
|
||||
case 270:
|
||||
{
|
||||
screenshell.width = 384;
|
||||
screenshell.height = 256;
|
||||
screenshell.pitch = 384;
|
||||
screenshell.cx1 = 0;
|
||||
screenshell.cx2 = 383;
|
||||
screenshell.cy1 = 0;
|
||||
screenshell.cy2 = 255;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OSDCLASS::clear()
|
||||
{
|
||||
memset(screen, 0, sizeof(screen));
|
||||
memset(line, 0, sizeof(line));
|
||||
memset(timer, 0, sizeof(timer));
|
||||
needUpdate=false;
|
||||
}
|
||||
|
||||
void OSDCLASS::setColor(u16 col)
|
||||
{
|
||||
current_color = col;
|
||||
}
|
||||
|
||||
void OSDCLASS::update() // don't optimized
|
||||
{
|
||||
if (!needUpdate) return; // don't update if buffer empty (speed up)
|
||||
|
||||
u16 *dst = (u16*)GPU_screen;
|
||||
|
||||
if (mode!=255)
|
||||
dst+=offset*512;
|
||||
|
||||
for (int i=0; i<256*192; i++)
|
||||
{
|
||||
if(screen[i]&0x8000)
|
||||
T2WriteWord((u8*)dst,(i << 1), screen[i] );
|
||||
}
|
||||
}
|
||||
|
||||
void OSDCLASS::addLine(const char *fmt, ...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OSDCLASS::addFixed(u16 x, u16 y, const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[1024];
|
||||
|
||||
// memset(msg,0,1024);
|
||||
|
||||
va_start(list,fmt);
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
_vsnprintf(msg,1023,fmt,list);
|
||||
#else
|
||||
vsnprintf(msg,1023,fmt,list);
|
||||
#endif
|
||||
|
||||
va_end(list);
|
||||
|
||||
if (strcmp(msg, old_msg) == 0) return;
|
||||
|
||||
render51.PrintString<DesmumeFont>(1,x,y,render51.MakeColor(128,0,0),msg,&screenshell);
|
||||
|
||||
needUpdate = true;
|
||||
}
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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
|
||||
*/
|
||||
|
||||
#include "GPU_osd.h"
|
||||
#include "GPU.h"
|
||||
#include "mem.h"
|
||||
#include <string.h> //mem funcs
|
||||
#include <stdarg.h> //va_start, etc
|
||||
#include "debug.h"
|
||||
|
||||
#include "softrender.h"
|
||||
|
||||
#include "softrender_v3sysfont.h"
|
||||
#include "softrender_desmumefont.h"
|
||||
|
||||
using namespace softrender;
|
||||
|
||||
image screenshell;
|
||||
|
||||
OSDCLASS::OSDCLASS(u8 core)
|
||||
{
|
||||
memset(screen, 0, sizeof(screen));
|
||||
memset(name,0,7);
|
||||
//memset(line, 0, sizeof(line));
|
||||
memset(timer, 0, sizeof(timer));
|
||||
memset(color, 0, sizeof(color));
|
||||
|
||||
old_msg = new char[512];
|
||||
memset(old_msg, 0, 512);
|
||||
|
||||
current_color = 0x8F;
|
||||
mode=core;
|
||||
offset=0;
|
||||
startline=0;
|
||||
lastline=0;
|
||||
|
||||
rotAngle = 0;
|
||||
|
||||
needUpdate = false;
|
||||
|
||||
if (core==0)
|
||||
memcpy(name,"Core A",6);
|
||||
else
|
||||
if (core==1)
|
||||
memcpy(name,"Core B",6);
|
||||
else
|
||||
{
|
||||
memcpy(name,"Main",6);
|
||||
mode=255;
|
||||
}
|
||||
|
||||
screenshell.shell = true;
|
||||
screenshell.data = screen;
|
||||
screenshell.bpp = 15;
|
||||
screenshell.width = 256;
|
||||
screenshell.height = 384;
|
||||
screenshell.pitch = 256;
|
||||
screenshell.cx1 = 0;
|
||||
screenshell.cx2 = 256-1;
|
||||
screenshell.cy1 = 0;
|
||||
screenshell.cy2 = 384-1;
|
||||
|
||||
LOG("OSD_Init (%s)\n",name);
|
||||
}
|
||||
|
||||
OSDCLASS::~OSDCLASS()
|
||||
{
|
||||
LOG("OSD_Deinit (%s)\n",name);
|
||||
|
||||
delete[] old_msg;
|
||||
}
|
||||
|
||||
void OSDCLASS::setOffset(u16 ofs)
|
||||
{
|
||||
offset=ofs;
|
||||
}
|
||||
|
||||
void OSDCLASS::setRotate(u16 angle)
|
||||
{
|
||||
rotAngle = angle;
|
||||
|
||||
switch(rotAngle)
|
||||
{
|
||||
case 0:
|
||||
case 180:
|
||||
{
|
||||
screenshell.width = 256;
|
||||
screenshell.height = 384;
|
||||
screenshell.pitch = 256;
|
||||
screenshell.cx1 = 0;
|
||||
screenshell.cx2 = 255;
|
||||
screenshell.cy1 = 0;
|
||||
screenshell.cy2 = 383;
|
||||
}
|
||||
break;
|
||||
case 90:
|
||||
case 270:
|
||||
{
|
||||
screenshell.width = 384;
|
||||
screenshell.height = 256;
|
||||
screenshell.pitch = 384;
|
||||
screenshell.cx1 = 0;
|
||||
screenshell.cx2 = 383;
|
||||
screenshell.cy1 = 0;
|
||||
screenshell.cy2 = 255;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OSDCLASS::clear()
|
||||
{
|
||||
memset(screen, 0, sizeof(screen));
|
||||
memset(line, 0, sizeof(line));
|
||||
memset(timer, 0, sizeof(timer));
|
||||
needUpdate=false;
|
||||
}
|
||||
|
||||
void OSDCLASS::setColor(u16 col)
|
||||
{
|
||||
current_color = col;
|
||||
}
|
||||
|
||||
void OSDCLASS::update() // don't optimized
|
||||
{
|
||||
if (!needUpdate) return; // don't update if buffer empty (speed up)
|
||||
|
||||
u16 *dst = (u16*)GPU_screen;
|
||||
|
||||
if (mode!=255)
|
||||
dst+=offset*512;
|
||||
|
||||
for (int i=0; i<256*192; i++)
|
||||
{
|
||||
if(screen[i]&0x8000)
|
||||
T2WriteWord((u8*)dst,(i << 1), screen[i] );
|
||||
}
|
||||
}
|
||||
|
||||
void OSDCLASS::addLine(const char *fmt, ...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OSDCLASS::addFixed(u16 x, u16 y, const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[1024];
|
||||
|
||||
// memset(msg,0,1024);
|
||||
|
||||
va_start(list,fmt);
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
_vsnprintf(msg,1023,fmt,list);
|
||||
#else
|
||||
vsnprintf(msg,1023,fmt,list);
|
||||
#endif
|
||||
|
||||
va_end(list);
|
||||
|
||||
if (strcmp(msg, old_msg) == 0) return;
|
||||
|
||||
render51.PrintString<DesmumeFont>(1,x,y,render51.MakeColor(128,0,0),msg,&screenshell);
|
||||
|
||||
needUpdate = true;
|
||||
}
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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 __GPU_OSD_
|
||||
#define __GPU_OSD_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "types.h"
|
||||
|
||||
#define OSD_MAX_LINES 10
|
||||
|
||||
class OSDCLASS
|
||||
{
|
||||
private:
|
||||
u16 screen[256*192*2];
|
||||
u64 offset;
|
||||
u8 mode;
|
||||
|
||||
u16 rotAngle;
|
||||
|
||||
u8 startline;
|
||||
u8 lastline;
|
||||
|
||||
u8 *line[OSD_MAX_LINES];
|
||||
u8 timer[OSD_MAX_LINES];
|
||||
u8 color[OSD_MAX_LINES];
|
||||
|
||||
char *old_msg;
|
||||
|
||||
u16 current_color;
|
||||
|
||||
bool needUpdate;
|
||||
|
||||
void printChar(u16 x, u16 y, u8 c);
|
||||
public:
|
||||
char name[7]; // for debuging
|
||||
OSDCLASS(u8 core);
|
||||
~OSDCLASS();
|
||||
|
||||
void setOffset(u16 ofs);
|
||||
void setRotate(u16 angle);
|
||||
void update();
|
||||
void clear();
|
||||
void setColor(u16 col);
|
||||
void addLine(const char *fmt, ...);
|
||||
void addFixed(u16 x, u16 y, const char *fmt, ...);
|
||||
};
|
||||
|
||||
extern OSDCLASS *osd;
|
||||
extern OSDCLASS *osdA;
|
||||
extern OSDCLASS *osdB;
|
||||
|
||||
#endif
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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 __GPU_OSD_
|
||||
#define __GPU_OSD_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "types.h"
|
||||
|
||||
#define OSD_MAX_LINES 10
|
||||
|
||||
class OSDCLASS
|
||||
{
|
||||
private:
|
||||
u16 screen[256*192*2];
|
||||
u64 offset;
|
||||
u8 mode;
|
||||
|
||||
u16 rotAngle;
|
||||
|
||||
u8 startline;
|
||||
u8 lastline;
|
||||
|
||||
u8 *line[OSD_MAX_LINES];
|
||||
u8 timer[OSD_MAX_LINES];
|
||||
u8 color[OSD_MAX_LINES];
|
||||
|
||||
char *old_msg;
|
||||
|
||||
u16 current_color;
|
||||
|
||||
bool needUpdate;
|
||||
|
||||
void printChar(u16 x, u16 y, u8 c);
|
||||
public:
|
||||
char name[7]; // for debuging
|
||||
OSDCLASS(u8 core);
|
||||
~OSDCLASS();
|
||||
|
||||
void setOffset(u16 ofs);
|
||||
void setRotate(u16 angle);
|
||||
void update();
|
||||
void clear();
|
||||
void setColor(u16 col);
|
||||
void addLine(const char *fmt, ...);
|
||||
void addFixed(u16 x, u16 y, const char *fmt, ...);
|
||||
};
|
||||
|
||||
extern OSDCLASS *osd;
|
||||
extern OSDCLASS *osdA;
|
||||
extern OSDCLASS *osdB;
|
||||
|
||||
#endif
|
||||
|
|
8424
desmume/src/MMU.cpp
8424
desmume/src/MMU.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,361 +1,361 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2007 shash
|
||||
Copyright (C) 2007-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 MMU_H
|
||||
#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
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2007 shash
|
||||
Copyright (C) 2007-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 MMU_H
|
||||
#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)
|
||||
#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 u32 TWaitState;
|
||||
|
||||
struct MMU_struct {
|
||||
//ARM7 mem
|
||||
u8 ARM7_BIOS[0x4000];
|
||||
u8 ARM7_ERAM[0x10000];
|
||||
u8 ARM7_REG[0x10000];
|
||||
u8 ARM7_WIRAM[0x10000];
|
||||
|
||||
// VRAM mapping
|
||||
u8 VRAM_MAP[4][32];
|
||||
u32 LCD_VRAM_ADDR[10];
|
||||
u8 LCDCenable[10];
|
||||
|
||||
//Shared ram
|
||||
u8 SWIRAM[0x8000];
|
||||
|
||||
//Card rom & ram
|
||||
u8 * CART_ROM;
|
||||
u8 CART_RAM[0x10000];
|
||||
|
||||
//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];
|
||||
|
||||
static u8 * MMU_MEM[2][256];
|
||||
static u32 MMU_MASK[2][256];
|
||||
|
||||
u8 ARM9_RW_MODE;
|
||||
|
||||
static TWaitState MMU_WAIT16[2][16];
|
||||
static TWaitState MMU_WAIT32[2][16];
|
||||
|
||||
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];
|
||||
|
||||
BOOL divRunning;
|
||||
s64 divResult;
|
||||
s64 divMod;
|
||||
u32 divCnt;
|
||||
s32 divCycles;
|
||||
|
||||
BOOL sqrtRunning;
|
||||
u32 sqrtResult;
|
||||
u32 sqrtCnt;
|
||||
s32 sqrtCycles;
|
||||
|
||||
u8 powerMan_CntReg;
|
||||
BOOL powerMan_CntRegWritten;
|
||||
u8 powerMan_Reg[4];
|
||||
|
||||
memory_chip_t fw;
|
||||
memory_chip_t bupmem;
|
||||
|
||||
nds_dscard dscard[2];
|
||||
u32 CheckTimers;
|
||||
u32 CheckDMAs;
|
||||
|
||||
};
|
||||
|
||||
extern MMU_struct MMU;
|
||||
|
||||
|
||||
struct armcpu_memory_iface {
|
||||
/** the 32 bit instruction prefetch */
|
||||
u32 FASTCALL (*prefetch32)( void *data, u32 adr);
|
||||
|
||||
/** the 16 bit instruction prefetch */
|
||||
u16 FASTCALL (*prefetch16)( void *data, u32 adr);
|
||||
|
||||
/** read 8 bit data value */
|
||||
u8 FASTCALL (*read8)( void *data, u32 adr);
|
||||
/** read 16 bit data value */
|
||||
u16 FASTCALL (*read16)( void *data, u32 adr);
|
||||
/** read 32 bit data value */
|
||||
u32 FASTCALL (*read32)( void *data, u32 adr);
|
||||
|
||||
/** write 8 bit data value */
|
||||
void FASTCALL (*write8)( void *data, u32 adr, u8 val);
|
||||
/** write 16 bit data value */
|
||||
void FASTCALL (*write16)( void *data, u32 adr, u16 val);
|
||||
/** write 32 bit data value */
|
||||
void FASTCALL (*write32)( void *data, u32 adr, u32 val);
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
||||
void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize);
|
||||
|
||||
void MMU_Init(void);
|
||||
void MMU_DeInit(void);
|
||||
|
||||
void MMU_clearMem( void);
|
||||
|
||||
void MMU_setRom(u8 * rom, u32 mask);
|
||||
void MMU_unsetRom( void);
|
||||
|
||||
void print_memory_profiling( void);
|
||||
|
||||
// Memory reading/writing (old)
|
||||
u8 FASTCALL MMU_read8(u32 proc, u32 adr);
|
||||
u16 FASTCALL MMU_read16(u32 proc, u32 adr);
|
||||
u32 FASTCALL MMU_read32(u32 proc, u32 adr);
|
||||
void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val);
|
||||
void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val);
|
||||
void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val);
|
||||
|
||||
template<int PROCNUM> void FASTCALL MMU_doDMA(u32 num);
|
||||
|
||||
/*
|
||||
* The base ARM memory interfaces
|
||||
*/
|
||||
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;
|
||||
|
||||
extern u8 *MMU_RenderMapToLCD(u32 vram_addr);
|
||||
|
||||
template<int PROCNUM> u8 _MMU_read08(u32 addr);
|
||||
template<int PROCNUM> u16 _MMU_read16(u32 addr);
|
||||
template<int PROCNUM> u32 _MMU_read32(u32 addr);
|
||||
template<int PROCNUM> void _MMU_write08(u32 addr, u8 val);
|
||||
template<int PROCNUM> void _MMU_write16(u32 addr, u16 val);
|
||||
template<int PROCNUM> void _MMU_write32(u32 addr, u32 val);
|
||||
|
||||
void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val);
|
||||
void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val);
|
||||
void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val);
|
||||
u8 FASTCALL _MMU_ARM9_read08(u32 adr);
|
||||
u16 FASTCALL _MMU_ARM9_read16(u32 adr);
|
||||
u32 FASTCALL _MMU_ARM9_read32(u32 adr);
|
||||
|
||||
void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val);
|
||||
void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val);
|
||||
void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val);
|
||||
u8 FASTCALL _MMU_ARM7_read08(u32 adr);
|
||||
u16 FASTCALL _MMU_ARM7_read16(u32 adr);
|
||||
u32 FASTCALL _MMU_ARM7_read32(u32 adr);
|
||||
|
||||
extern u32 _MMU_MAIN_MEM_MASK;
|
||||
inline void SetupMMU(bool debugConsole) {
|
||||
if(debugConsole) _MMU_MAIN_MEM_MASK = 0x7FFFFF;
|
||||
else _MMU_MAIN_MEM_MASK = 0x3FFFFF;
|
||||
}
|
||||
|
||||
FORCEINLINE u8 _MMU_read08(const int PROCNUM, u32 addr) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
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);
|
||||
}
|
||||
|
||||
FORCEINLINE u16 _MMU_read16(const int PROCNUM, u32 addr) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read16(addr);
|
||||
else return _MMU_ARM7_read16(addr);
|
||||
}
|
||||
|
||||
FORCEINLINE u32 _MMU_read32(int PROCNUM, u32 addr) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read32(addr);
|
||||
else return _MMU_ARM7_read32(addr);
|
||||
}
|
||||
|
||||
FORCEINLINE void _MMU_write08(const int PROCNUM, u32 addr, u8 val) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteByte( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write08(addr,val);
|
||||
else _MMU_ARM7_write08(addr,val);
|
||||
}
|
||||
|
||||
FORCEINLINE void _MMU_write16(const int PROCNUM, u32 addr, u16 val) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write16(addr,val);
|
||||
else _MMU_ARM7_write16(addr,val);
|
||||
}
|
||||
|
||||
FORCEINLINE void _MMU_write32(const int PROCNUM, u32 addr, u32 val) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write32(addr,val);
|
||||
else _MMU_ARM7_write32(addr,val);
|
||||
}
|
||||
|
||||
|
||||
#ifdef MMU_ENABLE_ACL
|
||||
void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val);
|
||||
void FASTCALL MMU_write16_acl(u32 proc, u32 adr, u16 val);
|
||||
void FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val);
|
||||
u8 FASTCALL MMU_read8_acl(u32 proc, u32 adr, u32 access);
|
||||
u16 FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access);
|
||||
u32 FASTCALL MMU_read32_acl(u32 proc, u32 adr, u32 access);
|
||||
#else
|
||||
#define MMU_write8_acl(proc, adr, val) _MMU_write08<proc>(adr, val)
|
||||
#define MMU_write16_acl(proc, adr, val) _MMU_write16<proc>(adr, val)
|
||||
#define MMU_write32_acl(proc, adr, val) _MMU_write32<proc>(adr, val)
|
||||
#define MMU_read8_acl(proc,adr,access) _MMU_read08<proc>(adr)
|
||||
#define MMU_read16_acl(proc,adr,access) _MMU_read16<proc>(adr)
|
||||
#define MMU_read32_acl(proc,adr,access) _MMU_read32<proc>(adr)
|
||||
#endif
|
||||
|
||||
// Use this macros for reading/writing, so the GDB stub isn't broken
|
||||
#ifdef GDB_STUB
|
||||
#define READ32(a,b) cpu->mem_if->read32(a,(b) & 0xFFFFFFFC)
|
||||
#define WRITE32(a,b,c) cpu->mem_if->write32(a,(b) & 0xFFFFFFFC,c)
|
||||
#define READ16(a,b) cpu->mem_if->read16(a,(b) & 0xFFFFFFFE)
|
||||
#define WRITE16(a,b,c) cpu->mem_if->write16(a,(b) & 0xFFFFFFFE,c)
|
||||
#define READ8(a,b) cpu->mem_if->read8(a,b)
|
||||
#define WRITE8(a,b,c) cpu->mem_if->write8(a,b,c)
|
||||
#else
|
||||
#define READ32(a,b) _MMU_read32<PROCNUM>((b) & 0xFFFFFFFC)
|
||||
#define WRITE32(a,b,c) _MMU_write32<PROCNUM>((b) & 0xFFFFFFFC,c)
|
||||
#define READ16(a,b) _MMU_read16<PROCNUM>((b) & 0xFFFFFFFE)
|
||||
#define WRITE16(a,b,c) _MMU_write16<PROCNUM>((b) & 0xFFFFFFFE,c)
|
||||
#define READ8(a,b) _MMU_read08<PROCNUM>(b)
|
||||
#define WRITE8(a,b,c) _MMU_write08<PROCNUM>(b, c)
|
||||
#endif
|
||||
|
||||
template<int PROCNUM>
|
||||
u8 _MMU_read08(u32 addr) { return _MMU_read08(PROCNUM, addr); }
|
||||
|
||||
template<int PROCNUM>
|
||||
u16 _MMU_read16(u32 addr) { return _MMU_read16(PROCNUM, addr); }
|
||||
|
||||
template<int PROCNUM>
|
||||
u32 _MMU_read32(u32 addr) { return _MMU_read32(PROCNUM, addr); }
|
||||
|
||||
template<int PROCNUM>
|
||||
void _MMU_write08(u32 addr, u8 val) { _MMU_write08(PROCNUM, addr, val); }
|
||||
|
||||
template<int PROCNUM>
|
||||
void _MMU_write16(u32 addr, u16 val) { _MMU_write16(PROCNUM, addr, val); }
|
||||
|
||||
template<int PROCNUM>
|
||||
void _MMU_write32(u32 addr, u32 val) { _MMU_write32(PROCNUM, addr, val); }
|
||||
|
||||
#endif
|
||||
#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 u32 TWaitState;
|
||||
|
||||
struct MMU_struct {
|
||||
//ARM7 mem
|
||||
u8 ARM7_BIOS[0x4000];
|
||||
u8 ARM7_ERAM[0x10000];
|
||||
u8 ARM7_REG[0x10000];
|
||||
u8 ARM7_WIRAM[0x10000];
|
||||
|
||||
// VRAM mapping
|
||||
u8 VRAM_MAP[4][32];
|
||||
u32 LCD_VRAM_ADDR[10];
|
||||
u8 LCDCenable[10];
|
||||
|
||||
//Shared ram
|
||||
u8 SWIRAM[0x8000];
|
||||
|
||||
//Card rom & ram
|
||||
u8 * CART_ROM;
|
||||
u8 CART_RAM[0x10000];
|
||||
|
||||
//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];
|
||||
|
||||
static u8 * MMU_MEM[2][256];
|
||||
static u32 MMU_MASK[2][256];
|
||||
|
||||
u8 ARM9_RW_MODE;
|
||||
|
||||
static TWaitState MMU_WAIT16[2][16];
|
||||
static TWaitState MMU_WAIT32[2][16];
|
||||
|
||||
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];
|
||||
|
||||
BOOL divRunning;
|
||||
s64 divResult;
|
||||
s64 divMod;
|
||||
u32 divCnt;
|
||||
s32 divCycles;
|
||||
|
||||
BOOL sqrtRunning;
|
||||
u32 sqrtResult;
|
||||
u32 sqrtCnt;
|
||||
s32 sqrtCycles;
|
||||
|
||||
u8 powerMan_CntReg;
|
||||
BOOL powerMan_CntRegWritten;
|
||||
u8 powerMan_Reg[4];
|
||||
|
||||
memory_chip_t fw;
|
||||
memory_chip_t bupmem;
|
||||
|
||||
nds_dscard dscard[2];
|
||||
u32 CheckTimers;
|
||||
u32 CheckDMAs;
|
||||
|
||||
};
|
||||
|
||||
extern MMU_struct MMU;
|
||||
|
||||
|
||||
struct armcpu_memory_iface {
|
||||
/** the 32 bit instruction prefetch */
|
||||
u32 FASTCALL (*prefetch32)( void *data, u32 adr);
|
||||
|
||||
/** the 16 bit instruction prefetch */
|
||||
u16 FASTCALL (*prefetch16)( void *data, u32 adr);
|
||||
|
||||
/** read 8 bit data value */
|
||||
u8 FASTCALL (*read8)( void *data, u32 adr);
|
||||
/** read 16 bit data value */
|
||||
u16 FASTCALL (*read16)( void *data, u32 adr);
|
||||
/** read 32 bit data value */
|
||||
u32 FASTCALL (*read32)( void *data, u32 adr);
|
||||
|
||||
/** write 8 bit data value */
|
||||
void FASTCALL (*write8)( void *data, u32 adr, u8 val);
|
||||
/** write 16 bit data value */
|
||||
void FASTCALL (*write16)( void *data, u32 adr, u16 val);
|
||||
/** write 32 bit data value */
|
||||
void FASTCALL (*write32)( void *data, u32 adr, u32 val);
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
||||
void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize);
|
||||
|
||||
void MMU_Init(void);
|
||||
void MMU_DeInit(void);
|
||||
|
||||
void MMU_clearMem( void);
|
||||
|
||||
void MMU_setRom(u8 * rom, u32 mask);
|
||||
void MMU_unsetRom( void);
|
||||
|
||||
void print_memory_profiling( void);
|
||||
|
||||
// Memory reading/writing (old)
|
||||
u8 FASTCALL MMU_read8(u32 proc, u32 adr);
|
||||
u16 FASTCALL MMU_read16(u32 proc, u32 adr);
|
||||
u32 FASTCALL MMU_read32(u32 proc, u32 adr);
|
||||
void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val);
|
||||
void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val);
|
||||
void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val);
|
||||
|
||||
template<int PROCNUM> void FASTCALL MMU_doDMA(u32 num);
|
||||
|
||||
/*
|
||||
* The base ARM memory interfaces
|
||||
*/
|
||||
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;
|
||||
|
||||
extern u8 *MMU_RenderMapToLCD(u32 vram_addr);
|
||||
|
||||
template<int PROCNUM> u8 _MMU_read08(u32 addr);
|
||||
template<int PROCNUM> u16 _MMU_read16(u32 addr);
|
||||
template<int PROCNUM> u32 _MMU_read32(u32 addr);
|
||||
template<int PROCNUM> void _MMU_write08(u32 addr, u8 val);
|
||||
template<int PROCNUM> void _MMU_write16(u32 addr, u16 val);
|
||||
template<int PROCNUM> void _MMU_write32(u32 addr, u32 val);
|
||||
|
||||
void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val);
|
||||
void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val);
|
||||
void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val);
|
||||
u8 FASTCALL _MMU_ARM9_read08(u32 adr);
|
||||
u16 FASTCALL _MMU_ARM9_read16(u32 adr);
|
||||
u32 FASTCALL _MMU_ARM9_read32(u32 adr);
|
||||
|
||||
void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val);
|
||||
void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val);
|
||||
void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val);
|
||||
u8 FASTCALL _MMU_ARM7_read08(u32 adr);
|
||||
u16 FASTCALL _MMU_ARM7_read16(u32 adr);
|
||||
u32 FASTCALL _MMU_ARM7_read32(u32 adr);
|
||||
|
||||
extern u32 _MMU_MAIN_MEM_MASK;
|
||||
inline void SetupMMU(bool debugConsole) {
|
||||
if(debugConsole) _MMU_MAIN_MEM_MASK = 0x7FFFFF;
|
||||
else _MMU_MAIN_MEM_MASK = 0x3FFFFF;
|
||||
}
|
||||
|
||||
FORCEINLINE u8 _MMU_read08(const int PROCNUM, u32 addr) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
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);
|
||||
}
|
||||
|
||||
FORCEINLINE u16 _MMU_read16(const int PROCNUM, u32 addr) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read16(addr);
|
||||
else return _MMU_ARM7_read16(addr);
|
||||
}
|
||||
|
||||
FORCEINLINE u32 _MMU_read32(int PROCNUM, u32 addr) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
//Returns data from DTCM (ARM9 only)
|
||||
return T1ReadLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000)
|
||||
return T1ReadLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK);
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read32(addr);
|
||||
else return _MMU_ARM7_read32(addr);
|
||||
}
|
||||
|
||||
FORCEINLINE void _MMU_write08(const int PROCNUM, u32 addr, u8 val) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteByte( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write08(addr,val);
|
||||
else _MMU_ARM7_write08(addr,val);
|
||||
}
|
||||
|
||||
FORCEINLINE void _MMU_write16(const int PROCNUM, u32 addr, u16 val) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write16(addr,val);
|
||||
else _MMU_ARM7_write16(addr,val);
|
||||
}
|
||||
|
||||
FORCEINLINE void _MMU_write32(const int PROCNUM, u32 addr, u32 val) {
|
||||
if(PROCNUM==ARMCPU_ARM9)
|
||||
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
|
||||
{
|
||||
T1WriteLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (addr & 0x0F000000) == 0x02000000) {
|
||||
T1WriteLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val);
|
||||
return;
|
||||
}
|
||||
|
||||
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write32(addr,val);
|
||||
else _MMU_ARM7_write32(addr,val);
|
||||
}
|
||||
|
||||
|
||||
#ifdef MMU_ENABLE_ACL
|
||||
void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val);
|
||||
void FASTCALL MMU_write16_acl(u32 proc, u32 adr, u16 val);
|
||||
void FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val);
|
||||
u8 FASTCALL MMU_read8_acl(u32 proc, u32 adr, u32 access);
|
||||
u16 FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access);
|
||||
u32 FASTCALL MMU_read32_acl(u32 proc, u32 adr, u32 access);
|
||||
#else
|
||||
#define MMU_write8_acl(proc, adr, val) _MMU_write08<proc>(adr, val)
|
||||
#define MMU_write16_acl(proc, adr, val) _MMU_write16<proc>(adr, val)
|
||||
#define MMU_write32_acl(proc, adr, val) _MMU_write32<proc>(adr, val)
|
||||
#define MMU_read8_acl(proc,adr,access) _MMU_read08<proc>(adr)
|
||||
#define MMU_read16_acl(proc,adr,access) _MMU_read16<proc>(adr)
|
||||
#define MMU_read32_acl(proc,adr,access) _MMU_read32<proc>(adr)
|
||||
#endif
|
||||
|
||||
// Use this macros for reading/writing, so the GDB stub isn't broken
|
||||
#ifdef GDB_STUB
|
||||
#define READ32(a,b) cpu->mem_if->read32(a,(b) & 0xFFFFFFFC)
|
||||
#define WRITE32(a,b,c) cpu->mem_if->write32(a,(b) & 0xFFFFFFFC,c)
|
||||
#define READ16(a,b) cpu->mem_if->read16(a,(b) & 0xFFFFFFFE)
|
||||
#define WRITE16(a,b,c) cpu->mem_if->write16(a,(b) & 0xFFFFFFFE,c)
|
||||
#define READ8(a,b) cpu->mem_if->read8(a,b)
|
||||
#define WRITE8(a,b,c) cpu->mem_if->write8(a,b,c)
|
||||
#else
|
||||
#define READ32(a,b) _MMU_read32<PROCNUM>((b) & 0xFFFFFFFC)
|
||||
#define WRITE32(a,b,c) _MMU_write32<PROCNUM>((b) & 0xFFFFFFFC,c)
|
||||
#define READ16(a,b) _MMU_read16<PROCNUM>((b) & 0xFFFFFFFE)
|
||||
#define WRITE16(a,b,c) _MMU_write16<PROCNUM>((b) & 0xFFFFFFFE,c)
|
||||
#define READ8(a,b) _MMU_read08<PROCNUM>(b)
|
||||
#define WRITE8(a,b,c) _MMU_write08<PROCNUM>(b, c)
|
||||
#endif
|
||||
|
||||
template<int PROCNUM>
|
||||
u8 _MMU_read08(u32 addr) { return _MMU_read08(PROCNUM, addr); }
|
||||
|
||||
template<int PROCNUM>
|
||||
u16 _MMU_read16(u32 addr) { return _MMU_read16(PROCNUM, addr); }
|
||||
|
||||
template<int PROCNUM>
|
||||
u32 _MMU_read32(u32 addr) { return _MMU_read32(PROCNUM, addr); }
|
||||
|
||||
template<int PROCNUM>
|
||||
void _MMU_write08(u32 addr, u8 val) { _MMU_write08(PROCNUM, addr, val); }
|
||||
|
||||
template<int PROCNUM>
|
||||
void _MMU_write16(u32 addr, u16 val) { _MMU_write16(PROCNUM, addr, val); }
|
||||
|
||||
template<int PROCNUM>
|
||||
void _MMU_write32(u32 addr, u32 val) { _MMU_write32(PROCNUM, addr, val); }
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,339 +1,339 @@
|
|||
/* 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
|
||||
*/
|
||||
|
||||
#ifndef NDSSYSTEM_H
|
||||
#define NDSSYSTEM_H
|
||||
|
||||
#include <string.h>
|
||||
#include "armcpu.h"
|
||||
#include "MMU.h"
|
||||
|
||||
#include "GPU.h"
|
||||
#include "SPU.h"
|
||||
|
||||
#include "mem.h"
|
||||
#include "wifi.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
extern volatile BOOL execute;
|
||||
extern BOOL click;
|
||||
extern char pathToROM[MAX_PATH];
|
||||
extern char pathFilenameToROMwithoutExt[MAX_PATH];
|
||||
|
||||
/*
|
||||
* The firmware language values
|
||||
*/
|
||||
#define NDS_FW_LANG_JAP 0
|
||||
#define NDS_FW_LANG_ENG 1
|
||||
#define NDS_FW_LANG_FRE 2
|
||||
#define NDS_FW_LANG_GER 3
|
||||
#define NDS_FW_LANG_ITA 4
|
||||
#define NDS_FW_LANG_SPA 5
|
||||
#define NDS_FW_LANG_CHI 6
|
||||
#define NDS_FW_LANG_RES 7
|
||||
|
||||
|
||||
//#define LOG_ARM9
|
||||
//#define LOG_ARM7
|
||||
|
||||
struct NDS_header
|
||||
{
|
||||
char gameTile[12];
|
||||
char gameCode[4];
|
||||
u16 makerCode;
|
||||
u8 unitCode;
|
||||
u8 deviceCode;
|
||||
u8 cardSize;
|
||||
u8 cardInfo[8];
|
||||
u8 flags;
|
||||
|
||||
u32 ARM9src;
|
||||
u32 ARM9exe;
|
||||
u32 ARM9cpy;
|
||||
u32 ARM9binSize;
|
||||
|
||||
u32 ARM7src;
|
||||
u32 ARM7exe;
|
||||
u32 ARM7cpy;
|
||||
u32 ARM7binSize;
|
||||
|
||||
u32 FNameTblOff;
|
||||
u32 FNameTblSize;
|
||||
|
||||
u32 FATOff;
|
||||
u32 FATSize;
|
||||
|
||||
u32 ARM9OverlayOff;
|
||||
u32 ARM9OverlaySize;
|
||||
u32 ARM7OverlayOff;
|
||||
u32 ARM7OverlaySize;
|
||||
|
||||
u32 unknown2a;
|
||||
u32 unknown2b;
|
||||
|
||||
u32 IconOff;
|
||||
u16 CRC16;
|
||||
u16 ROMtimeout;
|
||||
u32 ARM9unk;
|
||||
u32 ARM7unk;
|
||||
|
||||
u8 unknown3c[8];
|
||||
u32 ROMSize;
|
||||
u32 HeaderSize;
|
||||
u8 unknown5[56];
|
||||
u8 logo[156];
|
||||
u16 logoCRC16;
|
||||
u16 headerCRC16;
|
||||
u8 reserved[160];
|
||||
};
|
||||
|
||||
extern void debug();
|
||||
void emu_halt();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s32 ARM9Cycle;
|
||||
s32 ARM7Cycle;
|
||||
s32 cycles;
|
||||
s32 timerCycle[2][4];
|
||||
BOOL timerOver[2][4];
|
||||
s32 nextHBlank;
|
||||
u32 VCount;
|
||||
u32 old;
|
||||
s32 diff;
|
||||
BOOL lignerendu;
|
||||
|
||||
u16 touchX;
|
||||
u16 touchY;
|
||||
BOOL isTouch;
|
||||
u16 pad;
|
||||
|
||||
u8 *FW_ARM9BootCode;
|
||||
u8 *FW_ARM7BootCode;
|
||||
u32 FW_ARM9BootCodeAddr;
|
||||
u32 FW_ARM7BootCodeAddr;
|
||||
u32 FW_ARM9BootCodeSize;
|
||||
u32 FW_ARM7BootCodeSize;
|
||||
|
||||
BOOL sleeping;
|
||||
|
||||
//this is not essential NDS runtime state.
|
||||
//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 idleFrameCounter;
|
||||
|
||||
//if the game was booted on a debug console, this is set
|
||||
BOOL debugConsole;
|
||||
|
||||
bool isInVblank() const { return VCount >= 192; }
|
||||
bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
|
||||
} NDSSystem;
|
||||
|
||||
/** /brief A touchscreen calibration point.
|
||||
*/
|
||||
struct NDS_fw_touchscreen_cal {
|
||||
u16 adc_x;
|
||||
u16 adc_y;
|
||||
|
||||
u8 screen_x;
|
||||
u8 screen_y;
|
||||
};
|
||||
|
||||
/** /brief The type of DS
|
||||
*/
|
||||
enum nds_fw_ds_type {
|
||||
NDS_FW_DS_TYPE_FAT,
|
||||
NDS_FW_DS_TYPE_LITE,
|
||||
NDS_FW_DS_TYPE_iQue
|
||||
};
|
||||
|
||||
#define MAX_FW_NICKNAME_LENGTH 10
|
||||
#define MAX_FW_MESSAGE_LENGTH 26
|
||||
|
||||
struct NDS_fw_config_data {
|
||||
enum nds_fw_ds_type ds_type;
|
||||
|
||||
u8 fav_colour;
|
||||
u8 birth_month;
|
||||
u8 birth_day;
|
||||
|
||||
u16 nickname[MAX_FW_NICKNAME_LENGTH];
|
||||
u8 nickname_len;
|
||||
|
||||
u16 message[MAX_FW_MESSAGE_LENGTH];
|
||||
u8 message_len;
|
||||
|
||||
u8 language;
|
||||
|
||||
/* touchscreen calibration */
|
||||
struct NDS_fw_touchscreen_cal touch_cal[2];
|
||||
};
|
||||
|
||||
extern NDSSystem nds;
|
||||
|
||||
#ifdef GDB_STUB
|
||||
int NDS_Init( struct armcpu_memory_iface *arm9_mem_if,
|
||||
struct armcpu_ctrl_iface **arm9_ctrl_iface,
|
||||
struct armcpu_memory_iface *arm7_mem_if,
|
||||
struct armcpu_ctrl_iface **arm7_ctrl_iface);
|
||||
#else
|
||||
int NDS_Init ( void);
|
||||
#endif
|
||||
|
||||
void NDS_DeInit(void);
|
||||
void
|
||||
NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config);
|
||||
|
||||
BOOL NDS_SetROM(u8 * rom, u32 mask);
|
||||
NDS_header * NDS_getROMHeader(void);
|
||||
|
||||
void NDS_setTouchPos(u16 x, u16 y);
|
||||
void NDS_releaseTouch(void);
|
||||
void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,bool X,bool W,bool E,bool G, bool F);
|
||||
void NDS_setPadFromMovie(u16 pad);
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize);
|
||||
#else
|
||||
int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize,
|
||||
const char *cflash_disk_image_file);
|
||||
#endif
|
||||
void NDS_FreeROM(void);
|
||||
void NDS_Reset(void);
|
||||
int NDS_ImportSave(const char *filename);
|
||||
|
||||
int NDS_WriteBMP(const char *filename);
|
||||
int NDS_LoadFirmware(const char *filename);
|
||||
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
|
||||
|
||||
void NDS_Sleep();
|
||||
|
||||
void NDS_SkipFrame(bool skip);
|
||||
|
||||
template<bool FORCE>
|
||||
u32 NDS_exec(s32 nb);
|
||||
|
||||
extern int lagframecounter;
|
||||
|
||||
inline u32 NDS_exec(s32 nb) { return NDS_exec<false>(nb); }
|
||||
|
||||
static INLINE void NDS_ARM9HBlankInt(void)
|
||||
{
|
||||
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);
|
||||
NDS_ARM9.wIRQ = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void NDS_ARM7HBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
|
||||
{
|
||||
// MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
|
||||
setIF(1, 2);
|
||||
NDS_ARM7.wIRQ = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void NDS_ARM9VBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8)
|
||||
{
|
||||
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
|
||||
setIF(0, 1);
|
||||
NDS_ARM9.wIRQ = TRUE;
|
||||
//emu_halt();
|
||||
/*logcount++;*/
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void NDS_ARM7VBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
|
||||
// MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
|
||||
setIF(1, 1);
|
||||
NDS_ARM7.wIRQ = TRUE;
|
||||
//emu_halt();
|
||||
}
|
||||
|
||||
static INLINE void NDS_swapScreen(void)
|
||||
{
|
||||
u16 tmp = MainScreen.offset;
|
||||
MainScreen.offset = SubScreen.offset;
|
||||
SubScreen.offset = tmp;
|
||||
}
|
||||
|
||||
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
|
||||
|
||||
extern struct TCommonSettings {
|
||||
TCommonSettings()
|
||||
: HighResolutionInterpolateColor(true)
|
||||
, UseExtBIOS(false)
|
||||
, SWIFromBIOS(false)
|
||||
, UseExtFirmware(false)
|
||||
, BootFromFirmware(false)
|
||||
, DebugConsole(false)
|
||||
, wifiBridgeAdapterNum(0)
|
||||
{
|
||||
strcpy(ARM9BIOS, "biosnds9.bin");
|
||||
strcpy(ARM7BIOS, "biosnds7.bin");
|
||||
strcpy(Firmware, "firmware.bin");
|
||||
}
|
||||
bool HighResolutionInterpolateColor;
|
||||
|
||||
bool UseExtBIOS;
|
||||
char ARM9BIOS[256];
|
||||
char ARM7BIOS[256];
|
||||
bool SWIFromBIOS;
|
||||
|
||||
bool UseExtFirmware;
|
||||
char Firmware[256];
|
||||
bool BootFromFirmware;
|
||||
|
||||
bool DebugConsole;
|
||||
|
||||
int wifiBridgeAdapterNum;
|
||||
} CommonSettings;
|
||||
|
||||
extern char ROMserial[20];
|
||||
|
||||
//this should be moved to a driver.h later, but for now, here they are.
|
||||
//each platform needs to implement this, although it doesnt need to implement any functions
|
||||
class Driver {
|
||||
public:
|
||||
virtual BOOL WIFI_Host_InitSystem() { return FALSE; }
|
||||
virtual void WIFI_Host_ShutdownSystem() {}
|
||||
};
|
||||
extern Driver* driver;
|
||||
|
||||
extern std::string InputDisplayString;
|
||||
extern int LagFrameFlag;
|
||||
extern int lastLag, TotalLagFrames;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* 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
|
||||
*/
|
||||
|
||||
#ifndef NDSSYSTEM_H
|
||||
#define NDSSYSTEM_H
|
||||
|
||||
#include <string.h>
|
||||
#include "armcpu.h"
|
||||
#include "MMU.h"
|
||||
|
||||
#include "GPU.h"
|
||||
#include "SPU.h"
|
||||
|
||||
#include "mem.h"
|
||||
#include "wifi.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
extern volatile BOOL execute;
|
||||
extern BOOL click;
|
||||
extern char pathToROM[MAX_PATH];
|
||||
extern char pathFilenameToROMwithoutExt[MAX_PATH];
|
||||
|
||||
/*
|
||||
* The firmware language values
|
||||
*/
|
||||
#define NDS_FW_LANG_JAP 0
|
||||
#define NDS_FW_LANG_ENG 1
|
||||
#define NDS_FW_LANG_FRE 2
|
||||
#define NDS_FW_LANG_GER 3
|
||||
#define NDS_FW_LANG_ITA 4
|
||||
#define NDS_FW_LANG_SPA 5
|
||||
#define NDS_FW_LANG_CHI 6
|
||||
#define NDS_FW_LANG_RES 7
|
||||
|
||||
|
||||
//#define LOG_ARM9
|
||||
//#define LOG_ARM7
|
||||
|
||||
struct NDS_header
|
||||
{
|
||||
char gameTile[12];
|
||||
char gameCode[4];
|
||||
u16 makerCode;
|
||||
u8 unitCode;
|
||||
u8 deviceCode;
|
||||
u8 cardSize;
|
||||
u8 cardInfo[8];
|
||||
u8 flags;
|
||||
|
||||
u32 ARM9src;
|
||||
u32 ARM9exe;
|
||||
u32 ARM9cpy;
|
||||
u32 ARM9binSize;
|
||||
|
||||
u32 ARM7src;
|
||||
u32 ARM7exe;
|
||||
u32 ARM7cpy;
|
||||
u32 ARM7binSize;
|
||||
|
||||
u32 FNameTblOff;
|
||||
u32 FNameTblSize;
|
||||
|
||||
u32 FATOff;
|
||||
u32 FATSize;
|
||||
|
||||
u32 ARM9OverlayOff;
|
||||
u32 ARM9OverlaySize;
|
||||
u32 ARM7OverlayOff;
|
||||
u32 ARM7OverlaySize;
|
||||
|
||||
u32 unknown2a;
|
||||
u32 unknown2b;
|
||||
|
||||
u32 IconOff;
|
||||
u16 CRC16;
|
||||
u16 ROMtimeout;
|
||||
u32 ARM9unk;
|
||||
u32 ARM7unk;
|
||||
|
||||
u8 unknown3c[8];
|
||||
u32 ROMSize;
|
||||
u32 HeaderSize;
|
||||
u8 unknown5[56];
|
||||
u8 logo[156];
|
||||
u16 logoCRC16;
|
||||
u16 headerCRC16;
|
||||
u8 reserved[160];
|
||||
};
|
||||
|
||||
extern void debug();
|
||||
void emu_halt();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s32 ARM9Cycle;
|
||||
s32 ARM7Cycle;
|
||||
s32 cycles;
|
||||
s32 timerCycle[2][4];
|
||||
BOOL timerOver[2][4];
|
||||
s32 nextHBlank;
|
||||
u32 VCount;
|
||||
u32 old;
|
||||
s32 diff;
|
||||
BOOL lignerendu;
|
||||
|
||||
u16 touchX;
|
||||
u16 touchY;
|
||||
BOOL isTouch;
|
||||
u16 pad;
|
||||
|
||||
u8 *FW_ARM9BootCode;
|
||||
u8 *FW_ARM7BootCode;
|
||||
u32 FW_ARM9BootCodeAddr;
|
||||
u32 FW_ARM7BootCodeAddr;
|
||||
u32 FW_ARM9BootCodeSize;
|
||||
u32 FW_ARM7BootCodeSize;
|
||||
|
||||
BOOL sleeping;
|
||||
|
||||
//this is not essential NDS runtime state.
|
||||
//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 idleFrameCounter;
|
||||
|
||||
//if the game was booted on a debug console, this is set
|
||||
BOOL debugConsole;
|
||||
|
||||
bool isInVblank() const { return VCount >= 192; }
|
||||
bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
|
||||
} NDSSystem;
|
||||
|
||||
/** /brief A touchscreen calibration point.
|
||||
*/
|
||||
struct NDS_fw_touchscreen_cal {
|
||||
u16 adc_x;
|
||||
u16 adc_y;
|
||||
|
||||
u8 screen_x;
|
||||
u8 screen_y;
|
||||
};
|
||||
|
||||
/** /brief The type of DS
|
||||
*/
|
||||
enum nds_fw_ds_type {
|
||||
NDS_FW_DS_TYPE_FAT,
|
||||
NDS_FW_DS_TYPE_LITE,
|
||||
NDS_FW_DS_TYPE_iQue
|
||||
};
|
||||
|
||||
#define MAX_FW_NICKNAME_LENGTH 10
|
||||
#define MAX_FW_MESSAGE_LENGTH 26
|
||||
|
||||
struct NDS_fw_config_data {
|
||||
enum nds_fw_ds_type ds_type;
|
||||
|
||||
u8 fav_colour;
|
||||
u8 birth_month;
|
||||
u8 birth_day;
|
||||
|
||||
u16 nickname[MAX_FW_NICKNAME_LENGTH];
|
||||
u8 nickname_len;
|
||||
|
||||
u16 message[MAX_FW_MESSAGE_LENGTH];
|
||||
u8 message_len;
|
||||
|
||||
u8 language;
|
||||
|
||||
/* touchscreen calibration */
|
||||
struct NDS_fw_touchscreen_cal touch_cal[2];
|
||||
};
|
||||
|
||||
extern NDSSystem nds;
|
||||
|
||||
#ifdef GDB_STUB
|
||||
int NDS_Init( struct armcpu_memory_iface *arm9_mem_if,
|
||||
struct armcpu_ctrl_iface **arm9_ctrl_iface,
|
||||
struct armcpu_memory_iface *arm7_mem_if,
|
||||
struct armcpu_ctrl_iface **arm7_ctrl_iface);
|
||||
#else
|
||||
int NDS_Init ( void);
|
||||
#endif
|
||||
|
||||
void NDS_DeInit(void);
|
||||
void
|
||||
NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config);
|
||||
|
||||
BOOL NDS_SetROM(u8 * rom, u32 mask);
|
||||
NDS_header * NDS_getROMHeader(void);
|
||||
|
||||
void NDS_setTouchPos(u16 x, u16 y);
|
||||
void NDS_releaseTouch(void);
|
||||
void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,bool X,bool W,bool E,bool G, bool F);
|
||||
void NDS_setPadFromMovie(u16 pad);
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize);
|
||||
#else
|
||||
int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize,
|
||||
const char *cflash_disk_image_file);
|
||||
#endif
|
||||
void NDS_FreeROM(void);
|
||||
void NDS_Reset(void);
|
||||
int NDS_ImportSave(const char *filename);
|
||||
|
||||
int NDS_WriteBMP(const char *filename);
|
||||
int NDS_LoadFirmware(const char *filename);
|
||||
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
|
||||
|
||||
void NDS_Sleep();
|
||||
|
||||
void NDS_SkipFrame(bool skip);
|
||||
|
||||
template<bool FORCE>
|
||||
u32 NDS_exec(s32 nb);
|
||||
|
||||
extern int lagframecounter;
|
||||
|
||||
inline u32 NDS_exec(s32 nb) { return NDS_exec<false>(nb); }
|
||||
|
||||
static INLINE void NDS_ARM9HBlankInt(void)
|
||||
{
|
||||
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);
|
||||
NDS_ARM9.wIRQ = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void NDS_ARM7HBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
|
||||
{
|
||||
// MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
|
||||
setIF(1, 2);
|
||||
NDS_ARM7.wIRQ = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void NDS_ARM9VBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8)
|
||||
{
|
||||
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
|
||||
setIF(0, 1);
|
||||
NDS_ARM9.wIRQ = TRUE;
|
||||
//emu_halt();
|
||||
/*logcount++;*/
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void NDS_ARM7VBlankInt(void)
|
||||
{
|
||||
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
|
||||
// MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
|
||||
setIF(1, 1);
|
||||
NDS_ARM7.wIRQ = TRUE;
|
||||
//emu_halt();
|
||||
}
|
||||
|
||||
static INLINE void NDS_swapScreen(void)
|
||||
{
|
||||
u16 tmp = MainScreen.offset;
|
||||
MainScreen.offset = SubScreen.offset;
|
||||
SubScreen.offset = tmp;
|
||||
}
|
||||
|
||||
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
|
||||
|
||||
extern struct TCommonSettings {
|
||||
TCommonSettings()
|
||||
: HighResolutionInterpolateColor(true)
|
||||
, UseExtBIOS(false)
|
||||
, SWIFromBIOS(false)
|
||||
, UseExtFirmware(false)
|
||||
, BootFromFirmware(false)
|
||||
, DebugConsole(false)
|
||||
, wifiBridgeAdapterNum(0)
|
||||
{
|
||||
strcpy(ARM9BIOS, "biosnds9.bin");
|
||||
strcpy(ARM7BIOS, "biosnds7.bin");
|
||||
strcpy(Firmware, "firmware.bin");
|
||||
}
|
||||
bool HighResolutionInterpolateColor;
|
||||
|
||||
bool UseExtBIOS;
|
||||
char ARM9BIOS[256];
|
||||
char ARM7BIOS[256];
|
||||
bool SWIFromBIOS;
|
||||
|
||||
bool UseExtFirmware;
|
||||
char Firmware[256];
|
||||
bool BootFromFirmware;
|
||||
|
||||
bool DebugConsole;
|
||||
|
||||
int wifiBridgeAdapterNum;
|
||||
} CommonSettings;
|
||||
|
||||
extern char ROMserial[20];
|
||||
|
||||
//this should be moved to a driver.h later, but for now, here they are.
|
||||
//each platform needs to implement this, although it doesnt need to implement any functions
|
||||
class Driver {
|
||||
public:
|
||||
virtual BOOL WIFI_Host_InitSystem() { return FALSE; }
|
||||
virtual void WIFI_Host_ShutdownSystem() {}
|
||||
};
|
||||
extern Driver* driver;
|
||||
|
||||
extern std::string InputDisplayString;
|
||||
extern int LagFrameFlag;
|
||||
extern int lastLag, TotalLagFrames;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,11 +23,11 @@
|
|||
#define OGLRENDER_H
|
||||
|
||||
#include "common.h"
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "debug.h"
|
||||
#include "render3D.h"
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef __GNUC__
|
||||
#pragma pack(push, 1)
|
||||
#pragma warning(disable : 4103)
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#ifdef __GNUC__
|
||||
#define __PACKED __attribute__((__packed__))
|
||||
#else
|
||||
#define __PACKED
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __GNUC__
|
||||
#pragma pack(push, 1)
|
||||
#pragma warning(disable : 4103)
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#ifdef __GNUC__
|
||||
#define __PACKED __attribute__((__packed__))
|
||||
#else
|
||||
#define __PACKED
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
|
|
@ -1,230 +1,230 @@
|
|||
/* Copyright 2007 Guillaume Duhamel
|
||||
|
||||
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 "ROMReader.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_LIBZZIP
|
||||
#include <zzip/zzip.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define stat(...) _stat(__VA_ARGS__)
|
||||
#define S_IFMT _S_IFMT
|
||||
#define S_IFREG _S_IFREG
|
||||
#endif
|
||||
|
||||
ROMReader_struct * ROMReaderInit(char ** filename)
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
if(!strcasecmp(".gz", *filename + (strlen(*filename) - 3)))
|
||||
{
|
||||
(*filename)[strlen(*filename) - 3] = '\0';
|
||||
return &GZIPROMReader;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBZZIP
|
||||
if (!strcasecmp(".zip", *filename + (strlen(*filename) - 4)))
|
||||
{
|
||||
(*filename)[strlen(*filename) - 4] = '\0';
|
||||
return &ZIPROMReader;
|
||||
}
|
||||
#endif
|
||||
return &STDROMReader;
|
||||
}
|
||||
|
||||
void * STDROMReaderInit(const char * filename);
|
||||
void STDROMReaderDeInit(void *);
|
||||
u32 STDROMReaderSize(void *);
|
||||
int STDROMReaderSeek(void *, int, int);
|
||||
int STDROMReaderRead(void *, void *, u32);
|
||||
|
||||
ROMReader_struct STDROMReader =
|
||||
{
|
||||
ROMREADER_STD,
|
||||
"Standard ROM Reader",
|
||||
STDROMReaderInit,
|
||||
STDROMReaderDeInit,
|
||||
STDROMReaderSize,
|
||||
STDROMReaderSeek,
|
||||
STDROMReaderRead
|
||||
};
|
||||
|
||||
void * STDROMReaderInit(const char * filename)
|
||||
{
|
||||
#ifdef WIN32
|
||||
struct _stat sb;
|
||||
#else
|
||||
struct stat sb;
|
||||
#endif
|
||||
if (stat(filename, &sb) == -1)
|
||||
return 0;
|
||||
|
||||
if ((sb.st_mode & S_IFMT) != S_IFREG)
|
||||
return 0;
|
||||
|
||||
return (void *) fopen(filename, "rb");
|
||||
}
|
||||
|
||||
void STDROMReaderDeInit(void * file)
|
||||
{
|
||||
if (!file) return ;
|
||||
fclose((FILE*)file);
|
||||
}
|
||||
|
||||
u32 STDROMReaderSize(void * file)
|
||||
{
|
||||
u32 size;
|
||||
|
||||
if (!file) return 0 ;
|
||||
|
||||
fseek((FILE*)file, 0, SEEK_END);
|
||||
size = ftell((FILE*)file);
|
||||
fseek((FILE*)file, 0, SEEK_SET);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int STDROMReaderSeek(void * file, int offset, int whence)
|
||||
{
|
||||
if (!file) return 0 ;
|
||||
return fseek((FILE*)file, offset, whence);
|
||||
}
|
||||
|
||||
int STDROMReaderRead(void * file, void * buffer, u32 size)
|
||||
{
|
||||
if (!file) return 0 ;
|
||||
return fread(buffer, 1, size, (FILE*)file);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
void * GZIPROMReaderInit(const char * filename);
|
||||
void GZIPROMReaderDeInit(void *);
|
||||
u32 GZIPROMReaderSize(void *);
|
||||
int GZIPROMReaderSeek(void *, int, int);
|
||||
int GZIPROMReaderRead(void *, void *, u32);
|
||||
|
||||
ROMReader_struct GZIPROMReader =
|
||||
{
|
||||
ROMREADER_GZIP,
|
||||
"Gzip ROM Reader",
|
||||
GZIPROMReaderInit,
|
||||
GZIPROMReaderDeInit,
|
||||
GZIPROMReaderSize,
|
||||
GZIPROMReaderSeek,
|
||||
GZIPROMReaderRead
|
||||
};
|
||||
|
||||
void * GZIPROMReaderInit(const char * filename)
|
||||
{
|
||||
return (void*)gzopen(filename, "rb");
|
||||
}
|
||||
|
||||
void GZIPROMReaderDeInit(void * file)
|
||||
{
|
||||
gzclose(file);
|
||||
}
|
||||
|
||||
u32 GZIPROMReaderSize(void * file)
|
||||
{
|
||||
char useless[1024];
|
||||
u32 size = 0;
|
||||
|
||||
/* FIXME this function should first save the current
|
||||
* position and restore it after size calculation */
|
||||
gzrewind(file);
|
||||
while (gzeof (file) == 0)
|
||||
size += gzread(file, useless, 1024);
|
||||
gzrewind(file);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int GZIPROMReaderSeek(void * file, int offset, int whence)
|
||||
{
|
||||
return gzseek(file, offset, whence);
|
||||
}
|
||||
|
||||
int GZIPROMReaderRead(void * file, void * buffer, u32 size)
|
||||
{
|
||||
return gzread(file, buffer, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBZZIP
|
||||
void * ZIPROMReaderInit(const char * filename);
|
||||
void ZIPROMReaderDeInit(void *);
|
||||
u32 ZIPROMReaderSize(void *);
|
||||
int ZIPROMReaderSeek(void *, int, int);
|
||||
int ZIPROMReaderRead(void *, void *, u32);
|
||||
|
||||
ROMReader_struct ZIPROMReader =
|
||||
{
|
||||
ROMREADER_ZIP,
|
||||
"Zip ROM Reader",
|
||||
ZIPROMReaderInit,
|
||||
ZIPROMReaderDeInit,
|
||||
ZIPROMReaderSize,
|
||||
ZIPROMReaderSeek,
|
||||
ZIPROMReaderRead
|
||||
};
|
||||
|
||||
void * ZIPROMReaderInit(const char * filename)
|
||||
{
|
||||
ZZIP_DIR * dir = zzip_opendir(filename);
|
||||
ZZIP_DIRENT * dirent = zzip_readdir(dir);
|
||||
if (dir != NULL)
|
||||
{
|
||||
char tmp1[1024];
|
||||
char tmp2[1024];
|
||||
strncpy(tmp1, filename, strlen(filename) - 4);
|
||||
sprintf(tmp2, "%s/%s", tmp1, dirent->d_name);
|
||||
return zzip_fopen(tmp2, "rb");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ZIPROMReaderDeInit(void * file)
|
||||
{
|
||||
zzip_close((ZZIP_FILE*)file);
|
||||
}
|
||||
|
||||
u32 ZIPROMReaderSize(void * file)
|
||||
{
|
||||
u32 size;
|
||||
|
||||
zzip_seek((ZZIP_FILE*)file, 0, SEEK_END);
|
||||
size = zzip_tell((ZZIP_FILE*)file);
|
||||
zzip_seek((ZZIP_FILE*)file, 0, SEEK_SET);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int ZIPROMReaderSeek(void * file, int offset, int whence)
|
||||
{
|
||||
return zzip_seek((ZZIP_FILE*)file, offset, whence);
|
||||
}
|
||||
|
||||
int ZIPROMReaderRead(void * file, void * buffer, u32 size)
|
||||
{
|
||||
return zzip_read((ZZIP_FILE*)file, buffer, size);
|
||||
}
|
||||
#endif
|
||||
/* Copyright 2007 Guillaume Duhamel
|
||||
|
||||
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 "ROMReader.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_LIBZZIP
|
||||
#include <zzip/zzip.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define stat(...) _stat(__VA_ARGS__)
|
||||
#define S_IFMT _S_IFMT
|
||||
#define S_IFREG _S_IFREG
|
||||
#endif
|
||||
|
||||
ROMReader_struct * ROMReaderInit(char ** filename)
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
if(!strcasecmp(".gz", *filename + (strlen(*filename) - 3)))
|
||||
{
|
||||
(*filename)[strlen(*filename) - 3] = '\0';
|
||||
return &GZIPROMReader;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBZZIP
|
||||
if (!strcasecmp(".zip", *filename + (strlen(*filename) - 4)))
|
||||
{
|
||||
(*filename)[strlen(*filename) - 4] = '\0';
|
||||
return &ZIPROMReader;
|
||||
}
|
||||
#endif
|
||||
return &STDROMReader;
|
||||
}
|
||||
|
||||
void * STDROMReaderInit(const char * filename);
|
||||
void STDROMReaderDeInit(void *);
|
||||
u32 STDROMReaderSize(void *);
|
||||
int STDROMReaderSeek(void *, int, int);
|
||||
int STDROMReaderRead(void *, void *, u32);
|
||||
|
||||
ROMReader_struct STDROMReader =
|
||||
{
|
||||
ROMREADER_STD,
|
||||
"Standard ROM Reader",
|
||||
STDROMReaderInit,
|
||||
STDROMReaderDeInit,
|
||||
STDROMReaderSize,
|
||||
STDROMReaderSeek,
|
||||
STDROMReaderRead
|
||||
};
|
||||
|
||||
void * STDROMReaderInit(const char * filename)
|
||||
{
|
||||
#ifdef WIN32
|
||||
struct _stat sb;
|
||||
#else
|
||||
struct stat sb;
|
||||
#endif
|
||||
if (stat(filename, &sb) == -1)
|
||||
return 0;
|
||||
|
||||
if ((sb.st_mode & S_IFMT) != S_IFREG)
|
||||
return 0;
|
||||
|
||||
return (void *) fopen(filename, "rb");
|
||||
}
|
||||
|
||||
void STDROMReaderDeInit(void * file)
|
||||
{
|
||||
if (!file) return ;
|
||||
fclose((FILE*)file);
|
||||
}
|
||||
|
||||
u32 STDROMReaderSize(void * file)
|
||||
{
|
||||
u32 size;
|
||||
|
||||
if (!file) return 0 ;
|
||||
|
||||
fseek((FILE*)file, 0, SEEK_END);
|
||||
size = ftell((FILE*)file);
|
||||
fseek((FILE*)file, 0, SEEK_SET);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int STDROMReaderSeek(void * file, int offset, int whence)
|
||||
{
|
||||
if (!file) return 0 ;
|
||||
return fseek((FILE*)file, offset, whence);
|
||||
}
|
||||
|
||||
int STDROMReaderRead(void * file, void * buffer, u32 size)
|
||||
{
|
||||
if (!file) return 0 ;
|
||||
return fread(buffer, 1, size, (FILE*)file);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
void * GZIPROMReaderInit(const char * filename);
|
||||
void GZIPROMReaderDeInit(void *);
|
||||
u32 GZIPROMReaderSize(void *);
|
||||
int GZIPROMReaderSeek(void *, int, int);
|
||||
int GZIPROMReaderRead(void *, void *, u32);
|
||||
|
||||
ROMReader_struct GZIPROMReader =
|
||||
{
|
||||
ROMREADER_GZIP,
|
||||
"Gzip ROM Reader",
|
||||
GZIPROMReaderInit,
|
||||
GZIPROMReaderDeInit,
|
||||
GZIPROMReaderSize,
|
||||
GZIPROMReaderSeek,
|
||||
GZIPROMReaderRead
|
||||
};
|
||||
|
||||
void * GZIPROMReaderInit(const char * filename)
|
||||
{
|
||||
return (void*)gzopen(filename, "rb");
|
||||
}
|
||||
|
||||
void GZIPROMReaderDeInit(void * file)
|
||||
{
|
||||
gzclose(file);
|
||||
}
|
||||
|
||||
u32 GZIPROMReaderSize(void * file)
|
||||
{
|
||||
char useless[1024];
|
||||
u32 size = 0;
|
||||
|
||||
/* FIXME this function should first save the current
|
||||
* position and restore it after size calculation */
|
||||
gzrewind(file);
|
||||
while (gzeof (file) == 0)
|
||||
size += gzread(file, useless, 1024);
|
||||
gzrewind(file);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int GZIPROMReaderSeek(void * file, int offset, int whence)
|
||||
{
|
||||
return gzseek(file, offset, whence);
|
||||
}
|
||||
|
||||
int GZIPROMReaderRead(void * file, void * buffer, u32 size)
|
||||
{
|
||||
return gzread(file, buffer, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBZZIP
|
||||
void * ZIPROMReaderInit(const char * filename);
|
||||
void ZIPROMReaderDeInit(void *);
|
||||
u32 ZIPROMReaderSize(void *);
|
||||
int ZIPROMReaderSeek(void *, int, int);
|
||||
int ZIPROMReaderRead(void *, void *, u32);
|
||||
|
||||
ROMReader_struct ZIPROMReader =
|
||||
{
|
||||
ROMREADER_ZIP,
|
||||
"Zip ROM Reader",
|
||||
ZIPROMReaderInit,
|
||||
ZIPROMReaderDeInit,
|
||||
ZIPROMReaderSize,
|
||||
ZIPROMReaderSeek,
|
||||
ZIPROMReaderRead
|
||||
};
|
||||
|
||||
void * ZIPROMReaderInit(const char * filename)
|
||||
{
|
||||
ZZIP_DIR * dir = zzip_opendir(filename);
|
||||
ZZIP_DIRENT * dirent = zzip_readdir(dir);
|
||||
if (dir != NULL)
|
||||
{
|
||||
char tmp1[1024];
|
||||
char tmp2[1024];
|
||||
strncpy(tmp1, filename, strlen(filename) - 4);
|
||||
sprintf(tmp2, "%s/%s", tmp1, dirent->d_name);
|
||||
return zzip_fopen(tmp2, "rb");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ZIPROMReaderDeInit(void * file)
|
||||
{
|
||||
zzip_close((ZZIP_FILE*)file);
|
||||
}
|
||||
|
||||
u32 ZIPROMReaderSize(void * file)
|
||||
{
|
||||
u32 size;
|
||||
|
||||
zzip_seek((ZZIP_FILE*)file, 0, SEEK_END);
|
||||
size = zzip_tell((ZZIP_FILE*)file);
|
||||
zzip_seek((ZZIP_FILE*)file, 0, SEEK_SET);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int ZIPROMReaderSeek(void * file, int offset, int whence)
|
||||
{
|
||||
return zzip_seek((ZZIP_FILE*)file, offset, whence);
|
||||
}
|
||||
|
||||
int ZIPROMReaderRead(void * file, void * buffer, u32 size)
|
||||
{
|
||||
return zzip_read((ZZIP_FILE*)file, buffer, size);
|
||||
}
|
||||
#endif
|
||||
|
|
2696
desmume/src/SPU.cpp
2696
desmume/src/SPU.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,72 +1,72 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "addons.h"
|
||||
|
||||
char CFlashName[MAX_PATH];
|
||||
char CFlashPath[MAX_PATH];
|
||||
u8 CFlashUseRomPath = TRUE;
|
||||
u8 CFlashUsePath = TRUE;
|
||||
|
||||
char GBAgameName[MAX_PATH];
|
||||
|
||||
extern ADDONINTERFACE addonNone;
|
||||
extern ADDONINTERFACE addonCFlash;
|
||||
extern ADDONINTERFACE addonRumblePak;
|
||||
extern ADDONINTERFACE addonGBAgame;
|
||||
//extern ADDONINTERFACE addonExternalMic;
|
||||
|
||||
ADDONINTERFACE addonList[NDS_ADDON_COUNT] = {
|
||||
addonNone,
|
||||
addonCFlash,
|
||||
addonRumblePak,
|
||||
addonGBAgame};
|
||||
|
||||
ADDONINTERFACE addon = addonCFlash; // default none pak
|
||||
u8 addon_type = NDS_ADDON_CFLASH;
|
||||
|
||||
BOOL addonsInit()
|
||||
{
|
||||
return addon.init();
|
||||
}
|
||||
|
||||
void addonsClose()
|
||||
{
|
||||
addon.close();
|
||||
}
|
||||
|
||||
void addonsReset()
|
||||
{
|
||||
addon.reset();
|
||||
}
|
||||
|
||||
BOOL addonsChangePak(u8 type)
|
||||
{
|
||||
if (type > NDS_ADDON_COUNT) return FALSE;
|
||||
addon.close();
|
||||
addon = addonList[type];
|
||||
addon_type = type;
|
||||
return addon.init();
|
||||
}
|
||||
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "addons.h"
|
||||
|
||||
char CFlashName[MAX_PATH];
|
||||
char CFlashPath[MAX_PATH];
|
||||
u8 CFlashUseRomPath = TRUE;
|
||||
u8 CFlashUsePath = TRUE;
|
||||
|
||||
char GBAgameName[MAX_PATH];
|
||||
|
||||
extern ADDONINTERFACE addonNone;
|
||||
extern ADDONINTERFACE addonCFlash;
|
||||
extern ADDONINTERFACE addonRumblePak;
|
||||
extern ADDONINTERFACE addonGBAgame;
|
||||
//extern ADDONINTERFACE addonExternalMic;
|
||||
|
||||
ADDONINTERFACE addonList[NDS_ADDON_COUNT] = {
|
||||
addonNone,
|
||||
addonCFlash,
|
||||
addonRumblePak,
|
||||
addonGBAgame};
|
||||
|
||||
ADDONINTERFACE addon = addonCFlash; // default none pak
|
||||
u8 addon_type = NDS_ADDON_CFLASH;
|
||||
|
||||
BOOL addonsInit()
|
||||
{
|
||||
return addon.init();
|
||||
}
|
||||
|
||||
void addonsClose()
|
||||
{
|
||||
addon.close();
|
||||
}
|
||||
|
||||
void addonsReset()
|
||||
{
|
||||
addon.reset();
|
||||
}
|
||||
|
||||
BOOL addonsChangePak(u8 type)
|
||||
{
|
||||
if (type > NDS_ADDON_COUNT) return FALSE;
|
||||
addon.close();
|
||||
addon = addonList[type];
|
||||
addon_type = type;
|
||||
return addon.init();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __ADDONS_H__
|
||||
|
@ -58,31 +58,31 @@ typedef struct
|
|||
|
||||
//called when the user get info about addon pak (description)
|
||||
void (*info)(char *info);
|
||||
} ADDONINTERFACE;
|
||||
|
||||
enum {
|
||||
NDS_ADDON_NONE,
|
||||
NDS_ADDON_CFLASH, // compact flash
|
||||
NDS_ADDON_RUMBLEPAK, // rumble pack
|
||||
NDS_ADDON_GBAGAME, // gba game in slot
|
||||
//NDS_ADDON_EXTERNALMIC,
|
||||
NDS_ADDON_COUNT // use for counter addons - MUST TO BE LAST!!!
|
||||
};
|
||||
|
||||
extern ADDONINTERFACE addon; // current pak
|
||||
extern ADDONINTERFACE addonList[NDS_ADDON_COUNT]; // lists pointer on paks
|
||||
extern u8 addon_type; // current type pak
|
||||
|
||||
extern char CFlashName[MAX_PATH]; // path to compact flash img file
|
||||
extern char CFlashPath[MAX_PATH]; // path to compact flash directory
|
||||
extern u8 CFlashUsePath; // true is used path from CFlashPath for cflash folder
|
||||
extern u8 CFlashUseRomPath; // true is used path to rom file for cflash folder
|
||||
extern char GBAgameName[MAX_PATH]; // file name for GBA game (rom)
|
||||
extern void (*FeedbackON)(BOOL enable); // feedback on/off
|
||||
|
||||
extern BOOL addonsInit(); // Init addons
|
||||
extern void addonsClose(); // Shutdown addons
|
||||
extern void addonsReset(); // Reset addon
|
||||
extern BOOL addonsChangePak(u8 type); // change current adddon
|
||||
|
||||
} ADDONINTERFACE;
|
||||
|
||||
enum {
|
||||
NDS_ADDON_NONE,
|
||||
NDS_ADDON_CFLASH, // compact flash
|
||||
NDS_ADDON_RUMBLEPAK, // rumble pack
|
||||
NDS_ADDON_GBAGAME, // gba game in slot
|
||||
//NDS_ADDON_EXTERNALMIC,
|
||||
NDS_ADDON_COUNT // use for counter addons - MUST TO BE LAST!!!
|
||||
};
|
||||
|
||||
extern ADDONINTERFACE addon; // current pak
|
||||
extern ADDONINTERFACE addonList[NDS_ADDON_COUNT]; // lists pointer on paks
|
||||
extern u8 addon_type; // current type pak
|
||||
|
||||
extern char CFlashName[MAX_PATH]; // path to compact flash img file
|
||||
extern char CFlashPath[MAX_PATH]; // path to compact flash directory
|
||||
extern u8 CFlashUsePath; // true is used path from CFlashPath for cflash folder
|
||||
extern u8 CFlashUseRomPath; // true is used path to rom file for cflash folder
|
||||
extern char GBAgameName[MAX_PATH]; // file name for GBA game (rom)
|
||||
extern void (*FeedbackON)(BOOL enable); // feedback on/off
|
||||
|
||||
extern BOOL addonsInit(); // Init addons
|
||||
extern void addonsClose(); // Shutdown addons
|
||||
extern void addonsReset(); // Reset addon
|
||||
extern BOOL addonsChangePak(u8 type); // change current adddon
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006 Mic
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006 Mic
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include <string.h>
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
|
||||
#include "debug.h"
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
|
||||
#include "debug.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -942,10 +942,10 @@ static void cflash_close( void)
|
|||
}
|
||||
inited = FALSE;
|
||||
}
|
||||
|
||||
|
||||
static BOOL CFlash_init(void)
|
||||
{
|
||||
CFlashUseRomPath = TRUE;
|
||||
CFlashUseRomPath = TRUE;
|
||||
CFlashUsePath = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -995,11 +995,11 @@ static u32 CFlash_read32(u32 adr)
|
|||
return (cflash_read(adr));
|
||||
}
|
||||
|
||||
static void CFlash_info(char *info)
|
||||
{
|
||||
strcpy(info, "Compact Flash memory in slot");
|
||||
}
|
||||
#else
|
||||
static void CFlash_info(char *info)
|
||||
{
|
||||
strcpy(info, "Compact Flash memory in slot");
|
||||
}
|
||||
#else
|
||||
static BOOL CFlash_init(void) { return TRUE; }
|
||||
static void CFlash_reset(void) {}
|
||||
static void CFlash_close(void) {}
|
||||
|
@ -1011,14 +1011,14 @@ static u8 CFlash_read08(u32 adr){return (0);}
|
|||
static u16 CFlash_read16(u32 adr){return (0);}
|
||||
static u32 CFlash_read32(u32 adr){return (0);}
|
||||
|
||||
static void CFlash_info(char *info)
|
||||
{
|
||||
strcpy(info, "Compact Flash memory in slot");
|
||||
}
|
||||
#endif
|
||||
|
||||
ADDONINTERFACE addonCFlash = {
|
||||
"Compact Flash",
|
||||
static void CFlash_info(char *info)
|
||||
{
|
||||
strcpy(info, "Compact Flash memory in slot");
|
||||
}
|
||||
#endif
|
||||
|
||||
ADDONINTERFACE addonCFlash = {
|
||||
"Compact Flash",
|
||||
CFlash_init,
|
||||
CFlash_reset,
|
||||
CFlash_close,
|
||||
|
@ -1029,6 +1029,6 @@ ADDONINTERFACE addonCFlash = {
|
|||
CFlash_read08,
|
||||
CFlash_read16,
|
||||
CFlash_read32,
|
||||
CFlash_info};
|
||||
|
||||
CFlash_info};
|
||||
|
||||
#undef CFLASHDEBUG
|
||||
|
|
|
@ -1,116 +1,116 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include "../mem.h"
|
||||
#include <string.h>
|
||||
#include "../MMU.h"
|
||||
|
||||
static u8 *GBArom = NULL;
|
||||
|
||||
static BOOL GBAgame_init(void)
|
||||
{
|
||||
GBArom = new u8 [32 * 1024 * 1024];
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static void GBAgame_reset(void)
|
||||
{
|
||||
memset(GBArom, 0, 32 * 1024 * 1024);
|
||||
|
||||
if (!strlen(GBAgameName)) return;
|
||||
FILE *fgame = 0;
|
||||
|
||||
fgame = fopen(GBAgameName,"rb");
|
||||
if (!fgame) return;
|
||||
INFO("Loaded \"%s\" in GBA slot\n", GBAgameName);
|
||||
fseek(fgame, 0, SEEK_END);
|
||||
u32 size = ftell(fgame);
|
||||
rewind(fgame);
|
||||
|
||||
if (!fread(GBArom, 1, size, fgame))
|
||||
{
|
||||
fclose(fgame);
|
||||
return;
|
||||
}
|
||||
|
||||
fclose(fgame);
|
||||
}
|
||||
|
||||
static void GBAgame_close(void)
|
||||
{
|
||||
if (GBArom)
|
||||
{
|
||||
delete [] GBArom;
|
||||
GBArom = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void GBAgame_config(void) {}
|
||||
static void GBAgame_write08(u32 adr, u8 val){}
|
||||
static void GBAgame_write16(u32 adr, u16 val) {}
|
||||
static void GBAgame_write32(u32 adr, u32 val) {}
|
||||
|
||||
static u8 GBAgame_read08(u32 adr)
|
||||
{
|
||||
//INFO("Read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000)));
|
||||
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
|
||||
return MMU.MMU_MEM[0][0xFF][(adr +0x1C) & MMU.MMU_MASK[0][0xFF]];
|
||||
return (u8)T1ReadByte(GBArom, (adr - 0x08000000));
|
||||
}
|
||||
|
||||
static u16 GBAgame_read16(u32 adr)
|
||||
{
|
||||
//INFO("Read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000)));
|
||||
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
|
||||
return T1ReadWord(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
|
||||
return (u16)T1ReadWord(GBArom, (adr - 0x08000000));
|
||||
}
|
||||
|
||||
static u32 GBAgame_read32(u32 adr)
|
||||
{
|
||||
//INFO("Read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000)));
|
||||
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
|
||||
return T1ReadLong(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
|
||||
return (u32)T1ReadLong(GBArom, (adr - 0x08000000));
|
||||
}
|
||||
|
||||
static void GBAgame_info(char *info)
|
||||
{
|
||||
strcpy(info, "GBA game in slot");
|
||||
}
|
||||
|
||||
ADDONINTERFACE addonGBAgame = {
|
||||
"GBA game",
|
||||
GBAgame_init,
|
||||
GBAgame_reset,
|
||||
GBAgame_close,
|
||||
GBAgame_config,
|
||||
GBAgame_write08,
|
||||
GBAgame_write16,
|
||||
GBAgame_write32,
|
||||
GBAgame_read08,
|
||||
GBAgame_read16,
|
||||
GBAgame_read32,
|
||||
GBAgame_info};
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include "../mem.h"
|
||||
#include <string.h>
|
||||
#include "../MMU.h"
|
||||
|
||||
static u8 *GBArom = NULL;
|
||||
|
||||
static BOOL GBAgame_init(void)
|
||||
{
|
||||
GBArom = new u8 [32 * 1024 * 1024];
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static void GBAgame_reset(void)
|
||||
{
|
||||
memset(GBArom, 0, 32 * 1024 * 1024);
|
||||
|
||||
if (!strlen(GBAgameName)) return;
|
||||
FILE *fgame = 0;
|
||||
|
||||
fgame = fopen(GBAgameName,"rb");
|
||||
if (!fgame) return;
|
||||
INFO("Loaded \"%s\" in GBA slot\n", GBAgameName);
|
||||
fseek(fgame, 0, SEEK_END);
|
||||
u32 size = ftell(fgame);
|
||||
rewind(fgame);
|
||||
|
||||
if (!fread(GBArom, 1, size, fgame))
|
||||
{
|
||||
fclose(fgame);
|
||||
return;
|
||||
}
|
||||
|
||||
fclose(fgame);
|
||||
}
|
||||
|
||||
static void GBAgame_close(void)
|
||||
{
|
||||
if (GBArom)
|
||||
{
|
||||
delete [] GBArom;
|
||||
GBArom = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void GBAgame_config(void) {}
|
||||
static void GBAgame_write08(u32 adr, u8 val){}
|
||||
static void GBAgame_write16(u32 adr, u16 val) {}
|
||||
static void GBAgame_write32(u32 adr, u32 val) {}
|
||||
|
||||
static u8 GBAgame_read08(u32 adr)
|
||||
{
|
||||
//INFO("Read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000)));
|
||||
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
|
||||
return MMU.MMU_MEM[0][0xFF][(adr +0x1C) & MMU.MMU_MASK[0][0xFF]];
|
||||
return (u8)T1ReadByte(GBArom, (adr - 0x08000000));
|
||||
}
|
||||
|
||||
static u16 GBAgame_read16(u32 adr)
|
||||
{
|
||||
//INFO("Read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000)));
|
||||
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
|
||||
return T1ReadWord(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
|
||||
return (u16)T1ReadWord(GBArom, (adr - 0x08000000));
|
||||
}
|
||||
|
||||
static u32 GBAgame_read32(u32 adr)
|
||||
{
|
||||
//INFO("Read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000)));
|
||||
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
|
||||
return T1ReadLong(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
|
||||
return (u32)T1ReadLong(GBArom, (adr - 0x08000000));
|
||||
}
|
||||
|
||||
static void GBAgame_info(char *info)
|
||||
{
|
||||
strcpy(info, "GBA game in slot");
|
||||
}
|
||||
|
||||
ADDONINTERFACE addonGBAgame = {
|
||||
"GBA game",
|
||||
GBAgame_init,
|
||||
GBAgame_reset,
|
||||
GBAgame_close,
|
||||
GBAgame_config,
|
||||
GBAgame_write08,
|
||||
GBAgame_write16,
|
||||
GBAgame_write32,
|
||||
GBAgame_read08,
|
||||
GBAgame_read16,
|
||||
GBAgame_read32,
|
||||
GBAgame_info};
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include <string.h>
|
||||
|
||||
static BOOL None_init(void) { return (TRUE); }
|
||||
|
@ -35,10 +35,10 @@ static void None_write32(u32 adr, u32 val) {}
|
|||
static u8 None_read08(u32 adr){ return (0); }
|
||||
static u16 None_read16(u32 adr){ return (0); }
|
||||
static u32 None_read32(u32 adr){ return (0); }
|
||||
static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); }
|
||||
|
||||
ADDONINTERFACE addonNone = {
|
||||
"NONE",
|
||||
static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); }
|
||||
|
||||
ADDONINTERFACE addonNone = {
|
||||
"NONE",
|
||||
None_init,
|
||||
None_reset,
|
||||
None_close,
|
||||
|
@ -49,4 +49,4 @@ ADDONINTERFACE addonNone = {
|
|||
None_read08,
|
||||
None_read16,
|
||||
None_read32,
|
||||
None_info};
|
||||
None_info};
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include "../mem.h"
|
||||
#include "../MMU.h"
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2009 CrazyMax
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../addons.h"
|
||||
#include "../mem.h"
|
||||
#include "../MMU.h"
|
||||
#include <string.h>
|
||||
|
||||
void (*FeedbackON)(BOOL enable) = NULL;
|
||||
|
||||
|
||||
static BOOL RumblePak_init(void) { return (TRUE); }
|
||||
|
||||
static void RumblePak_reset(void)
|
||||
|
@ -76,14 +76,14 @@ static u32 RumblePak_read32(u32 adr)
|
|||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void RumblePak_info(char *info)
|
||||
{
|
||||
strcpy(info, "NDS Rumble Pak (need joystick with Feedback)");
|
||||
}
|
||||
|
||||
ADDONINTERFACE addonRumblePak = {
|
||||
"Rumble Pak",
|
||||
|
||||
static void RumblePak_info(char *info)
|
||||
{
|
||||
strcpy(info, "NDS Rumble Pak (need joystick with Feedback)");
|
||||
}
|
||||
|
||||
ADDONINTERFACE addonRumblePak = {
|
||||
"Rumble Pak",
|
||||
RumblePak_init,
|
||||
RumblePak_reset,
|
||||
RumblePak_close,
|
||||
|
@ -94,4 +94,4 @@ ADDONINTERFACE addonRumblePak = {
|
|||
RumblePak_read08,
|
||||
RumblePak_read16,
|
||||
RumblePak_read32,
|
||||
RumblePak_info};
|
||||
RumblePak_info};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,24 +1,24 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 The 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
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 The 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
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,68 +1,68 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
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 "common.h"
|
||||
|
||||
#define CHEAT_VERSION_MAJOR 1
|
||||
#define CHEAT_VERSION_MINOR 3
|
||||
#define MAX_CHEAT_LIST 100
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 type; // 0 - internal cheat system
|
||||
// 1 - Action Replay
|
||||
// 2 - Codebreakers
|
||||
BOOL enabled;
|
||||
u32 hi[255];
|
||||
u32 lo[255];
|
||||
char description[75];
|
||||
u8 num;
|
||||
u8 size;
|
||||
|
||||
} CHEATS_LIST;
|
||||
|
||||
extern void cheatsInit(char *path);
|
||||
extern BOOL cheatsAdd(u8 size, u32 address, u32 val, char *description, BOOL enabled);
|
||||
extern BOOL cheatsUpdate(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
|
||||
extern BOOL cheatsAdd_AR(char *code, char *description, BOOL enabled);
|
||||
extern BOOL cheatsAdd_CB(char *code, char *description, BOOL enabled);
|
||||
extern BOOL cheatsRemove(u32 pos);
|
||||
extern void cheatsGetListReset();
|
||||
extern BOOL cheatsGetList(CHEATS_LIST *cheat);
|
||||
extern BOOL cheatsGet(CHEATS_LIST *cheat, u32 pos);
|
||||
extern u32 cheatsGetSize();
|
||||
extern BOOL cheatsSave();
|
||||
extern BOOL cheatsLoad();
|
||||
extern BOOL cheatsPush();
|
||||
extern BOOL cheatsPop();
|
||||
extern void cheatsStackClear();
|
||||
extern void cheatsProcess();
|
||||
|
||||
// ==================================================== cheat search
|
||||
extern void cheatsSearchInit(u8 type, u8 size, u8 sign);
|
||||
extern void cheatsSearchClose();
|
||||
extern u32 cheatsSearchValue(u32 val);
|
||||
extern u32 cheatsSearchComp(u8 comp);
|
||||
extern u32 cheatSearchNumber();
|
||||
extern BOOL cheatSearchGetList(u32 *address, u32 *curVal);
|
||||
extern void cheatSearchGetListReset();
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
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 "common.h"
|
||||
|
||||
#define CHEAT_VERSION_MAJOR 1
|
||||
#define CHEAT_VERSION_MINOR 3
|
||||
#define MAX_CHEAT_LIST 100
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 type; // 0 - internal cheat system
|
||||
// 1 - Action Replay
|
||||
// 2 - Codebreakers
|
||||
BOOL enabled;
|
||||
u32 hi[255];
|
||||
u32 lo[255];
|
||||
char description[75];
|
||||
u8 num;
|
||||
u8 size;
|
||||
|
||||
} CHEATS_LIST;
|
||||
|
||||
extern void cheatsInit(char *path);
|
||||
extern BOOL cheatsAdd(u8 size, u32 address, u32 val, char *description, BOOL enabled);
|
||||
extern BOOL cheatsUpdate(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
|
||||
extern BOOL cheatsAdd_AR(char *code, char *description, BOOL enabled);
|
||||
extern BOOL cheatsAdd_CB(char *code, char *description, BOOL enabled);
|
||||
extern BOOL cheatsRemove(u32 pos);
|
||||
extern void cheatsGetListReset();
|
||||
extern BOOL cheatsGetList(CHEATS_LIST *cheat);
|
||||
extern BOOL cheatsGet(CHEATS_LIST *cheat, u32 pos);
|
||||
extern u32 cheatsGetSize();
|
||||
extern BOOL cheatsSave();
|
||||
extern BOOL cheatsLoad();
|
||||
extern BOOL cheatsPush();
|
||||
extern BOOL cheatsPop();
|
||||
extern void cheatsStackClear();
|
||||
extern void cheatsProcess();
|
||||
|
||||
// ==================================================== cheat search
|
||||
extern void cheatsSearchInit(u8 type, u8 size, u8 sign);
|
||||
extern void cheatsSearchClose();
|
||||
extern u32 cheatsSearchValue(u32 val);
|
||||
extern u32 cheatsSearchComp(u8 comp);
|
||||
extern u32 cheatSearchNumber();
|
||||
extern BOOL cheatSearchGetList(u32 *address, u32 *curVal);
|
||||
extern void cheatSearchGetListReset();
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
u8 gba_header_data_0x04[156] = {
|
||||
0x24,0xFF,0xAE,0x51,0x69,0x9A,0xA2,0x21,0x3D,0x84,0x82,0x0A,0x84,0xE4,0x09,0xAD,
|
||||
0x11,0x24,0x8B,0x98,0xC0,0x81,0x7F,0x21,0xA3,0x52,0xBE,0x19,0x93,0x09,0xCE,0x20,
|
||||
0x10,0x46,0x4A,0x4A,0xF8,0x27,0x31,0xEC,0x58,0xC7,0xE8,0x33,0x82,0xE3,0xCE,0xBF,
|
||||
0x85,0xF4,0xDF,0x94,0xCE,0x4B,0x09,0xC1,0x94,0x56,0x8A,0xC0,0x13,0x72,0xA7,0xFC,
|
||||
0x9F,0x84,0x4D,0x73,0xA3,0xCA,0x9A,0x61,0x58,0x97,0xA3,0x27,0xFC,0x03,0x98,0x76,
|
||||
0x23,0x1D,0xC7,0x61,0x03,0x04,0xAE,0x56,0xBF,0x38,0x84,0x00,0x40,0xA7,0x0E,0xFD,
|
||||
0xFF,0x52,0xFE,0x03,0x6F,0x95,0x30,0xF1,0x97,0xFB,0xC0,0x85,0x60,0xD6,0x80,0x25,
|
||||
0xA9,0x63,0xBE,0x03,0x01,0x4E,0x38,0xE2,0xF9,0xA2,0x34,0xFF,0xBB,0x3E,0x03,0x44,
|
||||
0x78,0x00,0x90,0xCB,0x88,0x11,0x3A,0x94,0x65,0xC0,0x7C,0x63,0x87,0xF0,0x3C,0xAF,
|
||||
0xD6,0x25,0xE4,0x8B,0x38,0x0A,0xAC,0x72,0x21,0xD4,0xF8,0x07};
|
||||
|
||||
#ifdef WIN32
|
||||
char IniName[MAX_PATH];
|
||||
|
||||
#include "common.h"
|
||||
|
||||
u8 gba_header_data_0x04[156] = {
|
||||
0x24,0xFF,0xAE,0x51,0x69,0x9A,0xA2,0x21,0x3D,0x84,0x82,0x0A,0x84,0xE4,0x09,0xAD,
|
||||
0x11,0x24,0x8B,0x98,0xC0,0x81,0x7F,0x21,0xA3,0x52,0xBE,0x19,0x93,0x09,0xCE,0x20,
|
||||
0x10,0x46,0x4A,0x4A,0xF8,0x27,0x31,0xEC,0x58,0xC7,0xE8,0x33,0x82,0xE3,0xCE,0xBF,
|
||||
0x85,0xF4,0xDF,0x94,0xCE,0x4B,0x09,0xC1,0x94,0x56,0x8A,0xC0,0x13,0x72,0xA7,0xFC,
|
||||
0x9F,0x84,0x4D,0x73,0xA3,0xCA,0x9A,0x61,0x58,0x97,0xA3,0x27,0xFC,0x03,0x98,0x76,
|
||||
0x23,0x1D,0xC7,0x61,0x03,0x04,0xAE,0x56,0xBF,0x38,0x84,0x00,0x40,0xA7,0x0E,0xFD,
|
||||
0xFF,0x52,0xFE,0x03,0x6F,0x95,0x30,0xF1,0x97,0xFB,0xC0,0x85,0x60,0xD6,0x80,0x25,
|
||||
0xA9,0x63,0xBE,0x03,0x01,0x4E,0x38,0xE2,0xF9,0xA2,0x34,0xFF,0xBB,0x3E,0x03,0x44,
|
||||
0x78,0x00,0x90,0xCB,0x88,0x11,0x3A,0x94,0x65,0xC0,0x7C,0x63,0x87,0xF0,0x3C,0xAF,
|
||||
0xD6,0x25,0xE4,0x8B,0x38,0x0A,0xAC,0x72,0x21,0xD4,0xF8,0x07};
|
||||
|
||||
#ifdef WIN32
|
||||
char IniName[MAX_PATH];
|
||||
|
||||
void GetINIPath()
|
||||
{
|
||||
char vPath[MAX_PATH], *szPath, currDir[MAX_PATH];
|
||||
|
@ -63,47 +63,47 @@ void GetINIPath()
|
|||
{
|
||||
memset(IniName,0,MAX_PATH) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file)
|
||||
{
|
||||
char temp[256] = "";
|
||||
sprintf(temp, "%d", val);
|
||||
WritePrivateProfileString(appname, keyname, temp, file);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
u8 reverseBitsInByte(u8 x)
|
||||
{
|
||||
u8 h = 0;
|
||||
u8 i = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
h = (h << 1) + (x & 1);
|
||||
x >>= 1;
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
void removeCR(char *buf)
|
||||
{
|
||||
int l=strlen(buf);
|
||||
for (int i=0; i < l; i++)
|
||||
{
|
||||
if (buf[i]==0x0A) buf[i]=0;
|
||||
if (buf[i]==0x0D) buf[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 strlen_ws(char *buf) // length without last spaces
|
||||
{
|
||||
if (!strlen(buf)) return 0;
|
||||
for (int i=strlen(buf); i>0; i--)
|
||||
{
|
||||
if (buf[i]!=32) return (i-1); // space
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
u8 reverseBitsInByte(u8 x)
|
||||
{
|
||||
u8 h = 0;
|
||||
u8 i = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
h = (h << 1) + (x & 1);
|
||||
x >>= 1;
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
void removeCR(char *buf)
|
||||
{
|
||||
int l=strlen(buf);
|
||||
for (int i=0; i < l; i++)
|
||||
{
|
||||
if (buf[i]==0x0A) buf[i]=0;
|
||||
if (buf[i]==0x0D) buf[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 strlen_ws(char *buf) // length without last spaces
|
||||
{
|
||||
if (!strlen(buf)) return 0;
|
||||
for (int i=strlen(buf); i>0; i--)
|
||||
{
|
||||
if (buf[i]!=32) return (i-1); // space
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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 _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
|
||||
extern u8 gba_header_data_0x04[156];
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define IDT_VIEW_DISASM7 50001
|
||||
#define IDT_VIEW_DISASM9 50002
|
||||
#define IDT_VIEW_MEM7 50003
|
||||
#define IDT_VIEW_MEM9 50004
|
||||
#define IDT_VIEW_IOREG 50005
|
||||
#define IDT_VIEW_PAL 50006
|
||||
#define IDT_VIEW_TILE 50007
|
||||
#define IDT_VIEW_MAP 50008
|
||||
#define IDT_VIEW_OAM 50009
|
||||
#define IDT_VIEW_MATRIX 50010
|
||||
#define IDT_VIEW_LIGHTS 50011
|
||||
#define IDM_EXEC 50112
|
||||
|
||||
#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);
|
||||
|
||||
#define EXPERIMENTAL_GBASLOT 1
|
||||
#else // non Windows
|
||||
|
||||
#define sscanf_s sscanf
|
||||
|
||||
#endif
|
||||
|
||||
extern u8 reverseBitsInByte(u8 x);
|
||||
extern void removeCR(char *buf);
|
||||
extern u32 strlen_ws(char *buf);
|
||||
|
||||
#endif
|
||||
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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 _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
|
||||
extern u8 gba_header_data_0x04[156];
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define IDT_VIEW_DISASM7 50001
|
||||
#define IDT_VIEW_DISASM9 50002
|
||||
#define IDT_VIEW_MEM7 50003
|
||||
#define IDT_VIEW_MEM9 50004
|
||||
#define IDT_VIEW_IOREG 50005
|
||||
#define IDT_VIEW_PAL 50006
|
||||
#define IDT_VIEW_TILE 50007
|
||||
#define IDT_VIEW_MAP 50008
|
||||
#define IDT_VIEW_OAM 50009
|
||||
#define IDT_VIEW_MATRIX 50010
|
||||
#define IDT_VIEW_LIGHTS 50011
|
||||
#define IDM_EXEC 50112
|
||||
|
||||
#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);
|
||||
|
||||
#define EXPERIMENTAL_GBASLOT 1
|
||||
#else // non Windows
|
||||
|
||||
#define sscanf_s sscanf
|
||||
|
||||
#endif
|
||||
|
||||
extern u8 reverseBitsInByte(u8 x);
|
||||
extern void removeCR(char *buf);
|
||||
extern u32 strlen_ws(char *buf);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,96 +1,96 @@
|
|||
/* Copyright (C) 2008 Guillaume Duhamel
|
||||
|
||||
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 "debug.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
std::vector<Logger *> Logger::channels;
|
||||
|
||||
static void defaultCallback(const Logger& logger, const char * message) {
|
||||
logger.getOutput() << message;
|
||||
}
|
||||
|
||||
Logger::Logger() {
|
||||
out = &std::cout;
|
||||
callback = defaultCallback;
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
void Logger::vprintf(const char * format, va_list l, const char * file, unsigned int line) {
|
||||
char buffer[1024];
|
||||
char * cur = buffer;
|
||||
|
||||
if (flags & Logger::FILE) cur += sprintf(cur, "%s:", file);
|
||||
if (flags & Logger::LINE) cur += sprintf(cur, "%d:", line);
|
||||
if (flags) cur += sprintf(cur, " ");
|
||||
|
||||
::vsnprintf(cur, 1024, format, l);
|
||||
callback(*this, buffer);
|
||||
}
|
||||
|
||||
void Logger::setOutput(std::ostream * o) {
|
||||
out = o;
|
||||
}
|
||||
|
||||
void Logger::setCallback(void (*cback)(const Logger& logger, const char * message)) {
|
||||
callback = cback;
|
||||
}
|
||||
|
||||
void Logger::setFlag(unsigned int flag) {
|
||||
this->flags = flag;
|
||||
}
|
||||
|
||||
void Logger::fixSize(unsigned int channel) {
|
||||
while(channel >= channels.size()) {
|
||||
channels.push_back(new Logger());
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& Logger::getOutput() const {
|
||||
return *out;
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, const char * format, ...) {
|
||||
fixSize(channel);
|
||||
|
||||
va_list l;
|
||||
va_start(l, format);
|
||||
channels[channel]->vprintf(format, l, file, line);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, std::ostream& os) {
|
||||
fixSize(channel);
|
||||
|
||||
channels[channel]->setOutput(&os);
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, unsigned int flag) {
|
||||
fixSize(channel);
|
||||
|
||||
channels[channel]->setFlag(flag);
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message)) {
|
||||
fixSize(channel);
|
||||
|
||||
channels[channel]->setCallback(callback);
|
||||
}
|
||||
/* Copyright (C) 2008 Guillaume Duhamel
|
||||
|
||||
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 "debug.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
std::vector<Logger *> Logger::channels;
|
||||
|
||||
static void defaultCallback(const Logger& logger, const char * message) {
|
||||
logger.getOutput() << message;
|
||||
}
|
||||
|
||||
Logger::Logger() {
|
||||
out = &std::cout;
|
||||
callback = defaultCallback;
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
void Logger::vprintf(const char * format, va_list l, const char * file, unsigned int line) {
|
||||
char buffer[1024];
|
||||
char * cur = buffer;
|
||||
|
||||
if (flags & Logger::FILE) cur += sprintf(cur, "%s:", file);
|
||||
if (flags & Logger::LINE) cur += sprintf(cur, "%d:", line);
|
||||
if (flags) cur += sprintf(cur, " ");
|
||||
|
||||
::vsnprintf(cur, 1024, format, l);
|
||||
callback(*this, buffer);
|
||||
}
|
||||
|
||||
void Logger::setOutput(std::ostream * o) {
|
||||
out = o;
|
||||
}
|
||||
|
||||
void Logger::setCallback(void (*cback)(const Logger& logger, const char * message)) {
|
||||
callback = cback;
|
||||
}
|
||||
|
||||
void Logger::setFlag(unsigned int flag) {
|
||||
this->flags = flag;
|
||||
}
|
||||
|
||||
void Logger::fixSize(unsigned int channel) {
|
||||
while(channel >= channels.size()) {
|
||||
channels.push_back(new Logger());
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& Logger::getOutput() const {
|
||||
return *out;
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, const char * format, ...) {
|
||||
fixSize(channel);
|
||||
|
||||
va_list l;
|
||||
va_start(l, format);
|
||||
channels[channel]->vprintf(format, l, file, line);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, std::ostream& os) {
|
||||
fixSize(channel);
|
||||
|
||||
channels[channel]->setOutput(&os);
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, unsigned int flag) {
|
||||
fixSize(channel);
|
||||
|
||||
channels[channel]->setFlag(flag);
|
||||
}
|
||||
|
||||
void Logger::log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message)) {
|
||||
fixSize(channel);
|
||||
|
||||
channels[channel]->setCallback(callback);
|
||||
}
|
||||
|
|
|
@ -1,114 +1,114 @@
|
|||
/* Copyright (C) 2008 Guillaume Duhamel
|
||||
|
||||
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 LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstdarg>
|
||||
|
||||
class Logger {
|
||||
protected:
|
||||
void (*callback)(const Logger& logger, const char * format);
|
||||
std::ostream * out;
|
||||
unsigned int flags;
|
||||
|
||||
static std::vector<Logger *> channels;
|
||||
|
||||
static void fixSize(unsigned int channel);
|
||||
public:
|
||||
Logger();
|
||||
|
||||
void vprintf(const char * format, va_list l, const char * filename, unsigned int line);
|
||||
void setOutput(std::ostream * o);
|
||||
void setCallback(void (*cback)(const Logger& logger, const char * message));
|
||||
void setFlag(unsigned int flag);
|
||||
|
||||
std::ostream& getOutput() const;
|
||||
|
||||
static const int LINE = 1;
|
||||
static const int FILE = 2;
|
||||
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, const char * format, ...);
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, std::ostream& os);
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, unsigned int flag);
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message));
|
||||
};
|
||||
|
||||
#if defined(DEBUG) || defined(GPUDEBUG) || defined(DIVDEBUG) || defined(SQRTDEBUG) || defined(DMADEBUG) || defined(DEVELOPER)
|
||||
#define LOGC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define LOGC(...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LOG(...) LOGC(0, __VA_ARGS__)
|
||||
#else
|
||||
#define LOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef GPUDEBUG
|
||||
#define GPULOG(...) LOGC(1, __VA_ARGS__)
|
||||
#else
|
||||
#define GPULOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DIVDEBUG
|
||||
#define DIVLOG(...) LOGC(2, __VA_ARGS__)
|
||||
#else
|
||||
#define DIVLOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef SQRTDEBUG
|
||||
#define SQRTLOG(...) LOGC(3, __VA_ARGS__)
|
||||
#else
|
||||
#define SQRTLOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DMADEBUG
|
||||
#define DMALOG(...) LOGC(4, __VA_ARGS__)
|
||||
#else
|
||||
#define DMALOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef CFLASHDEBUG
|
||||
#define CFLASHLOG(...) LOGC(5, __VA_ARGS__)
|
||||
#else
|
||||
#define CFLASHLOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef UNTESTEDOPCODELOG
|
||||
#define UNTESTEDOPCODELOG(...) LOGC(6, __VA_ARGS__)
|
||||
#else
|
||||
#define UNTESTEDOPCODELOG(...)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEVELOPER
|
||||
#define PROGINFO(...) LOGC(7, __VA_ARGS__)
|
||||
#else
|
||||
#define PROGINFO(...)
|
||||
#endif
|
||||
|
||||
|
||||
#define INFOC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define INFO(...) INFOC(10, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
/* Copyright (C) 2008 Guillaume Duhamel
|
||||
|
||||
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 LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstdarg>
|
||||
|
||||
class Logger {
|
||||
protected:
|
||||
void (*callback)(const Logger& logger, const char * format);
|
||||
std::ostream * out;
|
||||
unsigned int flags;
|
||||
|
||||
static std::vector<Logger *> channels;
|
||||
|
||||
static void fixSize(unsigned int channel);
|
||||
public:
|
||||
Logger();
|
||||
|
||||
void vprintf(const char * format, va_list l, const char * filename, unsigned int line);
|
||||
void setOutput(std::ostream * o);
|
||||
void setCallback(void (*cback)(const Logger& logger, const char * message));
|
||||
void setFlag(unsigned int flag);
|
||||
|
||||
std::ostream& getOutput() const;
|
||||
|
||||
static const int LINE = 1;
|
||||
static const int FILE = 2;
|
||||
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, const char * format, ...);
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, std::ostream& os);
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, unsigned int flag);
|
||||
static void log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message));
|
||||
};
|
||||
|
||||
#if defined(DEBUG) || defined(GPUDEBUG) || defined(DIVDEBUG) || defined(SQRTDEBUG) || defined(DMADEBUG) || defined(DEVELOPER)
|
||||
#define LOGC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define LOGC(...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LOG(...) LOGC(0, __VA_ARGS__)
|
||||
#else
|
||||
#define LOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef GPUDEBUG
|
||||
#define GPULOG(...) LOGC(1, __VA_ARGS__)
|
||||
#else
|
||||
#define GPULOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DIVDEBUG
|
||||
#define DIVLOG(...) LOGC(2, __VA_ARGS__)
|
||||
#else
|
||||
#define DIVLOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef SQRTDEBUG
|
||||
#define SQRTLOG(...) LOGC(3, __VA_ARGS__)
|
||||
#else
|
||||
#define SQRTLOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DMADEBUG
|
||||
#define DMALOG(...) LOGC(4, __VA_ARGS__)
|
||||
#else
|
||||
#define DMALOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef CFLASHDEBUG
|
||||
#define CFLASHLOG(...) LOGC(5, __VA_ARGS__)
|
||||
#else
|
||||
#define CFLASHLOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef UNTESTEDOPCODELOG
|
||||
#define UNTESTEDOPCODELOG(...) LOGC(6, __VA_ARGS__)
|
||||
#else
|
||||
#define UNTESTEDOPCODELOG(...)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEVELOPER
|
||||
#define PROGINFO(...) LOGC(7, __VA_ARGS__)
|
||||
#else
|
||||
#define PROGINFO(...)
|
||||
#endif
|
||||
|
||||
|
||||
#define INFOC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define INFO(...) INFOC(10, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,256 +1,256 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2008-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 _GFX3D_H_
|
||||
#define _GFX3D_H_
|
||||
|
||||
#include "types.h"
|
||||
#include <iosfwd>
|
||||
|
||||
//produce a 32bpp color from a DS RGB16
|
||||
#define RGB16TO32(col,alpha) (((alpha)<<24) | ((((col) & 0x7C00)>>7)<<16) | ((((col) & 0x3E0)>>2)<<8) | (((col) & 0x1F)<<3))
|
||||
|
||||
//produce a 32bpp color from a ds RGB15 plus an 8bit alpha, using a table
|
||||
#define RGB15TO32(col,alpha8) ( ((alpha8)<<24) | color_15bit_to_24bit[col&0x7FFF] )
|
||||
|
||||
//produce a 24bpp color from a ds RGB15, using a table
|
||||
#define RGB15TO24_REVERSE(col) ( color_15bit_to_24bit_reverse[col&0x7FFF] )
|
||||
|
||||
//produce a 16bpp color from a ds RGB15, using a table
|
||||
#define RGB15TO16_REVERSE(col) ( color_15bit_to_16bit_reverse[col&0x7FFF] )
|
||||
|
||||
//produce a 32bpp color from a ds RGB15 plus an 8bit alpha, not using a table (but using other tables)
|
||||
#define RGB15TO32_DIRECT(col,alpha8) ( ((alpha8)<<24) | (material_5bit_to_8bit[((col)>>10)&0x1F]<<16) | (material_5bit_to_8bit[((col)>>5)&0x1F]<<8) | material_5bit_to_8bit[(col)&0x1F] )
|
||||
|
||||
//produce a 15bpp color from individual 5bit components
|
||||
#define R5G5B5TORGB15(r,g,b) ((r)|((g)<<5)|((b)<<10))
|
||||
|
||||
|
||||
#define TEXMODE_NONE 0
|
||||
#define TEXMODE_A3I5 1
|
||||
#define TEXMODE_I2 2
|
||||
#define TEXMODE_I4 3
|
||||
#define TEXMODE_I8 4
|
||||
#define TEXMODE_4X4 5
|
||||
#define TEXMODE_A5I3 6
|
||||
#define TEXMODE_16BPP 7
|
||||
|
||||
void gfx3d_init();
|
||||
void gfx3d_reset();
|
||||
|
||||
struct POLY {
|
||||
int type; //tri or quad
|
||||
u16 vertIndexes[4]; //up to four verts can be referenced by this poly
|
||||
u32 polyAttr, texParam, texPalette; //the hardware rendering params
|
||||
// int projIndex; //the index into the projlist that this poly uses
|
||||
u32 pad;
|
||||
|
||||
bool isTranslucent()
|
||||
{
|
||||
//alpha != 31 -> translucent
|
||||
if((polyAttr&0x001F0000) != 0x001F0000)
|
||||
return true;
|
||||
int texFormat = (texParam>>26)&7;
|
||||
|
||||
//a5i3 or a3i5 -> translucent
|
||||
if(texFormat==1 || texFormat==6)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int getAlpha() { return (polyAttr>>16)&0x1F; }
|
||||
};
|
||||
|
||||
#define POLYLIST_SIZE 100000
|
||||
//#define POLYLIST_SIZE 2048
|
||||
struct POLYLIST {
|
||||
POLY list[POLYLIST_SIZE];
|
||||
int count;
|
||||
};
|
||||
|
||||
struct VERT {
|
||||
union {
|
||||
float coord[4];
|
||||
struct {
|
||||
float x,y,z,w;
|
||||
};
|
||||
};
|
||||
union {
|
||||
float texcoord[2];
|
||||
struct {
|
||||
float u,v;
|
||||
};
|
||||
};
|
||||
u8 color[3];
|
||||
float fcolor[3];
|
||||
void color_to_float() {
|
||||
fcolor[0] = color[0];
|
||||
fcolor[1] = color[1];
|
||||
fcolor[2] = color[2];
|
||||
}
|
||||
};
|
||||
|
||||
#define VERTLIST_SIZE 400000
|
||||
//#define VERTLIST_SIZE 10000
|
||||
struct VERTLIST {
|
||||
VERT list[VERTLIST_SIZE];
|
||||
int count;
|
||||
};
|
||||
|
||||
//used to communicate state to the renderer
|
||||
struct GFX3D
|
||||
{
|
||||
GFX3D()
|
||||
: enableTexturing(true)
|
||||
, enableAlphaTest(true)
|
||||
, enableAlphaBlending(true)
|
||||
, enableAntialiasing(false)
|
||||
, enableEdgeMarking(false)
|
||||
, shading(TOON)
|
||||
, polylist(0)
|
||||
, vertlist(0)
|
||||
, alphaTestRef(0)
|
||||
, clearDepth(1)
|
||||
, clearColor(0)
|
||||
, frameCtr(0)
|
||||
, frameCtrRaw(0)
|
||||
{
|
||||
fogColor[0] = fogColor[1] = fogColor[2] = fogColor[3] = 0;
|
||||
fogOffset = 0;
|
||||
}
|
||||
BOOL enableTexturing, enableAlphaTest, enableAlphaBlending, enableAntialiasing, enableEdgeMarking;
|
||||
|
||||
static const u32 TOON = 0;
|
||||
static const u32 HIGHLIGHT = 1;
|
||||
u32 shading;
|
||||
|
||||
POLYLIST* polylist;
|
||||
VERTLIST* vertlist;
|
||||
int indexlist[POLYLIST_SIZE];
|
||||
|
||||
BOOL wbuffer, sortmode;
|
||||
|
||||
u8 alphaTestRef;
|
||||
|
||||
struct VIEWPORT {
|
||||
VIEWPORT()
|
||||
: x(0), y(0), width(256), height(256)
|
||||
{}
|
||||
int x, y, width, height;
|
||||
} viewport;
|
||||
|
||||
u32 clearDepth;
|
||||
u32 clearColor;
|
||||
float fogColor[4];
|
||||
float fogOffset;
|
||||
|
||||
//ticks every time flush() is called
|
||||
int frameCtr;
|
||||
|
||||
//you can use this to track how many real frames passed, for comparing to frameCtr;
|
||||
int frameCtrRaw;
|
||||
|
||||
u32 rgbToonTable[32];
|
||||
};
|
||||
extern GFX3D gfx3d;
|
||||
|
||||
//---------------------
|
||||
|
||||
extern CACHE_ALIGN u32 color_15bit_to_24bit[32768];
|
||||
extern CACHE_ALIGN u32 color_15bit_to_24bit_reverse[32768];
|
||||
extern CACHE_ALIGN u16 color_15bit_to_16bit_reverse[32768];
|
||||
extern CACHE_ALIGN u8 mixTable555[32][32][32];
|
||||
extern CACHE_ALIGN const int material_5bit_to_31bit[32];
|
||||
extern CACHE_ALIGN const u8 material_5bit_to_8bit[32];
|
||||
extern CACHE_ALIGN const u8 material_3bit_to_8bit[8];
|
||||
extern CACHE_ALIGN const u8 alpha_5bit_to_4bit[32];
|
||||
|
||||
//GE commands:
|
||||
void gfx3d_glViewPort(unsigned long v);
|
||||
void gfx3d_glClearColor(unsigned long v);
|
||||
void gfx3d_glFogColor(unsigned long v);
|
||||
void gfx3d_glFogOffset (unsigned long v);
|
||||
void gfx3d_glClearDepth(unsigned long v);
|
||||
void gfx3d_glMatrixMode(unsigned long v);
|
||||
void gfx3d_glLoadIdentity();
|
||||
BOOL gfx3d_glLoadMatrix4x4(signed long v);
|
||||
BOOL gfx3d_glLoadMatrix4x3(signed long v);
|
||||
void gfx3d_glStoreMatrix(unsigned long v);
|
||||
void gfx3d_glRestoreMatrix(unsigned long v);
|
||||
void gfx3d_glPushMatrix(void);
|
||||
void gfx3d_glPopMatrix(signed long i);
|
||||
BOOL gfx3d_glTranslate(signed long v);
|
||||
BOOL gfx3d_glScale(signed long v);
|
||||
BOOL gfx3d_glMultMatrix3x3(signed long v);
|
||||
BOOL gfx3d_glMultMatrix4x3(signed long v);
|
||||
BOOL gfx3d_glMultMatrix4x4(signed long v);
|
||||
void gfx3d_glBegin(unsigned long v);
|
||||
void gfx3d_glEnd(void);
|
||||
void gfx3d_glColor3b(unsigned long v);
|
||||
BOOL gfx3d_glVertex16b(unsigned int v);
|
||||
void gfx3d_glVertex10b(unsigned long v);
|
||||
void gfx3d_glVertex3_cord(unsigned int one, unsigned int two, unsigned int v);
|
||||
void gfx3d_glVertex_rel(unsigned long v);
|
||||
void gfx3d_glSwapScreen(unsigned int screen);
|
||||
int gfx3d_GetNumPolys();
|
||||
int gfx3d_GetNumVertex();
|
||||
void gfx3d_glPolygonAttrib (unsigned long val);
|
||||
void gfx3d_glMaterial0(unsigned long val);
|
||||
void gfx3d_glMaterial1(unsigned long val);
|
||||
BOOL gfx3d_glShininess (unsigned long val);
|
||||
void gfx3d_UpdateToonTable(u8 offset, u16 val);
|
||||
void gfx3d_UpdateToonTable(u8 offset, u32 val);
|
||||
void gfx3d_glTexImage(unsigned long val);
|
||||
void gfx3d_glTexPalette(unsigned long val);
|
||||
void gfx3d_glTexCoord(unsigned long val);
|
||||
void gfx3d_glNormal(unsigned long v);
|
||||
signed long gfx3d_GetClipMatrix (unsigned int index);
|
||||
signed long gfx3d_GetDirectionalMatrix (unsigned int index);
|
||||
void gfx3d_glLightDirection (unsigned long v);
|
||||
void gfx3d_glLightColor (unsigned long v);
|
||||
void gfx3d_glAlphaFunc(unsigned long v);
|
||||
BOOL gfx3d_glBoxTest(unsigned long v);
|
||||
BOOL gfx3d_glPosTest(unsigned long v);
|
||||
void gfx3d_glVecTest(unsigned long v);
|
||||
unsigned int gfx3d_glGetPosRes(unsigned int index);
|
||||
unsigned short gfx3d_glGetVecRes(unsigned int index);
|
||||
void gfx3d_glFlush(unsigned long v);
|
||||
void gfx3d_VBlankSignal();
|
||||
void gfx3d_VBlankEndSignal(bool skipFrame);
|
||||
void gfx3d_Control(unsigned long v);
|
||||
u32 gfx3d_GetGXstatus();
|
||||
void gfx3d_sendCommandToFIFO(u32 val);
|
||||
void gfx3d_sendCommand(u32 cmd, u32 param);
|
||||
|
||||
//other misc stuff
|
||||
void gfx3d_glGetMatrix(unsigned int mode, int index, float* dest);
|
||||
void gfx3d_glGetLightDirection(unsigned int index, unsigned int* dest);
|
||||
void gfx3d_glGetLightColor(unsigned int index, unsigned int* dest);
|
||||
|
||||
struct SFORMAT;
|
||||
extern SFORMAT SF_GFX3D[];
|
||||
void gfx3d_savestate(std::ostream* os);
|
||||
bool gfx3d_loadstate(std::istream* is);
|
||||
|
||||
#endif
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2008-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 _GFX3D_H_
|
||||
#define _GFX3D_H_
|
||||
|
||||
#include "types.h"
|
||||
#include <iosfwd>
|
||||
|
||||
//produce a 32bpp color from a DS RGB16
|
||||
#define RGB16TO32(col,alpha) (((alpha)<<24) | ((((col) & 0x7C00)>>7)<<16) | ((((col) & 0x3E0)>>2)<<8) | (((col) & 0x1F)<<3))
|
||||
|
||||
//produce a 32bpp color from a ds RGB15 plus an 8bit alpha, using a table
|
||||
#define RGB15TO32(col,alpha8) ( ((alpha8)<<24) | color_15bit_to_24bit[col&0x7FFF] )
|
||||
|
||||
//produce a 24bpp color from a ds RGB15, using a table
|
||||
#define RGB15TO24_REVERSE(col) ( color_15bit_to_24bit_reverse[col&0x7FFF] )
|
||||
|
||||
//produce a 16bpp color from a ds RGB15, using a table
|
||||
#define RGB15TO16_REVERSE(col) ( color_15bit_to_16bit_reverse[col&0x7FFF] )
|
||||
|
||||
//produce a 32bpp color from a ds RGB15 plus an 8bit alpha, not using a table (but using other tables)
|
||||
#define RGB15TO32_DIRECT(col,alpha8) ( ((alpha8)<<24) | (material_5bit_to_8bit[((col)>>10)&0x1F]<<16) | (material_5bit_to_8bit[((col)>>5)&0x1F]<<8) | material_5bit_to_8bit[(col)&0x1F] )
|
||||
|
||||
//produce a 15bpp color from individual 5bit components
|
||||
#define R5G5B5TORGB15(r,g,b) ((r)|((g)<<5)|((b)<<10))
|
||||
|
||||
|
||||
#define TEXMODE_NONE 0
|
||||
#define TEXMODE_A3I5 1
|
||||
#define TEXMODE_I2 2
|
||||
#define TEXMODE_I4 3
|
||||
#define TEXMODE_I8 4
|
||||
#define TEXMODE_4X4 5
|
||||
#define TEXMODE_A5I3 6
|
||||
#define TEXMODE_16BPP 7
|
||||
|
||||
void gfx3d_init();
|
||||
void gfx3d_reset();
|
||||
|
||||
struct POLY {
|
||||
int type; //tri or quad
|
||||
u16 vertIndexes[4]; //up to four verts can be referenced by this poly
|
||||
u32 polyAttr, texParam, texPalette; //the hardware rendering params
|
||||
// int projIndex; //the index into the projlist that this poly uses
|
||||
u32 pad;
|
||||
|
||||
bool isTranslucent()
|
||||
{
|
||||
//alpha != 31 -> translucent
|
||||
if((polyAttr&0x001F0000) != 0x001F0000)
|
||||
return true;
|
||||
int texFormat = (texParam>>26)&7;
|
||||
|
||||
//a5i3 or a3i5 -> translucent
|
||||
if(texFormat==1 || texFormat==6)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int getAlpha() { return (polyAttr>>16)&0x1F; }
|
||||
};
|
||||
|
||||
#define POLYLIST_SIZE 100000
|
||||
//#define POLYLIST_SIZE 2048
|
||||
struct POLYLIST {
|
||||
POLY list[POLYLIST_SIZE];
|
||||
int count;
|
||||
};
|
||||
|
||||
struct VERT {
|
||||
union {
|
||||
float coord[4];
|
||||
struct {
|
||||
float x,y,z,w;
|
||||
};
|
||||
};
|
||||
union {
|
||||
float texcoord[2];
|
||||
struct {
|
||||
float u,v;
|
||||
};
|
||||
};
|
||||
u8 color[3];
|
||||
float fcolor[3];
|
||||
void color_to_float() {
|
||||
fcolor[0] = color[0];
|
||||
fcolor[1] = color[1];
|
||||
fcolor[2] = color[2];
|
||||
}
|
||||
};
|
||||
|
||||
#define VERTLIST_SIZE 400000
|
||||
//#define VERTLIST_SIZE 10000
|
||||
struct VERTLIST {
|
||||
VERT list[VERTLIST_SIZE];
|
||||
int count;
|
||||
};
|
||||
|
||||
//used to communicate state to the renderer
|
||||
struct GFX3D
|
||||
{
|
||||
GFX3D()
|
||||
: enableTexturing(true)
|
||||
, enableAlphaTest(true)
|
||||
, enableAlphaBlending(true)
|
||||
, enableAntialiasing(false)
|
||||
, enableEdgeMarking(false)
|
||||
, shading(TOON)
|
||||
, polylist(0)
|
||||
, vertlist(0)
|
||||
, alphaTestRef(0)
|
||||
, clearDepth(1)
|
||||
, clearColor(0)
|
||||
, frameCtr(0)
|
||||
, frameCtrRaw(0)
|
||||
{
|
||||
fogColor[0] = fogColor[1] = fogColor[2] = fogColor[3] = 0;
|
||||
fogOffset = 0;
|
||||
}
|
||||
BOOL enableTexturing, enableAlphaTest, enableAlphaBlending, enableAntialiasing, enableEdgeMarking;
|
||||
|
||||
static const u32 TOON = 0;
|
||||
static const u32 HIGHLIGHT = 1;
|
||||
u32 shading;
|
||||
|
||||
POLYLIST* polylist;
|
||||
VERTLIST* vertlist;
|
||||
int indexlist[POLYLIST_SIZE];
|
||||
|
||||
BOOL wbuffer, sortmode;
|
||||
|
||||
u8 alphaTestRef;
|
||||
|
||||
struct VIEWPORT {
|
||||
VIEWPORT()
|
||||
: x(0), y(0), width(256), height(256)
|
||||
{}
|
||||
int x, y, width, height;
|
||||
} viewport;
|
||||
|
||||
u32 clearDepth;
|
||||
u32 clearColor;
|
||||
float fogColor[4];
|
||||
float fogOffset;
|
||||
|
||||
//ticks every time flush() is called
|
||||
int frameCtr;
|
||||
|
||||
//you can use this to track how many real frames passed, for comparing to frameCtr;
|
||||
int frameCtrRaw;
|
||||
|
||||
u32 rgbToonTable[32];
|
||||
};
|
||||
extern GFX3D gfx3d;
|
||||
|
||||
//---------------------
|
||||
|
||||
extern CACHE_ALIGN u32 color_15bit_to_24bit[32768];
|
||||
extern CACHE_ALIGN u32 color_15bit_to_24bit_reverse[32768];
|
||||
extern CACHE_ALIGN u16 color_15bit_to_16bit_reverse[32768];
|
||||
extern CACHE_ALIGN u8 mixTable555[32][32][32];
|
||||
extern CACHE_ALIGN const int material_5bit_to_31bit[32];
|
||||
extern CACHE_ALIGN const u8 material_5bit_to_8bit[32];
|
||||
extern CACHE_ALIGN const u8 material_3bit_to_8bit[8];
|
||||
extern CACHE_ALIGN const u8 alpha_5bit_to_4bit[32];
|
||||
|
||||
//GE commands:
|
||||
void gfx3d_glViewPort(unsigned long v);
|
||||
void gfx3d_glClearColor(unsigned long v);
|
||||
void gfx3d_glFogColor(unsigned long v);
|
||||
void gfx3d_glFogOffset (unsigned long v);
|
||||
void gfx3d_glClearDepth(unsigned long v);
|
||||
void gfx3d_glMatrixMode(unsigned long v);
|
||||
void gfx3d_glLoadIdentity();
|
||||
BOOL gfx3d_glLoadMatrix4x4(signed long v);
|
||||
BOOL gfx3d_glLoadMatrix4x3(signed long v);
|
||||
void gfx3d_glStoreMatrix(unsigned long v);
|
||||
void gfx3d_glRestoreMatrix(unsigned long v);
|
||||
void gfx3d_glPushMatrix(void);
|
||||
void gfx3d_glPopMatrix(signed long i);
|
||||
BOOL gfx3d_glTranslate(signed long v);
|
||||
BOOL gfx3d_glScale(signed long v);
|
||||
BOOL gfx3d_glMultMatrix3x3(signed long v);
|
||||
BOOL gfx3d_glMultMatrix4x3(signed long v);
|
||||
BOOL gfx3d_glMultMatrix4x4(signed long v);
|
||||
void gfx3d_glBegin(unsigned long v);
|
||||
void gfx3d_glEnd(void);
|
||||
void gfx3d_glColor3b(unsigned long v);
|
||||
BOOL gfx3d_glVertex16b(unsigned int v);
|
||||
void gfx3d_glVertex10b(unsigned long v);
|
||||
void gfx3d_glVertex3_cord(unsigned int one, unsigned int two, unsigned int v);
|
||||
void gfx3d_glVertex_rel(unsigned long v);
|
||||
void gfx3d_glSwapScreen(unsigned int screen);
|
||||
int gfx3d_GetNumPolys();
|
||||
int gfx3d_GetNumVertex();
|
||||
void gfx3d_glPolygonAttrib (unsigned long val);
|
||||
void gfx3d_glMaterial0(unsigned long val);
|
||||
void gfx3d_glMaterial1(unsigned long val);
|
||||
BOOL gfx3d_glShininess (unsigned long val);
|
||||
void gfx3d_UpdateToonTable(u8 offset, u16 val);
|
||||
void gfx3d_UpdateToonTable(u8 offset, u32 val);
|
||||
void gfx3d_glTexImage(unsigned long val);
|
||||
void gfx3d_glTexPalette(unsigned long val);
|
||||
void gfx3d_glTexCoord(unsigned long val);
|
||||
void gfx3d_glNormal(unsigned long v);
|
||||
signed long gfx3d_GetClipMatrix (unsigned int index);
|
||||
signed long gfx3d_GetDirectionalMatrix (unsigned int index);
|
||||
void gfx3d_glLightDirection (unsigned long v);
|
||||
void gfx3d_glLightColor (unsigned long v);
|
||||
void gfx3d_glAlphaFunc(unsigned long v);
|
||||
BOOL gfx3d_glBoxTest(unsigned long v);
|
||||
BOOL gfx3d_glPosTest(unsigned long v);
|
||||
void gfx3d_glVecTest(unsigned long v);
|
||||
unsigned int gfx3d_glGetPosRes(unsigned int index);
|
||||
unsigned short gfx3d_glGetVecRes(unsigned int index);
|
||||
void gfx3d_glFlush(unsigned long v);
|
||||
void gfx3d_VBlankSignal();
|
||||
void gfx3d_VBlankEndSignal(bool skipFrame);
|
||||
void gfx3d_Control(unsigned long v);
|
||||
u32 gfx3d_GetGXstatus();
|
||||
void gfx3d_sendCommandToFIFO(u32 val);
|
||||
void gfx3d_sendCommand(u32 cmd, u32 param);
|
||||
|
||||
//other misc stuff
|
||||
void gfx3d_glGetMatrix(unsigned int mode, int index, float* dest);
|
||||
void gfx3d_glGetLightDirection(unsigned int index, unsigned int* dest);
|
||||
void gfx3d_glGetLightColor(unsigned int index, unsigned int* dest);
|
||||
|
||||
struct SFORMAT;
|
||||
extern SFORMAT SF_GFX3D[];
|
||||
void gfx3d_savestate(std::ostream* os);
|
||||
bool gfx3d_loadstate(std::istream* is);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,321 +1,321 @@
|
|||
/*
|
||||
Copyright (C) 2006-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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "matrix.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
void MatrixInit (float *matrix)
|
||||
{
|
||||
memset (matrix, 0, sizeof(float)*16);
|
||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
||||
}
|
||||
|
||||
#ifndef SSE2
|
||||
void MATRIXFASTCALL MatrixMultVec4x4 (const float *matrix, float *vecPtr)
|
||||
{
|
||||
float x = vecPtr[0];
|
||||
float y = vecPtr[1];
|
||||
float z = vecPtr[2];
|
||||
float w = vecPtr[3];
|
||||
|
||||
vecPtr[0] = x * matrix[0] + y * matrix[4] + z * matrix[ 8] + w * matrix[12];
|
||||
vecPtr[1] = x * matrix[1] + y * matrix[5] + z * matrix[ 9] + w * matrix[13];
|
||||
vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10] + w * matrix[14];
|
||||
vecPtr[3] = x * matrix[3] + y * matrix[7] + z * matrix[11] + w * matrix[15];
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixMultVec3x3 (const float *matrix, float *vecPtr)
|
||||
{
|
||||
float x = vecPtr[0];
|
||||
float y = vecPtr[1];
|
||||
float z = vecPtr[2];
|
||||
|
||||
vecPtr[0] = x * matrix[0] + y * matrix[4] + z * matrix[ 8];
|
||||
vecPtr[1] = x * matrix[1] + y * matrix[5] + z * matrix[ 9];
|
||||
vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10];
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixMultiply (float *matrix, const float *rightMatrix)
|
||||
{
|
||||
float tmpMatrix[16];
|
||||
|
||||
tmpMatrix[0] = (matrix[0]*rightMatrix[0])+(matrix[4]*rightMatrix[1])+(matrix[8]*rightMatrix[2])+(matrix[12]*rightMatrix[3]);
|
||||
tmpMatrix[1] = (matrix[1]*rightMatrix[0])+(matrix[5]*rightMatrix[1])+(matrix[9]*rightMatrix[2])+(matrix[13]*rightMatrix[3]);
|
||||
tmpMatrix[2] = (matrix[2]*rightMatrix[0])+(matrix[6]*rightMatrix[1])+(matrix[10]*rightMatrix[2])+(matrix[14]*rightMatrix[3]);
|
||||
tmpMatrix[3] = (matrix[3]*rightMatrix[0])+(matrix[7]*rightMatrix[1])+(matrix[11]*rightMatrix[2])+(matrix[15]*rightMatrix[3]);
|
||||
|
||||
tmpMatrix[4] = (matrix[0]*rightMatrix[4])+(matrix[4]*rightMatrix[5])+(matrix[8]*rightMatrix[6])+(matrix[12]*rightMatrix[7]);
|
||||
tmpMatrix[5] = (matrix[1]*rightMatrix[4])+(matrix[5]*rightMatrix[5])+(matrix[9]*rightMatrix[6])+(matrix[13]*rightMatrix[7]);
|
||||
tmpMatrix[6] = (matrix[2]*rightMatrix[4])+(matrix[6]*rightMatrix[5])+(matrix[10]*rightMatrix[6])+(matrix[14]*rightMatrix[7]);
|
||||
tmpMatrix[7] = (matrix[3]*rightMatrix[4])+(matrix[7]*rightMatrix[5])+(matrix[11]*rightMatrix[6])+(matrix[15]*rightMatrix[7]);
|
||||
|
||||
tmpMatrix[8] = (matrix[0]*rightMatrix[8])+(matrix[4]*rightMatrix[9])+(matrix[8]*rightMatrix[10])+(matrix[12]*rightMatrix[11]);
|
||||
tmpMatrix[9] = (matrix[1]*rightMatrix[8])+(matrix[5]*rightMatrix[9])+(matrix[9]*rightMatrix[10])+(matrix[13]*rightMatrix[11]);
|
||||
tmpMatrix[10] = (matrix[2]*rightMatrix[8])+(matrix[6]*rightMatrix[9])+(matrix[10]*rightMatrix[10])+(matrix[14]*rightMatrix[11]);
|
||||
tmpMatrix[11] = (matrix[3]*rightMatrix[8])+(matrix[7]*rightMatrix[9])+(matrix[11]*rightMatrix[10])+(matrix[15]*rightMatrix[11]);
|
||||
|
||||
tmpMatrix[12] = (matrix[0]*rightMatrix[12])+(matrix[4]*rightMatrix[13])+(matrix[8]*rightMatrix[14])+(matrix[12]*rightMatrix[15]);
|
||||
tmpMatrix[13] = (matrix[1]*rightMatrix[12])+(matrix[5]*rightMatrix[13])+(matrix[9]*rightMatrix[14])+(matrix[13]*rightMatrix[15]);
|
||||
tmpMatrix[14] = (matrix[2]*rightMatrix[12])+(matrix[6]*rightMatrix[13])+(matrix[10]*rightMatrix[14])+(matrix[14]*rightMatrix[15]);
|
||||
tmpMatrix[15] = (matrix[3]*rightMatrix[12])+(matrix[7]*rightMatrix[13])+(matrix[11]*rightMatrix[14])+(matrix[15]*rightMatrix[15]);
|
||||
|
||||
memcpy (matrix, tmpMatrix, sizeof(float)*16);
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr)
|
||||
{
|
||||
matrix[12] += (matrix[0]*ptr[0])+(matrix[4]*ptr[1])+(matrix[ 8]*ptr[2]);
|
||||
matrix[13] += (matrix[1]*ptr[0])+(matrix[5]*ptr[1])+(matrix[ 9]*ptr[2]);
|
||||
matrix[14] += (matrix[2]*ptr[0])+(matrix[6]*ptr[1])+(matrix[10]*ptr[2]);
|
||||
matrix[15] += (matrix[3]*ptr[0])+(matrix[7]*ptr[1])+(matrix[11]*ptr[2]);
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixScale (float *matrix, const float *ptr)
|
||||
{
|
||||
matrix[0] *= ptr[0];
|
||||
matrix[1] *= ptr[0];
|
||||
matrix[2] *= ptr[0];
|
||||
matrix[3] *= ptr[0];
|
||||
|
||||
matrix[4] *= ptr[1];
|
||||
matrix[5] *= ptr[1];
|
||||
matrix[6] *= ptr[1];
|
||||
matrix[7] *= ptr[1];
|
||||
|
||||
matrix[8] *= ptr[2];
|
||||
matrix[9] *= ptr[2];
|
||||
matrix[10] *= ptr[2];
|
||||
matrix[11] *= ptr[2];
|
||||
}
|
||||
#endif //switched c/asm functions
|
||||
//-----------------------------------------
|
||||
|
||||
void MatrixTranspose(float *matrix)
|
||||
{
|
||||
float temp;
|
||||
#define swap(A,B) temp = matrix[A];matrix[A] = matrix[B]; matrix[B] = temp;
|
||||
swap(1,4);
|
||||
swap(2,8);
|
||||
swap(3,0xC);
|
||||
swap(6,9);
|
||||
swap(7,0xD);
|
||||
swap(0xB,0xE);
|
||||
#undef swap
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixIdentity (float *matrix) //============== TODO
|
||||
{
|
||||
//memset (matrix, 0, sizeof(float)*16);
|
||||
//this is fastest for SSE2 i think.
|
||||
//study code generation and split into sse2 specific module later
|
||||
for(int i=0;i<16;i++)
|
||||
matrix[i] = 0.0f;
|
||||
//matrix[1] = matrix[2] = matrix[3] = matrix[4] = 0.0f;
|
||||
//matrix[6] = matrix[7] = matrix[8] = matrix[9] = 0.0f;
|
||||
//matrix[11] = matrix[12] = matrix[13] = matrix[14] = 0.0f;
|
||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
||||
}
|
||||
|
||||
float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix)
|
||||
{
|
||||
int iMod = index%4, iDiv = (index>>2)<<2;
|
||||
|
||||
return (matrix[iMod ]*rightMatrix[iDiv ])+(matrix[iMod+ 4]*rightMatrix[iDiv+1])+
|
||||
(matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]);
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value) // TODO
|
||||
{
|
||||
matrix [x+(y<<2)] = value;
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixCopy (float* matrixDST, const float* matrixSRC)
|
||||
{
|
||||
memcpy ((void*)matrixDST, matrixSRC, sizeof(float)*16);
|
||||
}
|
||||
|
||||
int MATRIXFASTCALL MatrixCompare (const float* matrixDST, const float* matrixSRC)
|
||||
{
|
||||
return memcmp((void*)matrixDST, matrixSRC, sizeof(float)*16);
|
||||
}
|
||||
|
||||
void MatrixStackSetMaxSize (MatrixStack *stack, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
stack->size = size;
|
||||
|
||||
if (stack->matrix != NULL) {
|
||||
free (stack->matrix);
|
||||
}
|
||||
stack->matrix = (float*) malloc (stack->size*16*sizeof(float));
|
||||
|
||||
for (i = 0; i < stack->size; i++)
|
||||
{
|
||||
MatrixInit (&stack->matrix[i*16]);
|
||||
}
|
||||
|
||||
stack->size--;
|
||||
}
|
||||
|
||||
|
||||
MatrixStack::MatrixStack(int size)
|
||||
{
|
||||
MatrixStackSetMaxSize(this,size);
|
||||
}
|
||||
|
||||
void MatrixStackSetStackPosition (MatrixStack *stack, int pos)
|
||||
{
|
||||
stack->position += pos;
|
||||
|
||||
if (stack->position < 0)
|
||||
stack->position = 0;
|
||||
else if (stack->position > stack->size)
|
||||
stack->position = stack->size;
|
||||
}
|
||||
|
||||
void MatrixStackPushMatrix (MatrixStack *stack, const float *ptr)
|
||||
{
|
||||
MatrixCopy (&stack->matrix[stack->position*16], ptr);
|
||||
|
||||
MatrixStackSetStackPosition (stack, 1);
|
||||
}
|
||||
|
||||
float * MatrixStackPopMatrix (MatrixStack *stack, int size)
|
||||
{
|
||||
MatrixStackSetStackPosition(stack, -size);
|
||||
|
||||
return &stack->matrix[stack->position*16];
|
||||
}
|
||||
|
||||
float * MatrixStackGetPos (MatrixStack *stack, int pos)
|
||||
{
|
||||
return &stack->matrix[pos*16];
|
||||
}
|
||||
|
||||
float * MatrixStackGet (MatrixStack *stack)
|
||||
{
|
||||
return &stack->matrix[stack->position*16];
|
||||
}
|
||||
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const float *ptr)
|
||||
{
|
||||
MatrixCopy (&stack->matrix[pos*16], ptr);
|
||||
}
|
||||
|
||||
void Vector2Copy(float *dst, const float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
}
|
||||
|
||||
void Vector2Add(float *dst, const float *src)
|
||||
{
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
}
|
||||
|
||||
void Vector2Subtract(float *dst, const float *src)
|
||||
{
|
||||
dst[0] -= src[0];
|
||||
dst[1] -= src[1];
|
||||
}
|
||||
|
||||
float Vector2Dot(const float *a, const float *b)
|
||||
{
|
||||
return (a[0]*b[0]) + (a[1]*b[1]);
|
||||
}
|
||||
|
||||
/* http://www.gamedev.net/community/forums/topic.asp?topic_id=289972 */
|
||||
float Vector2Cross(const float *a, const float *b)
|
||||
{
|
||||
return (a[0]*b[1]) - (a[1]*b[0]);
|
||||
}
|
||||
|
||||
float Vector3Dot(const float *a, const float *b)
|
||||
{
|
||||
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
|
||||
}
|
||||
|
||||
void Vector3Cross(float* dst, const float *a, const float *b)
|
||||
{
|
||||
dst[0] = a[1]*b[2] - a[2]*b[1];
|
||||
dst[1] = a[2]*b[0] - a[0]*b[2];
|
||||
dst[2] = a[0]*b[1] - a[1]*b[0];
|
||||
}
|
||||
|
||||
|
||||
float Vector3Length(const float *a)
|
||||
{
|
||||
float lengthSquared = Vector3Dot(a,a);
|
||||
float length = sqrt(lengthSquared);
|
||||
return length;
|
||||
}
|
||||
|
||||
void Vector3Add(float *dst, const float *src)
|
||||
{
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
dst[2] += src[2];
|
||||
}
|
||||
|
||||
void Vector3Subtract(float *dst, const float *src)
|
||||
{
|
||||
dst[0] -= src[0];
|
||||
dst[1] -= src[1];
|
||||
dst[2] -= src[2];
|
||||
}
|
||||
|
||||
void Vector3Scale(float *dst, const float scale)
|
||||
{
|
||||
dst[0] *= scale;
|
||||
dst[1] *= scale;
|
||||
dst[2] *= scale;
|
||||
}
|
||||
|
||||
void Vector3Copy(float *dst, const float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
}
|
||||
|
||||
void Vector3Normalize(float *dst)
|
||||
{
|
||||
float length = Vector3Length(dst);
|
||||
Vector3Scale(dst,1.0f/length);
|
||||
}
|
||||
|
||||
void Vector4Copy(float *dst, const float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
dst[3] = src[3];
|
||||
}
|
||||
|
||||
} //extern "C"
|
||||
|
||||
/*
|
||||
Copyright (C) 2006-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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "matrix.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
void MatrixInit (float *matrix)
|
||||
{
|
||||
memset (matrix, 0, sizeof(float)*16);
|
||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
||||
}
|
||||
|
||||
#ifndef SSE2
|
||||
void MATRIXFASTCALL MatrixMultVec4x4 (const float *matrix, float *vecPtr)
|
||||
{
|
||||
float x = vecPtr[0];
|
||||
float y = vecPtr[1];
|
||||
float z = vecPtr[2];
|
||||
float w = vecPtr[3];
|
||||
|
||||
vecPtr[0] = x * matrix[0] + y * matrix[4] + z * matrix[ 8] + w * matrix[12];
|
||||
vecPtr[1] = x * matrix[1] + y * matrix[5] + z * matrix[ 9] + w * matrix[13];
|
||||
vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10] + w * matrix[14];
|
||||
vecPtr[3] = x * matrix[3] + y * matrix[7] + z * matrix[11] + w * matrix[15];
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixMultVec3x3 (const float *matrix, float *vecPtr)
|
||||
{
|
||||
float x = vecPtr[0];
|
||||
float y = vecPtr[1];
|
||||
float z = vecPtr[2];
|
||||
|
||||
vecPtr[0] = x * matrix[0] + y * matrix[4] + z * matrix[ 8];
|
||||
vecPtr[1] = x * matrix[1] + y * matrix[5] + z * matrix[ 9];
|
||||
vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10];
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixMultiply (float *matrix, const float *rightMatrix)
|
||||
{
|
||||
float tmpMatrix[16];
|
||||
|
||||
tmpMatrix[0] = (matrix[0]*rightMatrix[0])+(matrix[4]*rightMatrix[1])+(matrix[8]*rightMatrix[2])+(matrix[12]*rightMatrix[3]);
|
||||
tmpMatrix[1] = (matrix[1]*rightMatrix[0])+(matrix[5]*rightMatrix[1])+(matrix[9]*rightMatrix[2])+(matrix[13]*rightMatrix[3]);
|
||||
tmpMatrix[2] = (matrix[2]*rightMatrix[0])+(matrix[6]*rightMatrix[1])+(matrix[10]*rightMatrix[2])+(matrix[14]*rightMatrix[3]);
|
||||
tmpMatrix[3] = (matrix[3]*rightMatrix[0])+(matrix[7]*rightMatrix[1])+(matrix[11]*rightMatrix[2])+(matrix[15]*rightMatrix[3]);
|
||||
|
||||
tmpMatrix[4] = (matrix[0]*rightMatrix[4])+(matrix[4]*rightMatrix[5])+(matrix[8]*rightMatrix[6])+(matrix[12]*rightMatrix[7]);
|
||||
tmpMatrix[5] = (matrix[1]*rightMatrix[4])+(matrix[5]*rightMatrix[5])+(matrix[9]*rightMatrix[6])+(matrix[13]*rightMatrix[7]);
|
||||
tmpMatrix[6] = (matrix[2]*rightMatrix[4])+(matrix[6]*rightMatrix[5])+(matrix[10]*rightMatrix[6])+(matrix[14]*rightMatrix[7]);
|
||||
tmpMatrix[7] = (matrix[3]*rightMatrix[4])+(matrix[7]*rightMatrix[5])+(matrix[11]*rightMatrix[6])+(matrix[15]*rightMatrix[7]);
|
||||
|
||||
tmpMatrix[8] = (matrix[0]*rightMatrix[8])+(matrix[4]*rightMatrix[9])+(matrix[8]*rightMatrix[10])+(matrix[12]*rightMatrix[11]);
|
||||
tmpMatrix[9] = (matrix[1]*rightMatrix[8])+(matrix[5]*rightMatrix[9])+(matrix[9]*rightMatrix[10])+(matrix[13]*rightMatrix[11]);
|
||||
tmpMatrix[10] = (matrix[2]*rightMatrix[8])+(matrix[6]*rightMatrix[9])+(matrix[10]*rightMatrix[10])+(matrix[14]*rightMatrix[11]);
|
||||
tmpMatrix[11] = (matrix[3]*rightMatrix[8])+(matrix[7]*rightMatrix[9])+(matrix[11]*rightMatrix[10])+(matrix[15]*rightMatrix[11]);
|
||||
|
||||
tmpMatrix[12] = (matrix[0]*rightMatrix[12])+(matrix[4]*rightMatrix[13])+(matrix[8]*rightMatrix[14])+(matrix[12]*rightMatrix[15]);
|
||||
tmpMatrix[13] = (matrix[1]*rightMatrix[12])+(matrix[5]*rightMatrix[13])+(matrix[9]*rightMatrix[14])+(matrix[13]*rightMatrix[15]);
|
||||
tmpMatrix[14] = (matrix[2]*rightMatrix[12])+(matrix[6]*rightMatrix[13])+(matrix[10]*rightMatrix[14])+(matrix[14]*rightMatrix[15]);
|
||||
tmpMatrix[15] = (matrix[3]*rightMatrix[12])+(matrix[7]*rightMatrix[13])+(matrix[11]*rightMatrix[14])+(matrix[15]*rightMatrix[15]);
|
||||
|
||||
memcpy (matrix, tmpMatrix, sizeof(float)*16);
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr)
|
||||
{
|
||||
matrix[12] += (matrix[0]*ptr[0])+(matrix[4]*ptr[1])+(matrix[ 8]*ptr[2]);
|
||||
matrix[13] += (matrix[1]*ptr[0])+(matrix[5]*ptr[1])+(matrix[ 9]*ptr[2]);
|
||||
matrix[14] += (matrix[2]*ptr[0])+(matrix[6]*ptr[1])+(matrix[10]*ptr[2]);
|
||||
matrix[15] += (matrix[3]*ptr[0])+(matrix[7]*ptr[1])+(matrix[11]*ptr[2]);
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixScale (float *matrix, const float *ptr)
|
||||
{
|
||||
matrix[0] *= ptr[0];
|
||||
matrix[1] *= ptr[0];
|
||||
matrix[2] *= ptr[0];
|
||||
matrix[3] *= ptr[0];
|
||||
|
||||
matrix[4] *= ptr[1];
|
||||
matrix[5] *= ptr[1];
|
||||
matrix[6] *= ptr[1];
|
||||
matrix[7] *= ptr[1];
|
||||
|
||||
matrix[8] *= ptr[2];
|
||||
matrix[9] *= ptr[2];
|
||||
matrix[10] *= ptr[2];
|
||||
matrix[11] *= ptr[2];
|
||||
}
|
||||
#endif //switched c/asm functions
|
||||
//-----------------------------------------
|
||||
|
||||
void MatrixTranspose(float *matrix)
|
||||
{
|
||||
float temp;
|
||||
#define swap(A,B) temp = matrix[A];matrix[A] = matrix[B]; matrix[B] = temp;
|
||||
swap(1,4);
|
||||
swap(2,8);
|
||||
swap(3,0xC);
|
||||
swap(6,9);
|
||||
swap(7,0xD);
|
||||
swap(0xB,0xE);
|
||||
#undef swap
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixIdentity (float *matrix) //============== TODO
|
||||
{
|
||||
//memset (matrix, 0, sizeof(float)*16);
|
||||
//this is fastest for SSE2 i think.
|
||||
//study code generation and split into sse2 specific module later
|
||||
for(int i=0;i<16;i++)
|
||||
matrix[i] = 0.0f;
|
||||
//matrix[1] = matrix[2] = matrix[3] = matrix[4] = 0.0f;
|
||||
//matrix[6] = matrix[7] = matrix[8] = matrix[9] = 0.0f;
|
||||
//matrix[11] = matrix[12] = matrix[13] = matrix[14] = 0.0f;
|
||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
||||
}
|
||||
|
||||
float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix)
|
||||
{
|
||||
int iMod = index%4, iDiv = (index>>2)<<2;
|
||||
|
||||
return (matrix[iMod ]*rightMatrix[iDiv ])+(matrix[iMod+ 4]*rightMatrix[iDiv+1])+
|
||||
(matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]);
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value) // TODO
|
||||
{
|
||||
matrix [x+(y<<2)] = value;
|
||||
}
|
||||
|
||||
void MATRIXFASTCALL MatrixCopy (float* matrixDST, const float* matrixSRC)
|
||||
{
|
||||
memcpy ((void*)matrixDST, matrixSRC, sizeof(float)*16);
|
||||
}
|
||||
|
||||
int MATRIXFASTCALL MatrixCompare (const float* matrixDST, const float* matrixSRC)
|
||||
{
|
||||
return memcmp((void*)matrixDST, matrixSRC, sizeof(float)*16);
|
||||
}
|
||||
|
||||
void MatrixStackSetMaxSize (MatrixStack *stack, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
stack->size = size;
|
||||
|
||||
if (stack->matrix != NULL) {
|
||||
free (stack->matrix);
|
||||
}
|
||||
stack->matrix = (float*) malloc (stack->size*16*sizeof(float));
|
||||
|
||||
for (i = 0; i < stack->size; i++)
|
||||
{
|
||||
MatrixInit (&stack->matrix[i*16]);
|
||||
}
|
||||
|
||||
stack->size--;
|
||||
}
|
||||
|
||||
|
||||
MatrixStack::MatrixStack(int size)
|
||||
{
|
||||
MatrixStackSetMaxSize(this,size);
|
||||
}
|
||||
|
||||
void MatrixStackSetStackPosition (MatrixStack *stack, int pos)
|
||||
{
|
||||
stack->position += pos;
|
||||
|
||||
if (stack->position < 0)
|
||||
stack->position = 0;
|
||||
else if (stack->position > stack->size)
|
||||
stack->position = stack->size;
|
||||
}
|
||||
|
||||
void MatrixStackPushMatrix (MatrixStack *stack, const float *ptr)
|
||||
{
|
||||
MatrixCopy (&stack->matrix[stack->position*16], ptr);
|
||||
|
||||
MatrixStackSetStackPosition (stack, 1);
|
||||
}
|
||||
|
||||
float * MatrixStackPopMatrix (MatrixStack *stack, int size)
|
||||
{
|
||||
MatrixStackSetStackPosition(stack, -size);
|
||||
|
||||
return &stack->matrix[stack->position*16];
|
||||
}
|
||||
|
||||
float * MatrixStackGetPos (MatrixStack *stack, int pos)
|
||||
{
|
||||
return &stack->matrix[pos*16];
|
||||
}
|
||||
|
||||
float * MatrixStackGet (MatrixStack *stack)
|
||||
{
|
||||
return &stack->matrix[stack->position*16];
|
||||
}
|
||||
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const float *ptr)
|
||||
{
|
||||
MatrixCopy (&stack->matrix[pos*16], ptr);
|
||||
}
|
||||
|
||||
void Vector2Copy(float *dst, const float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
}
|
||||
|
||||
void Vector2Add(float *dst, const float *src)
|
||||
{
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
}
|
||||
|
||||
void Vector2Subtract(float *dst, const float *src)
|
||||
{
|
||||
dst[0] -= src[0];
|
||||
dst[1] -= src[1];
|
||||
}
|
||||
|
||||
float Vector2Dot(const float *a, const float *b)
|
||||
{
|
||||
return (a[0]*b[0]) + (a[1]*b[1]);
|
||||
}
|
||||
|
||||
/* http://www.gamedev.net/community/forums/topic.asp?topic_id=289972 */
|
||||
float Vector2Cross(const float *a, const float *b)
|
||||
{
|
||||
return (a[0]*b[1]) - (a[1]*b[0]);
|
||||
}
|
||||
|
||||
float Vector3Dot(const float *a, const float *b)
|
||||
{
|
||||
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
|
||||
}
|
||||
|
||||
void Vector3Cross(float* dst, const float *a, const float *b)
|
||||
{
|
||||
dst[0] = a[1]*b[2] - a[2]*b[1];
|
||||
dst[1] = a[2]*b[0] - a[0]*b[2];
|
||||
dst[2] = a[0]*b[1] - a[1]*b[0];
|
||||
}
|
||||
|
||||
|
||||
float Vector3Length(const float *a)
|
||||
{
|
||||
float lengthSquared = Vector3Dot(a,a);
|
||||
float length = sqrt(lengthSquared);
|
||||
return length;
|
||||
}
|
||||
|
||||
void Vector3Add(float *dst, const float *src)
|
||||
{
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
dst[2] += src[2];
|
||||
}
|
||||
|
||||
void Vector3Subtract(float *dst, const float *src)
|
||||
{
|
||||
dst[0] -= src[0];
|
||||
dst[1] -= src[1];
|
||||
dst[2] -= src[2];
|
||||
}
|
||||
|
||||
void Vector3Scale(float *dst, const float scale)
|
||||
{
|
||||
dst[0] *= scale;
|
||||
dst[1] *= scale;
|
||||
dst[2] *= scale;
|
||||
}
|
||||
|
||||
void Vector3Copy(float *dst, const float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
}
|
||||
|
||||
void Vector3Normalize(float *dst)
|
||||
{
|
||||
float length = Vector3Length(dst);
|
||||
Vector3Scale(dst,1.0f/length);
|
||||
}
|
||||
|
||||
void Vector4Copy(float *dst, const float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
dst[3] = src[3];
|
||||
}
|
||||
|
||||
} //extern "C"
|
||||
|
||||
|
|
|
@ -1,84 +1,84 @@
|
|||
/*
|
||||
Copyright (C) 2006-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 MATRIX_H
|
||||
#define MATRIX_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
struct MatrixStack
|
||||
{
|
||||
MatrixStack(int size);
|
||||
float *matrix;
|
||||
int position;
|
||||
int size;
|
||||
};
|
||||
|
||||
void MatrixInit (float *matrix);
|
||||
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define MATRIXFASTCALL __fastcall
|
||||
#else
|
||||
#define MATRIXFASTCALL
|
||||
#endif
|
||||
|
||||
void MATRIXFASTCALL MatrixMultVec3x3 (const float * matrix, float * vecPtr);
|
||||
void MATRIXFASTCALL MatrixMultVec4x4 (const float * matrix, float * vecPtr);
|
||||
void MATRIXFASTCALL MatrixMultiply (float * matrix, const float * rightMatrix);
|
||||
void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr);
|
||||
void MATRIXFASTCALL MatrixScale (float * matrix, const float * ptr);
|
||||
float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
||||
void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value);
|
||||
void MATRIXFASTCALL MatrixCopy (float * matrixDST, const float * matrixSRC);
|
||||
int MATRIXFASTCALL MatrixCompare (const float * matrixDST, const float * matrixSRC);
|
||||
void MATRIXFASTCALL 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);
|
||||
|
||||
} //extern "C"
|
||||
|
||||
#endif
|
||||
/*
|
||||
Copyright (C) 2006-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 MATRIX_H
|
||||
#define MATRIX_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
struct MatrixStack
|
||||
{
|
||||
MatrixStack(int size);
|
||||
float *matrix;
|
||||
int position;
|
||||
int size;
|
||||
};
|
||||
|
||||
void MatrixInit (float *matrix);
|
||||
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define MATRIXFASTCALL __fastcall
|
||||
#else
|
||||
#define MATRIXFASTCALL
|
||||
#endif
|
||||
|
||||
void MATRIXFASTCALL MatrixMultVec3x3 (const float * matrix, float * vecPtr);
|
||||
void MATRIXFASTCALL MatrixMultVec4x4 (const float * matrix, float * vecPtr);
|
||||
void MATRIXFASTCALL MatrixMultiply (float * matrix, const float * rightMatrix);
|
||||
void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr);
|
||||
void MATRIXFASTCALL MatrixScale (float * matrix, const float * ptr);
|
||||
float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
||||
void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value);
|
||||
void MATRIXFASTCALL MatrixCopy (float * matrixDST, const float * matrixSRC);
|
||||
int MATRIXFASTCALL MatrixCompare (const float * matrixDST, const float * matrixSRC);
|
||||
void MATRIXFASTCALL 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);
|
||||
|
||||
} //extern "C"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,303 +1,303 @@
|
|||
#ifndef _memorystream_h_
|
||||
#define _memorystream_h_
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
template<typename T>
|
||||
class memory_streambuf: public std::streambuf {
|
||||
private:
|
||||
|
||||
friend class memorystream;
|
||||
|
||||
//the current buffer
|
||||
T* buf;
|
||||
|
||||
//the current allocated capacity of the buffer
|
||||
size_t capacity;
|
||||
|
||||
//whether the sequence is owned by the stringbuf
|
||||
bool myBuf;
|
||||
|
||||
//the logical length of the buffer
|
||||
size_t length;
|
||||
|
||||
//the current 'write window' starting position within the buffer for writing.
|
||||
size_t ww;
|
||||
|
||||
//a vector that we have been told to use
|
||||
std::vector<T>* usevec;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
memory_streambuf(int _capacity)
|
||||
: buf(new T[capacity=_capacity])
|
||||
, myBuf(true)
|
||||
, length(_capacity)
|
||||
, ww(0)
|
||||
, usevec(0)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
|
||||
memory_streambuf()
|
||||
: buf(new T[capacity = 128])
|
||||
, myBuf(true)
|
||||
, length(0)
|
||||
, ww(0)
|
||||
, usevec(0)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
//constructs a non-expandable streambuf around the provided buffer
|
||||
memory_streambuf(T* usebuf, int buflength)
|
||||
: buf(usebuf)
|
||||
, myBuf(false)
|
||||
, length(buflength)
|
||||
, ww(0)
|
||||
, usevec(0)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
//constructs an expandable streambuf around the provided buffer
|
||||
memory_streambuf(std::vector<T>* _usevec)
|
||||
: capacity(_usevec->size())
|
||||
, myBuf(false)
|
||||
, length(_usevec->size())
|
||||
, ww(0)
|
||||
, usevec(_usevec)
|
||||
{
|
||||
if(length>0)
|
||||
buf = &(*_usevec)[0];
|
||||
else buf = 0;
|
||||
|
||||
sync();
|
||||
}
|
||||
|
||||
~memory_streambuf()
|
||||
{
|
||||
//only cleanup if we own the seq
|
||||
if(myBuf) delete[] buf;
|
||||
}
|
||||
|
||||
//the logical length of the buffer
|
||||
size_t size()
|
||||
{
|
||||
sync();
|
||||
return length;
|
||||
}
|
||||
|
||||
//to avoid copying, rebuilds the provided vector and copies the streambuf contents into it
|
||||
void toVector(std::vector<T>& out)
|
||||
{
|
||||
out.resize(length);
|
||||
memcpy(&out[0],buf,length);
|
||||
}
|
||||
|
||||
//maybe the compiler can avoid copying, but maybe not: returns a vector representing the current streambuf
|
||||
std::vector<T> toVector()
|
||||
{
|
||||
return std::vector<T>(buf,buf+length);
|
||||
}
|
||||
|
||||
//if the memorystream wraps a vector, the vector will be trimmed to the correct size,.
|
||||
//you probably need to use this if you are using the vector wrapper
|
||||
void trim()
|
||||
{
|
||||
if(!usevec) return;
|
||||
usevec->resize(size());
|
||||
}
|
||||
|
||||
//tells the current read or write position
|
||||
std::streampos tell(std::ios::openmode which)
|
||||
{
|
||||
if(which == std::ios::in)
|
||||
return tellRead();
|
||||
else if(which == std::ios::out)
|
||||
return tellWrite();
|
||||
else return -1;
|
||||
}
|
||||
|
||||
//tells the current read position
|
||||
std::streampos tellRead()
|
||||
{
|
||||
return gptr()-eback();
|
||||
}
|
||||
|
||||
//tells the current write position
|
||||
std::streampos tellWrite()
|
||||
{
|
||||
return pptr()-pbase() + ww;
|
||||
}
|
||||
|
||||
int sync()
|
||||
{
|
||||
dosync(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
T* getbuf()
|
||||
{
|
||||
sync();
|
||||
return buf;
|
||||
}
|
||||
|
||||
//if we were provided a buffer, then calling this gives us ownership of it
|
||||
void giveBuf() {
|
||||
myBuf = true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void dosync(int c)
|
||||
{
|
||||
size_t wp = tellWrite();
|
||||
size_t rp = tellRead();
|
||||
|
||||
//if we are supposed to insert a character..
|
||||
if(c != -1)
|
||||
{
|
||||
buf[wp] = c;
|
||||
wp++;
|
||||
}
|
||||
|
||||
//the length is determined by the highest character that was ever inserted
|
||||
length = std::max(length,wp);
|
||||
|
||||
//the write window advances to begin at the current write insertion point
|
||||
ww = wp;
|
||||
|
||||
//set the new write and read windows
|
||||
setp(buf+ww, buf + capacity);
|
||||
setg(buf, buf+rp, buf + length);
|
||||
}
|
||||
|
||||
void expand(size_t upto)
|
||||
{
|
||||
if(!myBuf && !usevec)
|
||||
throw new std::runtime_error("memory_streambuf is not expandable");
|
||||
|
||||
size_t newcapacity;
|
||||
if(upto == (size_t)-1)
|
||||
newcapacity = capacity + capacity/2 + 2;
|
||||
else
|
||||
newcapacity = std::max(upto,capacity);
|
||||
|
||||
if(newcapacity == capacity) return;
|
||||
|
||||
//if we are supposed to use the vector, then do it now
|
||||
if(usevec)
|
||||
{
|
||||
usevec->resize(newcapacity);
|
||||
capacity = usevec->size();
|
||||
buf = &(*usevec)[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
//otherwise, manage our own buffer
|
||||
T* newbuf = new T[newcapacity];
|
||||
memcpy(newbuf,buf,capacity);
|
||||
delete[] buf;
|
||||
capacity = newcapacity;
|
||||
buf = newbuf;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
int overflow(int c)
|
||||
{
|
||||
expand((size_t)-1);
|
||||
dosync(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::streambuf::pos_type seekpos(pos_type pos, std::ios::openmode which)
|
||||
{
|
||||
//extend if we are seeking the write cursor
|
||||
if(which & std::ios_base::out)
|
||||
expand(pos);
|
||||
|
||||
sync();
|
||||
|
||||
if(which & std::ios_base::in)
|
||||
setg(buf, buf+pos, buf + length);
|
||||
if(which & std::ios_base::out)
|
||||
{
|
||||
ww = pos;
|
||||
setp(buf+pos, buf + capacity);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
pos_type seekoff(off_type off, std::ios::seekdir way, std::ios::openmode which)
|
||||
{
|
||||
switch(way) {
|
||||
case std::ios::beg:
|
||||
return seekpos(off, which);
|
||||
case std::ios::cur:
|
||||
return seekpos(tell(which)+off, which);
|
||||
case std::ios::end:
|
||||
return seekpos(length+off, which);
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//an iostream that uses the memory_streambuf to effectively act much like a c# memorystream
|
||||
//please call sync() after writing data if you want to read it back
|
||||
class memorystream : public std::basic_iostream<char, std::char_traits<char> >
|
||||
{
|
||||
public:
|
||||
memorystream()
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
{}
|
||||
|
||||
memorystream(int sz)
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
, streambuf(sz)
|
||||
{}
|
||||
|
||||
memorystream(char* usebuf, int buflength)
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
, streambuf(usebuf, buflength)
|
||||
{}
|
||||
|
||||
memorystream(std::vector<char>* usevec)
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
, streambuf(usevec)
|
||||
{}
|
||||
|
||||
//the underlying memory_streambuf
|
||||
memory_streambuf<char> streambuf;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
size_t size() { return streambuf.size(); }
|
||||
char* buf() { return streambuf.getbuf(); }
|
||||
//flushes all the writing state and ensures the stream is ready for reading
|
||||
void sync() { streambuf.sync(); }
|
||||
//rewinds the cursors to offset 0
|
||||
void rewind() { streambuf.seekpos(0,std::ios::in | std::ios::out); }
|
||||
|
||||
//if the memorystream wraps a vector, the vector will be trimmed to the correct size,.
|
||||
//you probably need to use this if you are using the vector wrapper
|
||||
void trim() { streambuf.trim(); }
|
||||
|
||||
void giveBuf() { streambuf.giveBuf(); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef _memorystream_h_
|
||||
#define _memorystream_h_
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
template<typename T>
|
||||
class memory_streambuf: public std::streambuf {
|
||||
private:
|
||||
|
||||
friend class memorystream;
|
||||
|
||||
//the current buffer
|
||||
T* buf;
|
||||
|
||||
//the current allocated capacity of the buffer
|
||||
size_t capacity;
|
||||
|
||||
//whether the sequence is owned by the stringbuf
|
||||
bool myBuf;
|
||||
|
||||
//the logical length of the buffer
|
||||
size_t length;
|
||||
|
||||
//the current 'write window' starting position within the buffer for writing.
|
||||
size_t ww;
|
||||
|
||||
//a vector that we have been told to use
|
||||
std::vector<T>* usevec;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
memory_streambuf(int _capacity)
|
||||
: buf(new T[capacity=_capacity])
|
||||
, myBuf(true)
|
||||
, length(_capacity)
|
||||
, ww(0)
|
||||
, usevec(0)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
|
||||
memory_streambuf()
|
||||
: buf(new T[capacity = 128])
|
||||
, myBuf(true)
|
||||
, length(0)
|
||||
, ww(0)
|
||||
, usevec(0)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
//constructs a non-expandable streambuf around the provided buffer
|
||||
memory_streambuf(T* usebuf, int buflength)
|
||||
: buf(usebuf)
|
||||
, myBuf(false)
|
||||
, length(buflength)
|
||||
, ww(0)
|
||||
, usevec(0)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
//constructs an expandable streambuf around the provided buffer
|
||||
memory_streambuf(std::vector<T>* _usevec)
|
||||
: capacity(_usevec->size())
|
||||
, myBuf(false)
|
||||
, length(_usevec->size())
|
||||
, ww(0)
|
||||
, usevec(_usevec)
|
||||
{
|
||||
if(length>0)
|
||||
buf = &(*_usevec)[0];
|
||||
else buf = 0;
|
||||
|
||||
sync();
|
||||
}
|
||||
|
||||
~memory_streambuf()
|
||||
{
|
||||
//only cleanup if we own the seq
|
||||
if(myBuf) delete[] buf;
|
||||
}
|
||||
|
||||
//the logical length of the buffer
|
||||
size_t size()
|
||||
{
|
||||
sync();
|
||||
return length;
|
||||
}
|
||||
|
||||
//to avoid copying, rebuilds the provided vector and copies the streambuf contents into it
|
||||
void toVector(std::vector<T>& out)
|
||||
{
|
||||
out.resize(length);
|
||||
memcpy(&out[0],buf,length);
|
||||
}
|
||||
|
||||
//maybe the compiler can avoid copying, but maybe not: returns a vector representing the current streambuf
|
||||
std::vector<T> toVector()
|
||||
{
|
||||
return std::vector<T>(buf,buf+length);
|
||||
}
|
||||
|
||||
//if the memorystream wraps a vector, the vector will be trimmed to the correct size,.
|
||||
//you probably need to use this if you are using the vector wrapper
|
||||
void trim()
|
||||
{
|
||||
if(!usevec) return;
|
||||
usevec->resize(size());
|
||||
}
|
||||
|
||||
//tells the current read or write position
|
||||
std::streampos tell(std::ios::openmode which)
|
||||
{
|
||||
if(which == std::ios::in)
|
||||
return tellRead();
|
||||
else if(which == std::ios::out)
|
||||
return tellWrite();
|
||||
else return -1;
|
||||
}
|
||||
|
||||
//tells the current read position
|
||||
std::streampos tellRead()
|
||||
{
|
||||
return gptr()-eback();
|
||||
}
|
||||
|
||||
//tells the current write position
|
||||
std::streampos tellWrite()
|
||||
{
|
||||
return pptr()-pbase() + ww;
|
||||
}
|
||||
|
||||
int sync()
|
||||
{
|
||||
dosync(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
T* getbuf()
|
||||
{
|
||||
sync();
|
||||
return buf;
|
||||
}
|
||||
|
||||
//if we were provided a buffer, then calling this gives us ownership of it
|
||||
void giveBuf() {
|
||||
myBuf = true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void dosync(int c)
|
||||
{
|
||||
size_t wp = tellWrite();
|
||||
size_t rp = tellRead();
|
||||
|
||||
//if we are supposed to insert a character..
|
||||
if(c != -1)
|
||||
{
|
||||
buf[wp] = c;
|
||||
wp++;
|
||||
}
|
||||
|
||||
//the length is determined by the highest character that was ever inserted
|
||||
length = std::max(length,wp);
|
||||
|
||||
//the write window advances to begin at the current write insertion point
|
||||
ww = wp;
|
||||
|
||||
//set the new write and read windows
|
||||
setp(buf+ww, buf + capacity);
|
||||
setg(buf, buf+rp, buf + length);
|
||||
}
|
||||
|
||||
void expand(size_t upto)
|
||||
{
|
||||
if(!myBuf && !usevec)
|
||||
throw new std::runtime_error("memory_streambuf is not expandable");
|
||||
|
||||
size_t newcapacity;
|
||||
if(upto == (size_t)-1)
|
||||
newcapacity = capacity + capacity/2 + 2;
|
||||
else
|
||||
newcapacity = std::max(upto,capacity);
|
||||
|
||||
if(newcapacity == capacity) return;
|
||||
|
||||
//if we are supposed to use the vector, then do it now
|
||||
if(usevec)
|
||||
{
|
||||
usevec->resize(newcapacity);
|
||||
capacity = usevec->size();
|
||||
buf = &(*usevec)[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
//otherwise, manage our own buffer
|
||||
T* newbuf = new T[newcapacity];
|
||||
memcpy(newbuf,buf,capacity);
|
||||
delete[] buf;
|
||||
capacity = newcapacity;
|
||||
buf = newbuf;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
int overflow(int c)
|
||||
{
|
||||
expand((size_t)-1);
|
||||
dosync(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::streambuf::pos_type seekpos(pos_type pos, std::ios::openmode which)
|
||||
{
|
||||
//extend if we are seeking the write cursor
|
||||
if(which & std::ios_base::out)
|
||||
expand(pos);
|
||||
|
||||
sync();
|
||||
|
||||
if(which & std::ios_base::in)
|
||||
setg(buf, buf+pos, buf + length);
|
||||
if(which & std::ios_base::out)
|
||||
{
|
||||
ww = pos;
|
||||
setp(buf+pos, buf + capacity);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
pos_type seekoff(off_type off, std::ios::seekdir way, std::ios::openmode which)
|
||||
{
|
||||
switch(way) {
|
||||
case std::ios::beg:
|
||||
return seekpos(off, which);
|
||||
case std::ios::cur:
|
||||
return seekpos(tell(which)+off, which);
|
||||
case std::ios::end:
|
||||
return seekpos(length+off, which);
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//an iostream that uses the memory_streambuf to effectively act much like a c# memorystream
|
||||
//please call sync() after writing data if you want to read it back
|
||||
class memorystream : public std::basic_iostream<char, std::char_traits<char> >
|
||||
{
|
||||
public:
|
||||
memorystream()
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
{}
|
||||
|
||||
memorystream(int sz)
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
, streambuf(sz)
|
||||
{}
|
||||
|
||||
memorystream(char* usebuf, int buflength)
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
, streambuf(usebuf, buflength)
|
||||
{}
|
||||
|
||||
memorystream(std::vector<char>* usevec)
|
||||
: std::basic_iostream<char, std::char_traits<char> >(&streambuf)
|
||||
, streambuf(usevec)
|
||||
{}
|
||||
|
||||
//the underlying memory_streambuf
|
||||
memory_streambuf<char> streambuf;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
size_t size() { return streambuf.size(); }
|
||||
char* buf() { return streambuf.getbuf(); }
|
||||
//flushes all the writing state and ensures the stream is ready for reading
|
||||
void sync() { streambuf.sync(); }
|
||||
//rewinds the cursors to offset 0
|
||||
void rewind() { streambuf.seekpos(0,std::ios::in | std::ios::out); }
|
||||
|
||||
//if the memorystream wraps a vector, the vector will be trimmed to the correct size,.
|
||||
//you probably need to use this if you are using the vector wrapper
|
||||
void trim() { streambuf.trim(); }
|
||||
|
||||
void giveBuf() { streambuf.giveBuf(); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MIC_H
|
||||
#define MIC_H
|
||||
|
||||
BOOL Mic_Init();
|
||||
void Mic_Reset();
|
||||
void Mic_DeInit();
|
||||
u8 Mic_ReadSample();
|
||||
|
||||
#endif
|
||||
#ifndef MIC_H
|
||||
#define MIC_H
|
||||
|
||||
BOOL Mic_Init();
|
||||
void Mic_Reset();
|
||||
void Mic_DeInit();
|
||||
u8 Mic_ReadSample();
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,183 +1,183 @@
|
|||
#ifndef __MOVIE_H_
|
||||
#define __MOVIE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#include "utils/guid.h"
|
||||
#include "utils/md5.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int movie_version; // version of the movie format in the file
|
||||
u32 num_frames;
|
||||
u32 rerecord_count;
|
||||
bool poweron;
|
||||
u32 emu_version_used;
|
||||
MD5DATA md5_of_rom_used;
|
||||
std::string name_of_rom_used;
|
||||
|
||||
std::vector<std::wstring> comments;
|
||||
} MOVIE_INFO;
|
||||
|
||||
enum EMOVIEMODE
|
||||
{
|
||||
MOVIEMODE_INACTIVE = 1,
|
||||
MOVIEMODE_RECORD = 2,
|
||||
MOVIEMODE_PLAY = 4,
|
||||
};
|
||||
|
||||
enum EMOVIECMD
|
||||
{
|
||||
MOVIECMD_RESET = 1,
|
||||
};
|
||||
|
||||
//RLDUTSBAYXWEG
|
||||
|
||||
class MovieData;
|
||||
class MovieRecord
|
||||
{
|
||||
|
||||
public:
|
||||
u16 pad;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u8 x, y;
|
||||
u8 touch;
|
||||
};
|
||||
|
||||
u32 padding;
|
||||
} touch;
|
||||
|
||||
//misc commands like reset, etc.
|
||||
//small now to save space; we might need to support more commands later.
|
||||
//the disk format will support up to 64bit if necessary
|
||||
uint8 commands;
|
||||
bool command_reset() { return (commands&MOVIECMD_RESET)!=0; }
|
||||
|
||||
void toggleBit(int bit)
|
||||
{
|
||||
pad ^= mask(bit);
|
||||
}
|
||||
|
||||
void setBit(int bit)
|
||||
{
|
||||
pad |= mask(bit);
|
||||
}
|
||||
|
||||
void clearBit(int bit)
|
||||
{
|
||||
pad &= ~mask(bit);
|
||||
}
|
||||
|
||||
void setBitValue(int bit, bool val)
|
||||
{
|
||||
if(val) setBit(bit);
|
||||
else clearBit(bit);
|
||||
}
|
||||
|
||||
bool checkBit(int bit)
|
||||
{
|
||||
return (pad & mask(bit))!=0;
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
//a waste of memory in lots of cases.. maybe make it a pointer later?
|
||||
std::vector<char> savestate;
|
||||
|
||||
void parse(MovieData* md, std::istream* is);
|
||||
//bool parseBinary(MovieData* md, std::istream* is);
|
||||
void dump(MovieData* md, std::ostream* os, int index);
|
||||
//void dumpBinary(MovieData* md, std::ostream* os, int index);
|
||||
void parsePad(std::istream* is, u16& pad);
|
||||
void dumpPad(std::ostream* os, u16 pad);
|
||||
|
||||
static const char mnemonics[13];
|
||||
|
||||
private:
|
||||
int mask(int bit) { return 1<<bit; }
|
||||
};
|
||||
|
||||
|
||||
class MovieData
|
||||
{
|
||||
public:
|
||||
MovieData();
|
||||
|
||||
|
||||
int version;
|
||||
int emuVersion;
|
||||
//todo - somehow force mutual exclusion for poweron and reset (with an error in the parser)
|
||||
|
||||
MD5DATA romChecksum;
|
||||
std::string romFilename;
|
||||
std::vector<char> savestate;
|
||||
std::vector<MovieRecord> records;
|
||||
std::vector<std::wstring> comments;
|
||||
|
||||
int rerecordCount;
|
||||
Desmume_Guid guid;
|
||||
|
||||
//was the frame data stored in binary?
|
||||
bool binaryFlag;
|
||||
|
||||
int getNumRecords() { return records.size(); }
|
||||
|
||||
class TDictionary : public std::map<std::string,std::string>
|
||||
{
|
||||
public:
|
||||
bool containsKey(std::string key)
|
||||
{
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
void tryInstallBool(std::string key, bool& val)
|
||||
{
|
||||
if(containsKey(key))
|
||||
val = atoi(operator [](key).c_str())!=0;
|
||||
}
|
||||
|
||||
void tryInstallString(std::string key, std::string& val)
|
||||
{
|
||||
if(containsKey(key))
|
||||
val = operator [](key);
|
||||
}
|
||||
|
||||
void tryInstallInt(std::string key, int& val)
|
||||
{
|
||||
if(containsKey(key))
|
||||
val = atoi(operator [](key).c_str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void truncateAt(int frame);
|
||||
void installValue(std::string& key, std::string& val);
|
||||
int dump(std::ostream* os, bool binary);
|
||||
void clearRecordRange(int start, int len);
|
||||
void insertEmpty(int at, int frames);
|
||||
|
||||
static bool loadSavestateFrom(std::vector<char>* buf);
|
||||
static void dumpSavestateTo(std::vector<char>* buf, int compressionLevel);
|
||||
//void TryDumpIncremental();
|
||||
|
||||
private:
|
||||
void installInt(std::string& val, int& var)
|
||||
{
|
||||
var = atoi(val.c_str());
|
||||
}
|
||||
|
||||
void installBool(std::string& val, bool& var)
|
||||
{
|
||||
var = atoi(val.c_str())!=0;
|
||||
}
|
||||
};
|
||||
|
||||
bool FCEUI_MovieGetInfo(std::istream* fp, MOVIE_INFO& info, bool skipFrameCount);
|
||||
|
||||
#endif
|
||||
#ifndef __MOVIE_H_
|
||||
#define __MOVIE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#include "utils/guid.h"
|
||||
#include "utils/md5.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int movie_version; // version of the movie format in the file
|
||||
u32 num_frames;
|
||||
u32 rerecord_count;
|
||||
bool poweron;
|
||||
u32 emu_version_used;
|
||||
MD5DATA md5_of_rom_used;
|
||||
std::string name_of_rom_used;
|
||||
|
||||
std::vector<std::wstring> comments;
|
||||
} MOVIE_INFO;
|
||||
|
||||
enum EMOVIEMODE
|
||||
{
|
||||
MOVIEMODE_INACTIVE = 1,
|
||||
MOVIEMODE_RECORD = 2,
|
||||
MOVIEMODE_PLAY = 4,
|
||||
};
|
||||
|
||||
enum EMOVIECMD
|
||||
{
|
||||
MOVIECMD_RESET = 1,
|
||||
};
|
||||
|
||||
//RLDUTSBAYXWEG
|
||||
|
||||
class MovieData;
|
||||
class MovieRecord
|
||||
{
|
||||
|
||||
public:
|
||||
u16 pad;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u8 x, y;
|
||||
u8 touch;
|
||||
};
|
||||
|
||||
u32 padding;
|
||||
} touch;
|
||||
|
||||
//misc commands like reset, etc.
|
||||
//small now to save space; we might need to support more commands later.
|
||||
//the disk format will support up to 64bit if necessary
|
||||
uint8 commands;
|
||||
bool command_reset() { return (commands&MOVIECMD_RESET)!=0; }
|
||||
|
||||
void toggleBit(int bit)
|
||||
{
|
||||
pad ^= mask(bit);
|
||||
}
|
||||
|
||||
void setBit(int bit)
|
||||
{
|
||||
pad |= mask(bit);
|
||||
}
|
||||
|
||||
void clearBit(int bit)
|
||||
{
|
||||
pad &= ~mask(bit);
|
||||
}
|
||||
|
||||
void setBitValue(int bit, bool val)
|
||||
{
|
||||
if(val) setBit(bit);
|
||||
else clearBit(bit);
|
||||
}
|
||||
|
||||
bool checkBit(int bit)
|
||||
{
|
||||
return (pad & mask(bit))!=0;
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
//a waste of memory in lots of cases.. maybe make it a pointer later?
|
||||
std::vector<char> savestate;
|
||||
|
||||
void parse(MovieData* md, std::istream* is);
|
||||
//bool parseBinary(MovieData* md, std::istream* is);
|
||||
void dump(MovieData* md, std::ostream* os, int index);
|
||||
//void dumpBinary(MovieData* md, std::ostream* os, int index);
|
||||
void parsePad(std::istream* is, u16& pad);
|
||||
void dumpPad(std::ostream* os, u16 pad);
|
||||
|
||||
static const char mnemonics[13];
|
||||
|
||||
private:
|
||||
int mask(int bit) { return 1<<bit; }
|
||||
};
|
||||
|
||||
|
||||
class MovieData
|
||||
{
|
||||
public:
|
||||
MovieData();
|
||||
|
||||
|
||||
int version;
|
||||
int emuVersion;
|
||||
//todo - somehow force mutual exclusion for poweron and reset (with an error in the parser)
|
||||
|
||||
MD5DATA romChecksum;
|
||||
std::string romFilename;
|
||||
std::vector<char> savestate;
|
||||
std::vector<MovieRecord> records;
|
||||
std::vector<std::wstring> comments;
|
||||
|
||||
int rerecordCount;
|
||||
Desmume_Guid guid;
|
||||
|
||||
//was the frame data stored in binary?
|
||||
bool binaryFlag;
|
||||
|
||||
int getNumRecords() { return records.size(); }
|
||||
|
||||
class TDictionary : public std::map<std::string,std::string>
|
||||
{
|
||||
public:
|
||||
bool containsKey(std::string key)
|
||||
{
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
void tryInstallBool(std::string key, bool& val)
|
||||
{
|
||||
if(containsKey(key))
|
||||
val = atoi(operator [](key).c_str())!=0;
|
||||
}
|
||||
|
||||
void tryInstallString(std::string key, std::string& val)
|
||||
{
|
||||
if(containsKey(key))
|
||||
val = operator [](key);
|
||||
}
|
||||
|
||||
void tryInstallInt(std::string key, int& val)
|
||||
{
|
||||
if(containsKey(key))
|
||||
val = atoi(operator [](key).c_str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void truncateAt(int frame);
|
||||
void installValue(std::string& key, std::string& val);
|
||||
int dump(std::ostream* os, bool binary);
|
||||
void clearRecordRange(int start, int len);
|
||||
void insertEmpty(int at, int frames);
|
||||
|
||||
static bool loadSavestateFrom(std::vector<char>* buf);
|
||||
static void dumpSavestateTo(std::vector<char>* buf, int compressionLevel);
|
||||
//void TryDumpIncremental();
|
||||
|
||||
private:
|
||||
void installInt(std::string& val, int& var)
|
||||
{
|
||||
var = atoi(val.c_str());
|
||||
}
|
||||
|
||||
void installBool(std::string& val, bool& var)
|
||||
{
|
||||
var = atoi(val.c_str())!=0;
|
||||
}
|
||||
};
|
||||
|
||||
bool FCEUI_MovieGetInfo(std::istream* fp, MOVIE_INFO& info, bool skipFrameCount);
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,31 +1,31 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
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;
|
||||
|
||||
#endif
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
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;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,157 +1,157 @@
|
|||
/* readwrite.cpp
|
||||
*
|
||||
* Copyright (C) 2006-2008 Zeromus
|
||||
*
|
||||
* 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 "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)
|
||||
{
|
||||
u8 s[2];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
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)
|
||||
{
|
||||
u8 s[4];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
return((fwrite(s,1,4,fp)<4)?0:4);
|
||||
}
|
||||
|
||||
int write32le(u32 b, std::ostream* os)
|
||||
{
|
||||
u8 s[4];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
os->write((char*)&s,4);
|
||||
return 4;
|
||||
}
|
||||
|
||||
int write64le(u64 b, std::ostream* os)
|
||||
{
|
||||
u8 s[8];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
s[4]=b>>32;
|
||||
s[5]=b>>40;
|
||||
s[6]=b>>48;
|
||||
s[7]=b>>56;
|
||||
os->write((char*)&s,8);
|
||||
return 8;
|
||||
}
|
||||
|
||||
|
||||
///reads a little endian 32bit value from the specified file
|
||||
int read32le(u32 *Bufo, FILE *fp)
|
||||
{
|
||||
u32 buf;
|
||||
if(fread(&buf,1,4,fp)<4)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*(u32*)Bufo=buf;
|
||||
#else
|
||||
*(u32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read16le(u16 *Bufo, std::istream *is)
|
||||
{
|
||||
u16 buf;
|
||||
if(is->read((char*)&buf,2).gcount() != 2)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*Bufo=buf;
|
||||
#else
|
||||
*Bufo = LE_TO_LOCAL_16(buf);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
///reads a little endian 64bit value from the specified file
|
||||
int read64le(u64 *Bufo, std::istream *is)
|
||||
{
|
||||
u64 buf;
|
||||
if(is->read((char*)&buf,8).gcount() != 8)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*Bufo=buf;
|
||||
#else
|
||||
*Bufo = LE_TO_LOCAL_64(buf);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read32le(u32 *Bufo, std::istream *is)
|
||||
{
|
||||
u32 buf;
|
||||
if(is->read((char*)&buf,4).gcount() != 4)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*(u32*)Bufo=buf;
|
||||
#else
|
||||
*(u32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* readwrite.cpp
|
||||
*
|
||||
* Copyright (C) 2006-2008 Zeromus
|
||||
*
|
||||
* 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 "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)
|
||||
{
|
||||
u8 s[2];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
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)
|
||||
{
|
||||
u8 s[4];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
return((fwrite(s,1,4,fp)<4)?0:4);
|
||||
}
|
||||
|
||||
int write32le(u32 b, std::ostream* os)
|
||||
{
|
||||
u8 s[4];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
os->write((char*)&s,4);
|
||||
return 4;
|
||||
}
|
||||
|
||||
int write64le(u64 b, std::ostream* os)
|
||||
{
|
||||
u8 s[8];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
s[4]=b>>32;
|
||||
s[5]=b>>40;
|
||||
s[6]=b>>48;
|
||||
s[7]=b>>56;
|
||||
os->write((char*)&s,8);
|
||||
return 8;
|
||||
}
|
||||
|
||||
|
||||
///reads a little endian 32bit value from the specified file
|
||||
int read32le(u32 *Bufo, FILE *fp)
|
||||
{
|
||||
u32 buf;
|
||||
if(fread(&buf,1,4,fp)<4)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*(u32*)Bufo=buf;
|
||||
#else
|
||||
*(u32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read16le(u16 *Bufo, std::istream *is)
|
||||
{
|
||||
u16 buf;
|
||||
if(is->read((char*)&buf,2).gcount() != 2)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*Bufo=buf;
|
||||
#else
|
||||
*Bufo = LE_TO_LOCAL_16(buf);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
///reads a little endian 64bit value from the specified file
|
||||
int read64le(u64 *Bufo, std::istream *is)
|
||||
{
|
||||
u64 buf;
|
||||
if(is->read((char*)&buf,8).gcount() != 8)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*Bufo=buf;
|
||||
#else
|
||||
*Bufo = LE_TO_LOCAL_64(buf);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read32le(u32 *Bufo, std::istream *is)
|
||||
{
|
||||
u32 buf;
|
||||
if(is->read((char*)&buf,4).gcount() != 4)
|
||||
return 0;
|
||||
#ifdef LOCAL_LE
|
||||
*(u32*)Bufo=buf;
|
||||
#else
|
||||
*(u32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
#ifndef _READWRITE_H_
|
||||
#define _READWRITE_H_
|
||||
|
||||
#include "types.h"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
//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);
|
||||
|
||||
#endif
|
||||
#ifndef _READWRITE_H_
|
||||
#define _READWRITE_H_
|
||||
|
||||
#include "types.h"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
//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);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,289 +1,289 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 2008 CrazyMax
|
||||
Copyright 2008-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
|
||||
*/
|
||||
|
||||
// TODO: interrupt handler
|
||||
|
||||
#include "rtc.h"
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "armcpu.h"
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// RTC registers
|
||||
u8 regStatus1;
|
||||
u8 regStatus2;
|
||||
u8 regAdjustment;
|
||||
u8 regFree;
|
||||
|
||||
// BUS
|
||||
u8 _prevSCK;
|
||||
u8 _prevCS;
|
||||
u8 _prevSIO;
|
||||
u8 _SCK;
|
||||
u8 _CS;
|
||||
u8 _SIO;
|
||||
u8 _DD;
|
||||
u16 _REG;
|
||||
|
||||
// command & data
|
||||
u8 cmd;
|
||||
u8 cmdStat;
|
||||
u8 bitsCount;
|
||||
u8 data[8];
|
||||
} _RTC;
|
||||
|
||||
_RTC rtc;
|
||||
|
||||
u8 cmdBitsSize[8] = {8, 8, 56, 24, 0, 24, 8, 8};
|
||||
|
||||
#define toBCD(x) ((x / 10) << 4) | (x % 10);
|
||||
|
||||
static void rtcRecv()
|
||||
{
|
||||
//INFO("RTC Read command 0x%02X\n", (rtc.cmd >> 1));
|
||||
memset(rtc.data, 0, sizeof(rtc.data));
|
||||
switch (rtc.cmd >> 1)
|
||||
{
|
||||
case 0: // status register 1
|
||||
//INFO("RTC: read regstatus1 (0x%02X)\n", rtc.regStatus1);
|
||||
rtc.regStatus1 &= 0x0F;
|
||||
rtc.data[0] = rtc.regStatus1;
|
||||
//rtc.regStatus1 &= 0x7F;
|
||||
break;
|
||||
case 1: // status register 2
|
||||
//INFO("RTC: read regstatus2 (0x%02X)\n", rtc.regStatus1);
|
||||
rtc.data[0] = rtc.regStatus2;
|
||||
break;
|
||||
case 2: // date & time
|
||||
{
|
||||
//INFO("RTC: read date & time\n");
|
||||
time_t tm;
|
||||
time(&tm);
|
||||
struct tm *tm_local= localtime(&tm);
|
||||
tm_local->tm_year %= 100;
|
||||
tm_local->tm_mon++;
|
||||
rtc.data[0] = toBCD(tm_local->tm_year);
|
||||
rtc.data[1] = toBCD(tm_local->tm_mon);
|
||||
rtc.data[2] = toBCD(tm_local->tm_mday);
|
||||
rtc.data[3] = (tm_local->tm_wday + 6) & 7;
|
||||
if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12;
|
||||
rtc.data[4] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour);
|
||||
rtc.data[5] = toBCD(tm_local->tm_min);
|
||||
rtc.data[6] = toBCD(tm_local->tm_sec);
|
||||
break;
|
||||
}
|
||||
case 3: // time
|
||||
{
|
||||
//INFO("RTC: read time\n");
|
||||
time_t tm;
|
||||
time(&tm);
|
||||
struct tm *tm_local= localtime(&tm);
|
||||
if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12;
|
||||
rtc.data[0] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour);
|
||||
rtc.data[1] = toBCD(tm_local->tm_min);
|
||||
rtc.data[2] = toBCD(tm_local->tm_sec);
|
||||
break;
|
||||
}
|
||||
case 4: // freq/alarm 1
|
||||
/*if (cmdBitsSize[0x04] == 8)
|
||||
INFO("RTC: read INT1 freq\n");
|
||||
else
|
||||
INFO("RTC: read INT1 alarm1\n");*/
|
||||
//NDS_makeARM7Int(7);
|
||||
break;
|
||||
case 5: // alarm 2
|
||||
//INFO("RTC: read alarm 2\n");
|
||||
break;
|
||||
case 6: // clock adjust
|
||||
//INFO("RTC: read clock adjust\n");
|
||||
rtc.data[0] = rtc.regAdjustment;
|
||||
break;
|
||||
case 7: // free register
|
||||
//INFO("RTC: read free register\n");
|
||||
rtc.data[0] = rtc.regFree;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtcSend()
|
||||
{
|
||||
//INFO("RTC write 0x%02X\n", (rtc.cmd >> 1));
|
||||
switch (rtc.cmd >> 1)
|
||||
{
|
||||
case 0: // status register 1
|
||||
//INFO("RTC: write regstatus1 0x%02X\n", rtc.data[0]);
|
||||
// rtc.regStatus1 &= 0xF1;
|
||||
// rtc.regStatus1 |= (rtc.data[0] | 0x0E);
|
||||
rtc.regStatus1 = rtc.data[0];
|
||||
break;
|
||||
case 1: // status register 2
|
||||
//INFO("RTC: write regstatus2 0x%02X\n", rtc.data[0]);
|
||||
rtc.regStatus2 = rtc.data[0];
|
||||
break;
|
||||
case 2: // date & time
|
||||
//INFO("RTC: write date & time : %02X %02X %02X %02X %02X %02X %02X\n", rtc.data[0], rtc.data[1], rtc.data[2], rtc.data[3], rtc.data[4], rtc.data[5], rtc.data[6]);
|
||||
break;
|
||||
case 3: // time
|
||||
//INFO("RTC: write time : %02X %02X %02X\n", rtc.data[0], rtc.data[1], rtc.data[2]);
|
||||
break;
|
||||
case 4: // freq/alarm 1
|
||||
/*if (cmdBitsSize[0x04] == 8)
|
||||
INFO("RTC: write INT1 freq 0x%02X\n", rtc.data[0]);
|
||||
else
|
||||
INFO("RTC: write INT1 alarm1 0x%02X\n", rtc.data[0]);*/
|
||||
break;
|
||||
case 5: // alarm 2
|
||||
//INFO("RTC: write alarm 2\n");
|
||||
break;
|
||||
case 6: // clock adjust
|
||||
//INFO("RTC: write clock adjust\n");
|
||||
rtc.regAdjustment = rtc.data[0];
|
||||
break;
|
||||
case 7: // free register
|
||||
//INFO("RTC: write free register\n");
|
||||
rtc.regFree = rtc.data[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtcInit()
|
||||
{
|
||||
memset(&rtc, 0, sizeof(_RTC));
|
||||
rtc.regStatus1 |= 0x02;
|
||||
}
|
||||
|
||||
u16 rtcRead()
|
||||
{
|
||||
//INFO("MMU Read RTC 0x%02X (%03i)\n", rtc._REG, rtc.bitsCount);
|
||||
return (rtc._REG);
|
||||
}
|
||||
|
||||
void rtcWrite(u16 val)
|
||||
{
|
||||
//INFO("MMU Write RTC 0x%02X (%03i)\n", val, rtc.bitsCount);
|
||||
rtc._DD = (val & 0x10) >> 4;
|
||||
rtc._SIO = rtc._DD?(val & 0x01):rtc._prevSIO;
|
||||
rtc._SCK = (val & 0x20)?((val & 0x02) >> 1):rtc._prevSCK;
|
||||
rtc._CS = (val & 0x40)?((val & 0x04) >> 2):rtc._prevCS;
|
||||
|
||||
switch (rtc.cmdStat)
|
||||
{
|
||||
case 0:
|
||||
if ( (!rtc._prevCS) && (rtc._prevSCK) && (rtc._CS) && (rtc._SCK) )
|
||||
{
|
||||
rtc.cmdStat = 1;
|
||||
rtc.bitsCount = 0;
|
||||
rtc.cmd = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (!rtc._CS)
|
||||
{
|
||||
rtc.cmdStat = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rtc._SCK && rtc._DD) break;
|
||||
if (!rtc._SCK && !rtc._DD) break;
|
||||
|
||||
rtc.cmd |= (rtc._SIO << rtc.bitsCount );
|
||||
rtc.bitsCount ++;
|
||||
if (rtc.bitsCount == 8)
|
||||
{
|
||||
//INFO("RTC command 0x%02X\n", rtc.cmd);
|
||||
|
||||
// Little-endian command
|
||||
if((rtc.cmd & 0x0F) == 0x06)
|
||||
{
|
||||
u8 tmp = rtc.cmd;
|
||||
rtc.cmd = ((tmp & 0x80) >> 7) | ((tmp & 0x40) >> 5) | ((tmp & 0x20) >> 3) | ((tmp & 0x10) >> 1);
|
||||
}
|
||||
// Big-endian command
|
||||
else
|
||||
{
|
||||
rtc.cmd &= 0x0F;
|
||||
}
|
||||
|
||||
if((rtc._prevSCK) && (!rtc._SCK))
|
||||
{
|
||||
rtc.bitsCount = 0;
|
||||
if ((rtc.cmd >> 1) == 0x04)
|
||||
{
|
||||
if ((rtc.regStatus2 & 0x0F) == 0x04)
|
||||
cmdBitsSize[rtc.cmd >> 1] = 24;
|
||||
else
|
||||
cmdBitsSize[rtc.cmd >> 1] = 8;
|
||||
}
|
||||
if (rtc.cmd & 0x01)
|
||||
{
|
||||
rtc.cmdStat = 4;
|
||||
rtcRecv();
|
||||
}
|
||||
else
|
||||
{
|
||||
rtc.cmdStat = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: // write:
|
||||
if( (rtc._prevSCK) && (!rtc._SCK) )
|
||||
{
|
||||
if(rtc._SIO) rtc.data[rtc.bitsCount >> 3] |= (1 << (rtc.bitsCount & 0x07));
|
||||
rtc.bitsCount++;
|
||||
if (rtc.bitsCount == cmdBitsSize[rtc.cmd >> 1])
|
||||
{
|
||||
rtcSend();
|
||||
rtc.cmdStat = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // read:
|
||||
if( (rtc._prevSCK) && (!rtc._SCK) )
|
||||
{
|
||||
rtc._REG = val;
|
||||
if(rtc.data[rtc.bitsCount >> 3] >> (rtc.bitsCount & 0x07) & 0x01)
|
||||
rtc._REG |= 0x01;
|
||||
else
|
||||
rtc._REG &= ~0x01;
|
||||
|
||||
rtc.bitsCount++;
|
||||
if (rtc.bitsCount == cmdBitsSize[rtc.cmd >> 1])
|
||||
rtc.cmdStat = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
rtc._prevSIO = rtc._SIO;
|
||||
rtc._prevSCK = rtc._SCK;
|
||||
rtc._prevCS = rtc._CS;
|
||||
}
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 2008 CrazyMax
|
||||
Copyright 2008-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
|
||||
*/
|
||||
|
||||
// TODO: interrupt handler
|
||||
|
||||
#include "rtc.h"
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "armcpu.h"
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// RTC registers
|
||||
u8 regStatus1;
|
||||
u8 regStatus2;
|
||||
u8 regAdjustment;
|
||||
u8 regFree;
|
||||
|
||||
// BUS
|
||||
u8 _prevSCK;
|
||||
u8 _prevCS;
|
||||
u8 _prevSIO;
|
||||
u8 _SCK;
|
||||
u8 _CS;
|
||||
u8 _SIO;
|
||||
u8 _DD;
|
||||
u16 _REG;
|
||||
|
||||
// command & data
|
||||
u8 cmd;
|
||||
u8 cmdStat;
|
||||
u8 bitsCount;
|
||||
u8 data[8];
|
||||
} _RTC;
|
||||
|
||||
_RTC rtc;
|
||||
|
||||
u8 cmdBitsSize[8] = {8, 8, 56, 24, 0, 24, 8, 8};
|
||||
|
||||
#define toBCD(x) ((x / 10) << 4) | (x % 10);
|
||||
|
||||
static void rtcRecv()
|
||||
{
|
||||
//INFO("RTC Read command 0x%02X\n", (rtc.cmd >> 1));
|
||||
memset(rtc.data, 0, sizeof(rtc.data));
|
||||
switch (rtc.cmd >> 1)
|
||||
{
|
||||
case 0: // status register 1
|
||||
//INFO("RTC: read regstatus1 (0x%02X)\n", rtc.regStatus1);
|
||||
rtc.regStatus1 &= 0x0F;
|
||||
rtc.data[0] = rtc.regStatus1;
|
||||
//rtc.regStatus1 &= 0x7F;
|
||||
break;
|
||||
case 1: // status register 2
|
||||
//INFO("RTC: read regstatus2 (0x%02X)\n", rtc.regStatus1);
|
||||
rtc.data[0] = rtc.regStatus2;
|
||||
break;
|
||||
case 2: // date & time
|
||||
{
|
||||
//INFO("RTC: read date & time\n");
|
||||
time_t tm;
|
||||
time(&tm);
|
||||
struct tm *tm_local= localtime(&tm);
|
||||
tm_local->tm_year %= 100;
|
||||
tm_local->tm_mon++;
|
||||
rtc.data[0] = toBCD(tm_local->tm_year);
|
||||
rtc.data[1] = toBCD(tm_local->tm_mon);
|
||||
rtc.data[2] = toBCD(tm_local->tm_mday);
|
||||
rtc.data[3] = (tm_local->tm_wday + 6) & 7;
|
||||
if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12;
|
||||
rtc.data[4] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour);
|
||||
rtc.data[5] = toBCD(tm_local->tm_min);
|
||||
rtc.data[6] = toBCD(tm_local->tm_sec);
|
||||
break;
|
||||
}
|
||||
case 3: // time
|
||||
{
|
||||
//INFO("RTC: read time\n");
|
||||
time_t tm;
|
||||
time(&tm);
|
||||
struct tm *tm_local= localtime(&tm);
|
||||
if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12;
|
||||
rtc.data[0] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour);
|
||||
rtc.data[1] = toBCD(tm_local->tm_min);
|
||||
rtc.data[2] = toBCD(tm_local->tm_sec);
|
||||
break;
|
||||
}
|
||||
case 4: // freq/alarm 1
|
||||
/*if (cmdBitsSize[0x04] == 8)
|
||||
INFO("RTC: read INT1 freq\n");
|
||||
else
|
||||
INFO("RTC: read INT1 alarm1\n");*/
|
||||
//NDS_makeARM7Int(7);
|
||||
break;
|
||||
case 5: // alarm 2
|
||||
//INFO("RTC: read alarm 2\n");
|
||||
break;
|
||||
case 6: // clock adjust
|
||||
//INFO("RTC: read clock adjust\n");
|
||||
rtc.data[0] = rtc.regAdjustment;
|
||||
break;
|
||||
case 7: // free register
|
||||
//INFO("RTC: read free register\n");
|
||||
rtc.data[0] = rtc.regFree;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtcSend()
|
||||
{
|
||||
//INFO("RTC write 0x%02X\n", (rtc.cmd >> 1));
|
||||
switch (rtc.cmd >> 1)
|
||||
{
|
||||
case 0: // status register 1
|
||||
//INFO("RTC: write regstatus1 0x%02X\n", rtc.data[0]);
|
||||
// rtc.regStatus1 &= 0xF1;
|
||||
// rtc.regStatus1 |= (rtc.data[0] | 0x0E);
|
||||
rtc.regStatus1 = rtc.data[0];
|
||||
break;
|
||||
case 1: // status register 2
|
||||
//INFO("RTC: write regstatus2 0x%02X\n", rtc.data[0]);
|
||||
rtc.regStatus2 = rtc.data[0];
|
||||
break;
|
||||
case 2: // date & time
|
||||
//INFO("RTC: write date & time : %02X %02X %02X %02X %02X %02X %02X\n", rtc.data[0], rtc.data[1], rtc.data[2], rtc.data[3], rtc.data[4], rtc.data[5], rtc.data[6]);
|
||||
break;
|
||||
case 3: // time
|
||||
//INFO("RTC: write time : %02X %02X %02X\n", rtc.data[0], rtc.data[1], rtc.data[2]);
|
||||
break;
|
||||
case 4: // freq/alarm 1
|
||||
/*if (cmdBitsSize[0x04] == 8)
|
||||
INFO("RTC: write INT1 freq 0x%02X\n", rtc.data[0]);
|
||||
else
|
||||
INFO("RTC: write INT1 alarm1 0x%02X\n", rtc.data[0]);*/
|
||||
break;
|
||||
case 5: // alarm 2
|
||||
//INFO("RTC: write alarm 2\n");
|
||||
break;
|
||||
case 6: // clock adjust
|
||||
//INFO("RTC: write clock adjust\n");
|
||||
rtc.regAdjustment = rtc.data[0];
|
||||
break;
|
||||
case 7: // free register
|
||||
//INFO("RTC: write free register\n");
|
||||
rtc.regFree = rtc.data[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtcInit()
|
||||
{
|
||||
memset(&rtc, 0, sizeof(_RTC));
|
||||
rtc.regStatus1 |= 0x02;
|
||||
}
|
||||
|
||||
u16 rtcRead()
|
||||
{
|
||||
//INFO("MMU Read RTC 0x%02X (%03i)\n", rtc._REG, rtc.bitsCount);
|
||||
return (rtc._REG);
|
||||
}
|
||||
|
||||
void rtcWrite(u16 val)
|
||||
{
|
||||
//INFO("MMU Write RTC 0x%02X (%03i)\n", val, rtc.bitsCount);
|
||||
rtc._DD = (val & 0x10) >> 4;
|
||||
rtc._SIO = rtc._DD?(val & 0x01):rtc._prevSIO;
|
||||
rtc._SCK = (val & 0x20)?((val & 0x02) >> 1):rtc._prevSCK;
|
||||
rtc._CS = (val & 0x40)?((val & 0x04) >> 2):rtc._prevCS;
|
||||
|
||||
switch (rtc.cmdStat)
|
||||
{
|
||||
case 0:
|
||||
if ( (!rtc._prevCS) && (rtc._prevSCK) && (rtc._CS) && (rtc._SCK) )
|
||||
{
|
||||
rtc.cmdStat = 1;
|
||||
rtc.bitsCount = 0;
|
||||
rtc.cmd = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (!rtc._CS)
|
||||
{
|
||||
rtc.cmdStat = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rtc._SCK && rtc._DD) break;
|
||||
if (!rtc._SCK && !rtc._DD) break;
|
||||
|
||||
rtc.cmd |= (rtc._SIO << rtc.bitsCount );
|
||||
rtc.bitsCount ++;
|
||||
if (rtc.bitsCount == 8)
|
||||
{
|
||||
//INFO("RTC command 0x%02X\n", rtc.cmd);
|
||||
|
||||
// Little-endian command
|
||||
if((rtc.cmd & 0x0F) == 0x06)
|
||||
{
|
||||
u8 tmp = rtc.cmd;
|
||||
rtc.cmd = ((tmp & 0x80) >> 7) | ((tmp & 0x40) >> 5) | ((tmp & 0x20) >> 3) | ((tmp & 0x10) >> 1);
|
||||
}
|
||||
// Big-endian command
|
||||
else
|
||||
{
|
||||
rtc.cmd &= 0x0F;
|
||||
}
|
||||
|
||||
if((rtc._prevSCK) && (!rtc._SCK))
|
||||
{
|
||||
rtc.bitsCount = 0;
|
||||
if ((rtc.cmd >> 1) == 0x04)
|
||||
{
|
||||
if ((rtc.regStatus2 & 0x0F) == 0x04)
|
||||
cmdBitsSize[rtc.cmd >> 1] = 24;
|
||||
else
|
||||
cmdBitsSize[rtc.cmd >> 1] = 8;
|
||||
}
|
||||
if (rtc.cmd & 0x01)
|
||||
{
|
||||
rtc.cmdStat = 4;
|
||||
rtcRecv();
|
||||
}
|
||||
else
|
||||
{
|
||||
rtc.cmdStat = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: // write:
|
||||
if( (rtc._prevSCK) && (!rtc._SCK) )
|
||||
{
|
||||
if(rtc._SIO) rtc.data[rtc.bitsCount >> 3] |= (1 << (rtc.bitsCount & 0x07));
|
||||
rtc.bitsCount++;
|
||||
if (rtc.bitsCount == cmdBitsSize[rtc.cmd >> 1])
|
||||
{
|
||||
rtcSend();
|
||||
rtc.cmdStat = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // read:
|
||||
if( (rtc._prevSCK) && (!rtc._SCK) )
|
||||
{
|
||||
rtc._REG = val;
|
||||
if(rtc.data[rtc.bitsCount >> 3] >> (rtc.bitsCount & 0x07) & 0x01)
|
||||
rtc._REG |= 0x01;
|
||||
else
|
||||
rtc._REG &= ~0x01;
|
||||
|
||||
rtc.bitsCount++;
|
||||
if (rtc.bitsCount == cmdBitsSize[rtc.cmd >> 1])
|
||||
rtc.cmdStat = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
rtc._prevSIO = rtc._SIO;
|
||||
rtc._prevSCK = rtc._SCK;
|
||||
rtc._prevCS = rtc._CS;
|
||||
}
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 2008 CrazyMax
|
||||
Copyright 2008-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 _RTC_H_
|
||||
#define _RTC_H_
|
||||
#include <stdlib.h>
|
||||
#include "types.h"
|
||||
|
||||
extern void rtcInit();
|
||||
extern u16 rtcRead();
|
||||
extern void rtcWrite(u16 val);
|
||||
#endif
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 2008 CrazyMax
|
||||
Copyright 2008-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 _RTC_H_
|
||||
#define _RTC_H_
|
||||
#include <stdlib.h>
|
||||
#include "types.h"
|
||||
|
||||
extern void rtcInit();
|
||||
extern u16 rtcRead();
|
||||
extern void rtcWrite(u16 val);
|
||||
#endif
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
/* Predefined OpenGL shaders */
|
||||
|
||||
/* Vertex shader */
|
||||
const char *vertexShader = {"\
|
||||
void main() \n\
|
||||
{ \n\
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n\
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; \n\
|
||||
gl_FrontColor = gl_Color; \n\
|
||||
} \n\
|
||||
"};
|
||||
|
||||
/* Fragment shader */
|
||||
const char *fragmentShader = {"\
|
||||
uniform sampler1D toonTable; \n\
|
||||
uniform sampler2D tex2d; \n\
|
||||
uniform int hasTexture; \n\
|
||||
uniform int texBlending; \n\
|
||||
\n\
|
||||
vec4 float_to_6bit(in vec4 color) \n\
|
||||
{ \n\
|
||||
vec4 ret = color * vec4(31.0,31.0,31.0,31.0);\n\
|
||||
\n\
|
||||
if(ret.r > 0.0) ret.r = (ret.r * 2.0) + 1.0; \n\
|
||||
if(ret.g > 0.0) ret.g = (ret.g * 2.0) + 1.0; \n\
|
||||
if(ret.b > 0.0) ret.b = (ret.b * 2.0) + 1.0; \n\
|
||||
if(ret.a > 0.0) ret.a = (ret.a * 2.0) + 1.0; \n\
|
||||
\n\
|
||||
return ret; \n\
|
||||
} \n\
|
||||
\n\
|
||||
void main() \n\
|
||||
{ \n\
|
||||
vec4 vtxColor = float_to_6bit(gl_Color); \n\
|
||||
vec4 texColor = float_to_6bit(texture2D(tex2d, gl_TexCoord[0].st)); \n\
|
||||
vec3 toonColor = vec3(float_to_6bit(vec4(texture1D(toonTable, gl_Color.r).rgb, 0.0))); \n\
|
||||
vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n\
|
||||
\n\
|
||||
if(hasTexture == 0) \n\
|
||||
{ \n\
|
||||
texColor = vec4(63.0, 63.0, 63.0, 63.0); \n\
|
||||
} \n\
|
||||
\n\
|
||||
if(texBlending == 0) \n\
|
||||
{ \n\
|
||||
fragColor = ((texColor + 1.0) * (vtxColor + 1.0) - 1.0) / 64.0; \n\
|
||||
} \n\
|
||||
else if(texBlending == 1) \n\
|
||||
{ \n\
|
||||
if(texColor.a == 0.0 || hasTexture == 0) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = vtxColor.rgb; \n\
|
||||
} \n\
|
||||
else if(texColor.a == 63.0) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = texColor.rgb; \n\
|
||||
} \n\
|
||||
else \n\
|
||||
{ \n\
|
||||
fragColor.rgb = ((texColor.rgb * texColor.a) + (vtxColor.rgb * (63.0 - texColor.a))) / 64.0; \n\
|
||||
} \n\
|
||||
\n\
|
||||
fragColor.a = vtxColor.a; \n\
|
||||
} \n\
|
||||
else if(texBlending == 2) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = ((texColor.rgb + 1.0) * (toonColor + 1.0) - 1.0) / 64.0; \n\
|
||||
fragColor.a = ((texColor.a + 1.0) * (vtxColor.a + 1.0) - 1.0) / 64.0; \n\
|
||||
} \n\
|
||||
else if(texBlending == 3) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = min((((texColor.rgb + 1.0) * (toonColor + 1.0) - 1.0) / 64.0) + toonColor, 63.0); \n\
|
||||
fragColor.a = ((texColor.a + 1.0) * (vtxColor.a + 1.0) - 1.0) / 64.0; \n\
|
||||
} \n\
|
||||
\n\
|
||||
gl_FragColor = ((fragColor - 1.0) / 2.0) / 31.0; \n\
|
||||
} \n\
|
||||
"};
|
||||
/* Predefined OpenGL shaders */
|
||||
|
||||
/* Vertex shader */
|
||||
const char *vertexShader = {"\
|
||||
void main() \n\
|
||||
{ \n\
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n\
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; \n\
|
||||
gl_FrontColor = gl_Color; \n\
|
||||
} \n\
|
||||
"};
|
||||
|
||||
/* Fragment shader */
|
||||
const char *fragmentShader = {"\
|
||||
uniform sampler1D toonTable; \n\
|
||||
uniform sampler2D tex2d; \n\
|
||||
uniform int hasTexture; \n\
|
||||
uniform int texBlending; \n\
|
||||
\n\
|
||||
vec4 float_to_6bit(in vec4 color) \n\
|
||||
{ \n\
|
||||
vec4 ret = color * vec4(31.0,31.0,31.0,31.0);\n\
|
||||
\n\
|
||||
if(ret.r > 0.0) ret.r = (ret.r * 2.0) + 1.0; \n\
|
||||
if(ret.g > 0.0) ret.g = (ret.g * 2.0) + 1.0; \n\
|
||||
if(ret.b > 0.0) ret.b = (ret.b * 2.0) + 1.0; \n\
|
||||
if(ret.a > 0.0) ret.a = (ret.a * 2.0) + 1.0; \n\
|
||||
\n\
|
||||
return ret; \n\
|
||||
} \n\
|
||||
\n\
|
||||
void main() \n\
|
||||
{ \n\
|
||||
vec4 vtxColor = float_to_6bit(gl_Color); \n\
|
||||
vec4 texColor = float_to_6bit(texture2D(tex2d, gl_TexCoord[0].st)); \n\
|
||||
vec3 toonColor = vec3(float_to_6bit(vec4(texture1D(toonTable, gl_Color.r).rgb, 0.0))); \n\
|
||||
vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n\
|
||||
\n\
|
||||
if(hasTexture == 0) \n\
|
||||
{ \n\
|
||||
texColor = vec4(63.0, 63.0, 63.0, 63.0); \n\
|
||||
} \n\
|
||||
\n\
|
||||
if(texBlending == 0) \n\
|
||||
{ \n\
|
||||
fragColor = ((texColor + 1.0) * (vtxColor + 1.0) - 1.0) / 64.0; \n\
|
||||
} \n\
|
||||
else if(texBlending == 1) \n\
|
||||
{ \n\
|
||||
if(texColor.a == 0.0 || hasTexture == 0) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = vtxColor.rgb; \n\
|
||||
} \n\
|
||||
else if(texColor.a == 63.0) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = texColor.rgb; \n\
|
||||
} \n\
|
||||
else \n\
|
||||
{ \n\
|
||||
fragColor.rgb = ((texColor.rgb * texColor.a) + (vtxColor.rgb * (63.0 - texColor.a))) / 64.0; \n\
|
||||
} \n\
|
||||
\n\
|
||||
fragColor.a = vtxColor.a; \n\
|
||||
} \n\
|
||||
else if(texBlending == 2) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = ((texColor.rgb + 1.0) * (toonColor + 1.0) - 1.0) / 64.0; \n\
|
||||
fragColor.a = ((texColor.a + 1.0) * (vtxColor.a + 1.0) - 1.0) / 64.0; \n\
|
||||
} \n\
|
||||
else if(texBlending == 3) \n\
|
||||
{ \n\
|
||||
fragColor.rgb = min((((texColor.rgb + 1.0) * (toonColor + 1.0) - 1.0) / 64.0) + toonColor, 63.0); \n\
|
||||
fragColor.a = ((texColor.a + 1.0) * (vtxColor.a + 1.0) - 1.0) / 64.0; \n\
|
||||
} \n\
|
||||
\n\
|
||||
gl_FragColor = ((fragColor - 1.0) / 2.0) / 31.0; \n\
|
||||
} \n\
|
||||
"};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,14 @@
|
|||
#ifndef SOFTRENDER_CONFIG_H
|
||||
#define SOFTRENDER_CONFIG_H
|
||||
|
||||
namespace softrender {
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int quad;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef SOFTRENDER_CONFIG_H
|
||||
#define SOFTRENDER_CONFIG_H
|
||||
|
||||
namespace softrender {
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int quad;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,309 +1,309 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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 SYSFONT_DESMUME_H
|
||||
#define SYSFONT_DESMUME_H
|
||||
|
||||
#define OSD_FONT_WIDTH 8
|
||||
#define OSD_FONT_HEIGHT 16
|
||||
|
||||
|
||||
namespace softrender {
|
||||
|
||||
class DesmumeFont {
|
||||
public:
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2006-2008 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 SYSFONT_DESMUME_H
|
||||
#define SYSFONT_DESMUME_H
|
||||
|
||||
#define OSD_FONT_WIDTH 8
|
||||
#define OSD_FONT_HEIGHT 16
|
||||
|
||||
|
||||
namespace softrender {
|
||||
|
||||
class DesmumeFont {
|
||||
public:
|
||||
static int height() { return OSD_FONT_HEIGHT; }
|
||||
static int width(char c) { return OSD_FONT_WIDTH; }
|
||||
static bool valid(char c) { return true; }
|
||||
|
||||
static int pixel(char c, int x, int y) {
|
||||
|
||||
static const unsigned char font_eng[256*OSD_FONT_HEIGHT] =
|
||||
{
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00 */
|
||||
0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00, /* 01 */
|
||||
0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xE7,0xFF,0xFF,0x7E,0x00,0x00,0x00,0x00, /* 02 */
|
||||
0x00,0x00,0x00,0x00,0x6C,0xFE,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00, /* 03 */
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,0x00, /* 04 */
|
||||
0x00,0x00,0x00,0x18,0x3C,0x3C,0xE7,0xE7,0xE7,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 05 */
|
||||
0x00,0x00,0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x7E,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 06 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 07 */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 08 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00, /* 09 */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF, /* 0A */
|
||||
0x00,0x00,0x1E,0x0E,0x1A,0x32,0x78,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, /* 0B */
|
||||
0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, /* 0C */
|
||||
0x00,0x00,0x3F,0x33,0x3F,0x30,0x30,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00, /* 0D */
|
||||
0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00, /* 0E */
|
||||
0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00, /* 0F */
|
||||
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, /* 10 */
|
||||
0x00,0x02,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, /* 11 */
|
||||
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00, /* 12 */
|
||||
0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, /* 13 */
|
||||
0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00, /* 14 */
|
||||
0x00,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00, /* 15 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0x00, /* 16 */
|
||||
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, /* 17 */
|
||||
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* 18 */
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00, /* 19 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 1A */
|
||||
0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 1B */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, /* 1C */
|
||||
0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00, /* 1D */
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00, /* 1E */
|
||||
0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, /* 1F */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 20 */
|
||||
0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, /* 21 */
|
||||
0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 22 */
|
||||
0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00, /* 23 */
|
||||
0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00, /* 24 */
|
||||
0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00, /* 25 */
|
||||
0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 26 */
|
||||
0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 27 */
|
||||
0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00, /* 28 */
|
||||
0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00, /* 29 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, /* 2A */
|
||||
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 2B */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, /* 2C */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 2D */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, /* 2E */
|
||||
0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00, /* 2F */
|
||||
0x00,0x00,0x3C,0x66,0xC3,0xC3,0xDB,0xDB,0xC3,0xC3,0x66,0x3C,0x00,0x00,0x00,0x00, /* 30 */
|
||||
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00, /* 31 */
|
||||
0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00, /* 32 */
|
||||
0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 33 */
|
||||
0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, /* 34 */
|
||||
0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 35 */
|
||||
0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 36 */
|
||||
0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, /* 37 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 38 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00, /* 39 */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, /* 3A */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, /* 3B */
|
||||
0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00, /* 3C */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 3D */
|
||||
0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00, /* 3E */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, /* 3F */
|
||||
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00, /* 40 */
|
||||
0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 41 */
|
||||
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00, /* 42 */
|
||||
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00, /* 43 */
|
||||
0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00, /* 44 */
|
||||
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, /* 45 */
|
||||
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 46 */
|
||||
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00, /* 47 */
|
||||
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 48 */
|
||||
0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 49 */
|
||||
0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, /* 4A */
|
||||
0x00,0x00,0xE6,0x66,0x66,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, /* 4B */
|
||||
0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, /* 4C */
|
||||
0x00,0x00,0xC3,0xE7,0xFF,0xFF,0xDB,0xC3,0xC3,0xC3,0xC3,0xC3,0x00,0x00,0x00,0x00, /* 4D */
|
||||
0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 4E */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 4F */
|
||||
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 50 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00, /* 51 */
|
||||
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, /* 52 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 53 */
|
||||
0x00,0x00,0xFF,0xDB,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 54 */
|
||||
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 55 */
|
||||
0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, /* 56 */
|
||||
0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0xDB,0xDB,0xFF,0x66,0x66,0x00,0x00,0x00,0x00, /* 57 */
|
||||
0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00, /* 58 */
|
||||
0x00,0x00,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 59 */
|
||||
0x00,0x00,0xFF,0xC3,0x86,0x0C,0x18,0x30,0x60,0xC1,0xC3,0xFF,0x00,0x00,0x00,0x00, /* 5A */
|
||||
0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, /* 5B */
|
||||
0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, /* 5C */
|
||||
0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, /* 5D */
|
||||
0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 5E */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, /* 5F */
|
||||
0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 60 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 61 */
|
||||
0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00, /* 62 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 63 */
|
||||
0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 64 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 65 */
|
||||
0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 66 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00, /* 67 */
|
||||
0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, /* 68 */
|
||||
0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 69 */
|
||||
0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, /* 6A */
|
||||
0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00, /* 6B */
|
||||
0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 6C */
|
||||
0x00,0x00,0x00,0x00,0x00,0xE6,0xFF,0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,0x00,0x00, /* 6D */
|
||||
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, /* 6E */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 6F */
|
||||
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00, /* 70 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00, /* 71 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x66,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 72 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 73 */
|
||||
0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00, /* 74 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 75 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC3,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, /* 76 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC3,0xC3,0xC3,0xDB,0xDB,0xFF,0x66,0x00,0x00,0x00,0x00, /* 77 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3,0x00,0x00,0x00,0x00, /* 78 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00, /* 79 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, /* 7A */
|
||||
0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, /* 7B */
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* 7C */
|
||||
0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, /* 7D */
|
||||
0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 7E */
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00, /* 7F */
|
||||
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x0C,0x06,0x7C,0x00,0x00, /* 80 */
|
||||
0x00,0x00,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 81 */
|
||||
0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 82 */
|
||||
0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 83 */
|
||||
0x00,0x00,0xCC,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 84 */
|
||||
0x00,0x60,0x30,0x18,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 85 */
|
||||
0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 86 */
|
||||
0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00, /* 87 */
|
||||
0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 88 */
|
||||
0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 89 */
|
||||
0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 8A */
|
||||
0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 8B */
|
||||
0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 8C */
|
||||
0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 8D */
|
||||
0x00,0xC6,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 8E */
|
||||
0x38,0x6C,0x38,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 8F */
|
||||
0x18,0x30,0x60,0x00,0xFE,0x66,0x60,0x7C,0x60,0x60,0x66,0xFE,0x00,0x00,0x00,0x00, /* 90 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x1B,0x7E,0xD8,0xDC,0x77,0x00,0x00,0x00,0x00, /* 91 */
|
||||
0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00, /* 92 */
|
||||
0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 93 */
|
||||
0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 94 */
|
||||
0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 95 */
|
||||
0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 96 */
|
||||
0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 97 */
|
||||
0x00,0x00,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00, /* 98 */
|
||||
0x00,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 99 */
|
||||
0x00,0xC6,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 9A */
|
||||
0x00,0x18,0x18,0x7E,0xC3,0xC0,0xC0,0xC0,0xC3,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, /* 9B */
|
||||
0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00, /* 9C */
|
||||
0x00,0x00,0xC3,0x66,0x3C,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* 9D */
|
||||
0x00,0xFC,0x66,0x66,0x7C,0x62,0x66,0x6F,0x66,0x66,0x66,0xF3,0x00,0x00,0x00,0x00, /* 9E */
|
||||
0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00, /* 9F */
|
||||
0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* A0 */
|
||||
0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* A1 */
|
||||
0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* A2 */
|
||||
0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* A3 */
|
||||
0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, /* A4 */
|
||||
0x76,0xDC,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* A5 */
|
||||
0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* A6 */
|
||||
0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* A7 */
|
||||
0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* A8 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00, /* A9 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, /* AA */
|
||||
0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x60,0xCE,0x9B,0x06,0x0C,0x1F,0x00,0x00, /* AB */
|
||||
0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x66,0xCE,0x96,0x3E,0x06,0x06,0x00,0x00, /* AC */
|
||||
0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00, /* AD */
|
||||
0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00, /* AE */
|
||||
0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00, /* AF */
|
||||
0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, /* B0 */
|
||||
0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA, /* B1 */
|
||||
0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77, /* B2 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B3 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B4 */
|
||||
0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B5 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* B6 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* B7 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B8 */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* B9 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* BA */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* BB */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BC */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BD */
|
||||
0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BE */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* BF */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C0 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C1 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C2 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C3 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C4 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C5 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C6 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* C7 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C8 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* C9 */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* CA */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* CB */
|
||||
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* CC */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* CD */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* CE */
|
||||
0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* CF */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D0 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* D1 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* D2 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D3 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D4 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* D5 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* D6 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* D7 */
|
||||
0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* D8 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D9 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* DA */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* DB */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* DC */
|
||||
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, /* DD */
|
||||
0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, /* DE */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* DF */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0xD8,0xD8,0xD8,0xDC,0x76,0x00,0x00,0x00,0x00, /* E0 */
|
||||
0x00,0x00,0x78,0xCC,0xCC,0xCC,0xD8,0xCC,0xC6,0xC6,0xC6,0xCC,0x00,0x00,0x00,0x00, /* E1 */
|
||||
0x00,0x00,0xFE,0xC6,0xC6,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00, /* E2 */
|
||||
0x00,0x00,0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00, /* E3 */
|
||||
0x00,0x00,0x00,0xFE,0xC6,0x60,0x30,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, /* E4 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7E,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, /* E5 */
|
||||
0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xC0,0x00,0x00,0x00, /* E6 */
|
||||
0x00,0x00,0x00,0x00,0x76,0xDC,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* E7 */
|
||||
0x00,0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, /* E8 */
|
||||
0x00,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, /* E9 */
|
||||
0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x6C,0x6C,0x6C,0xEE,0x00,0x00,0x00,0x00, /* EA */
|
||||
0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00, /* EB */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00, /* EC */
|
||||
0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00, /* ED */
|
||||
0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00, /* EE */
|
||||
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* EF */
|
||||
0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, /* F0 */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, /* F1 */
|
||||
0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00, /* F2 */
|
||||
0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00, /* F3 */
|
||||
0x00,0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* F4 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, /* F5 */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, /* F6 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00, /* F7 */
|
||||
0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* F8 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* F9 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* FA */
|
||||
0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00, /* FB */
|
||||
0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* FC */
|
||||
0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* FD */
|
||||
0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00, /* FE */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* FF */
|
||||
};
|
||||
|
||||
return (font_eng[(int)c*OSD_FONT_HEIGHT + y] >> (7-x))&1;
|
||||
} //pixel()
|
||||
|
||||
}; //class
|
||||
|
||||
} //namespace
|
||||
|
||||
|
||||
static bool valid(char c) { return true; }
|
||||
|
||||
static int pixel(char c, int x, int y) {
|
||||
|
||||
static const unsigned char font_eng[256*OSD_FONT_HEIGHT] =
|
||||
{
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00 */
|
||||
0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00, /* 01 */
|
||||
0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xE7,0xFF,0xFF,0x7E,0x00,0x00,0x00,0x00, /* 02 */
|
||||
0x00,0x00,0x00,0x00,0x6C,0xFE,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00, /* 03 */
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,0x00, /* 04 */
|
||||
0x00,0x00,0x00,0x18,0x3C,0x3C,0xE7,0xE7,0xE7,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 05 */
|
||||
0x00,0x00,0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x7E,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 06 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 07 */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 08 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00, /* 09 */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF, /* 0A */
|
||||
0x00,0x00,0x1E,0x0E,0x1A,0x32,0x78,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, /* 0B */
|
||||
0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, /* 0C */
|
||||
0x00,0x00,0x3F,0x33,0x3F,0x30,0x30,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00, /* 0D */
|
||||
0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00, /* 0E */
|
||||
0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00, /* 0F */
|
||||
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, /* 10 */
|
||||
0x00,0x02,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, /* 11 */
|
||||
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00, /* 12 */
|
||||
0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, /* 13 */
|
||||
0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00, /* 14 */
|
||||
0x00,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00, /* 15 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0x00, /* 16 */
|
||||
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, /* 17 */
|
||||
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* 18 */
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00, /* 19 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 1A */
|
||||
0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 1B */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, /* 1C */
|
||||
0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00, /* 1D */
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00, /* 1E */
|
||||
0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, /* 1F */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 20 */
|
||||
0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, /* 21 */
|
||||
0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 22 */
|
||||
0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00, /* 23 */
|
||||
0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00, /* 24 */
|
||||
0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00, /* 25 */
|
||||
0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 26 */
|
||||
0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 27 */
|
||||
0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00, /* 28 */
|
||||
0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00, /* 29 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, /* 2A */
|
||||
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 2B */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, /* 2C */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 2D */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, /* 2E */
|
||||
0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00, /* 2F */
|
||||
0x00,0x00,0x3C,0x66,0xC3,0xC3,0xDB,0xDB,0xC3,0xC3,0x66,0x3C,0x00,0x00,0x00,0x00, /* 30 */
|
||||
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00, /* 31 */
|
||||
0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00, /* 32 */
|
||||
0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 33 */
|
||||
0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, /* 34 */
|
||||
0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 35 */
|
||||
0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 36 */
|
||||
0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, /* 37 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 38 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00, /* 39 */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, /* 3A */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, /* 3B */
|
||||
0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00, /* 3C */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 3D */
|
||||
0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00, /* 3E */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, /* 3F */
|
||||
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00, /* 40 */
|
||||
0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 41 */
|
||||
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00, /* 42 */
|
||||
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00, /* 43 */
|
||||
0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00, /* 44 */
|
||||
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, /* 45 */
|
||||
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 46 */
|
||||
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00, /* 47 */
|
||||
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 48 */
|
||||
0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 49 */
|
||||
0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, /* 4A */
|
||||
0x00,0x00,0xE6,0x66,0x66,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, /* 4B */
|
||||
0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, /* 4C */
|
||||
0x00,0x00,0xC3,0xE7,0xFF,0xFF,0xDB,0xC3,0xC3,0xC3,0xC3,0xC3,0x00,0x00,0x00,0x00, /* 4D */
|
||||
0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 4E */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 4F */
|
||||
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 50 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00, /* 51 */
|
||||
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, /* 52 */
|
||||
0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 53 */
|
||||
0x00,0x00,0xFF,0xDB,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 54 */
|
||||
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 55 */
|
||||
0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, /* 56 */
|
||||
0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0xDB,0xDB,0xFF,0x66,0x66,0x00,0x00,0x00,0x00, /* 57 */
|
||||
0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00, /* 58 */
|
||||
0x00,0x00,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 59 */
|
||||
0x00,0x00,0xFF,0xC3,0x86,0x0C,0x18,0x30,0x60,0xC1,0xC3,0xFF,0x00,0x00,0x00,0x00, /* 5A */
|
||||
0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, /* 5B */
|
||||
0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, /* 5C */
|
||||
0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, /* 5D */
|
||||
0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 5E */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, /* 5F */
|
||||
0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 60 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 61 */
|
||||
0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00, /* 62 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 63 */
|
||||
0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 64 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 65 */
|
||||
0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 66 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00, /* 67 */
|
||||
0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, /* 68 */
|
||||
0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 69 */
|
||||
0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, /* 6A */
|
||||
0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00, /* 6B */
|
||||
0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 6C */
|
||||
0x00,0x00,0x00,0x00,0x00,0xE6,0xFF,0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,0x00,0x00, /* 6D */
|
||||
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, /* 6E */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 6F */
|
||||
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00, /* 70 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00, /* 71 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x66,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, /* 72 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 73 */
|
||||
0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00, /* 74 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 75 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC3,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, /* 76 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC3,0xC3,0xC3,0xDB,0xDB,0xFF,0x66,0x00,0x00,0x00,0x00, /* 77 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3,0x00,0x00,0x00,0x00, /* 78 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00, /* 79 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, /* 7A */
|
||||
0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, /* 7B */
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* 7C */
|
||||
0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, /* 7D */
|
||||
0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 7E */
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00, /* 7F */
|
||||
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x0C,0x06,0x7C,0x00,0x00, /* 80 */
|
||||
0x00,0x00,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 81 */
|
||||
0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 82 */
|
||||
0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 83 */
|
||||
0x00,0x00,0xCC,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 84 */
|
||||
0x00,0x60,0x30,0x18,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 85 */
|
||||
0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 86 */
|
||||
0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00, /* 87 */
|
||||
0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 88 */
|
||||
0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 89 */
|
||||
0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 8A */
|
||||
0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 8B */
|
||||
0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 8C */
|
||||
0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* 8D */
|
||||
0x00,0xC6,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 8E */
|
||||
0x38,0x6C,0x38,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* 8F */
|
||||
0x18,0x30,0x60,0x00,0xFE,0x66,0x60,0x7C,0x60,0x60,0x66,0xFE,0x00,0x00,0x00,0x00, /* 90 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x1B,0x7E,0xD8,0xDC,0x77,0x00,0x00,0x00,0x00, /* 91 */
|
||||
0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00, /* 92 */
|
||||
0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 93 */
|
||||
0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 94 */
|
||||
0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 95 */
|
||||
0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 96 */
|
||||
0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* 97 */
|
||||
0x00,0x00,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00, /* 98 */
|
||||
0x00,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 99 */
|
||||
0x00,0xC6,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* 9A */
|
||||
0x00,0x18,0x18,0x7E,0xC3,0xC0,0xC0,0xC0,0xC3,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, /* 9B */
|
||||
0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00, /* 9C */
|
||||
0x00,0x00,0xC3,0x66,0x3C,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* 9D */
|
||||
0x00,0xFC,0x66,0x66,0x7C,0x62,0x66,0x6F,0x66,0x66,0x66,0xF3,0x00,0x00,0x00,0x00, /* 9E */
|
||||
0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00, /* 9F */
|
||||
0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* A0 */
|
||||
0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, /* A1 */
|
||||
0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* A2 */
|
||||
0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, /* A3 */
|
||||
0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, /* A4 */
|
||||
0x76,0xDC,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* A5 */
|
||||
0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* A6 */
|
||||
0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* A7 */
|
||||
0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, /* A8 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00, /* A9 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, /* AA */
|
||||
0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x60,0xCE,0x9B,0x06,0x0C,0x1F,0x00,0x00, /* AB */
|
||||
0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x66,0xCE,0x96,0x3E,0x06,0x06,0x00,0x00, /* AC */
|
||||
0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00, /* AD */
|
||||
0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00, /* AE */
|
||||
0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00, /* AF */
|
||||
0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, /* B0 */
|
||||
0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA, /* B1 */
|
||||
0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77, /* B2 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B3 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B4 */
|
||||
0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B5 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* B6 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* B7 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* B8 */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* B9 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* BA */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* BB */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BC */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BD */
|
||||
0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BE */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* BF */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C0 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C1 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C2 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C3 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C4 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C5 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* C6 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* C7 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* C8 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* C9 */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* CA */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* CB */
|
||||
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* CC */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* CD */
|
||||
0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* CE */
|
||||
0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* CF */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D0 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* D1 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* D2 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D3 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D4 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* D5 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* D6 */
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* D7 */
|
||||
0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* D8 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* D9 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* DA */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* DB */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* DC */
|
||||
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, /* DD */
|
||||
0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, /* DE */
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* DF */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0xD8,0xD8,0xD8,0xDC,0x76,0x00,0x00,0x00,0x00, /* E0 */
|
||||
0x00,0x00,0x78,0xCC,0xCC,0xCC,0xD8,0xCC,0xC6,0xC6,0xC6,0xCC,0x00,0x00,0x00,0x00, /* E1 */
|
||||
0x00,0x00,0xFE,0xC6,0xC6,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00, /* E2 */
|
||||
0x00,0x00,0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00, /* E3 */
|
||||
0x00,0x00,0x00,0xFE,0xC6,0x60,0x30,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, /* E4 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7E,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, /* E5 */
|
||||
0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xC0,0x00,0x00,0x00, /* E6 */
|
||||
0x00,0x00,0x00,0x00,0x76,0xDC,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, /* E7 */
|
||||
0x00,0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, /* E8 */
|
||||
0x00,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, /* E9 */
|
||||
0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x6C,0x6C,0x6C,0xEE,0x00,0x00,0x00,0x00, /* EA */
|
||||
0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00, /* EB */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00, /* EC */
|
||||
0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00, /* ED */
|
||||
0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00, /* EE */
|
||||
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, /* EF */
|
||||
0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, /* F0 */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, /* F1 */
|
||||
0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00, /* F2 */
|
||||
0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00, /* F3 */
|
||||
0x00,0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* F4 */
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, /* F5 */
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, /* F6 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00, /* F7 */
|
||||
0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* F8 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* F9 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* FA */
|
||||
0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00, /* FB */
|
||||
0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* FC */
|
||||
0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* FD */
|
||||
0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00, /* FE */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* FF */
|
||||
};
|
||||
|
||||
return (font_eng[(int)c*OSD_FONT_HEIGHT + y] >> (7-x))&1;
|
||||
} //pixel()
|
||||
|
||||
}; //class
|
||||
|
||||
} //namespace
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "softrender.h"
|
||||
|
||||
#include "softrender.h"
|
||||
|
||||
#define xx 1
|
||||
#define zz 0
|
||||
|
||||
namespace softrender {
|
||||
|
||||
class v3sysfont {
|
||||
#define zz 0
|
||||
|
||||
namespace softrender {
|
||||
|
||||
class v3sysfont {
|
||||
public:
|
||||
static int height() { return 7; }
|
||||
static int width(char c) { return charByte(c,0); }
|
||||
static int pixel(char c, int x, int y) { return charByte(c,width(c)*y+x+1); }
|
||||
static bool valid(char c) { return c>=32; }
|
||||
static int pixel(char c, int x, int y) { return charByte(c,width(c)*y+x+1); }
|
||||
static bool valid(char c) { return c>=32; }
|
||||
|
||||
static char charByte(byte c, int i) {
|
||||
|
||||
|
@ -926,14 +926,14 @@ namespace softrender {
|
|||
|
||||
return smal_tbl[c][i];
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#undef xx
|
||||
#undef zz
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,45 +1,45 @@
|
|||
#ifndef _TEXCACHE_H_
|
||||
#define _TEXCACHE_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define MAX_TEXTURE 500
|
||||
#ifdef SSE2
|
||||
struct ALIGN(16) TextureCache
|
||||
#else
|
||||
struct ALIGN(8) TextureCache
|
||||
#endif
|
||||
{
|
||||
u32 id;
|
||||
u32 frm;
|
||||
u32 mode;
|
||||
u32 pal;
|
||||
u32 sizeX;
|
||||
u32 sizeY;
|
||||
float invSizeX;
|
||||
float invSizeY;
|
||||
|
||||
struct {
|
||||
int textureSize, indexSize;
|
||||
u8 texture[128*1024]; // 128Kb texture slot
|
||||
u8 palette[256*2];
|
||||
} dump;
|
||||
|
||||
//set if this texture is suspected be invalid due to a vram reconfigure
|
||||
bool suspectedInvalid;
|
||||
|
||||
};
|
||||
|
||||
extern TextureCache texcache[MAX_TEXTURE+1];
|
||||
|
||||
extern void (*TexCache_BindTexture)(u32 texnum);
|
||||
extern void (*TexCache_BindTextureData)(u32 texnum, u8* data);
|
||||
|
||||
void TexCache_Reset();
|
||||
void TexCache_SetTexture(unsigned int format, unsigned int texpal);
|
||||
void TexCache_Invalidate();
|
||||
|
||||
extern u8 TexCache_texMAP[1024*2048*4];
|
||||
TextureCache* TexCache_Curr();
|
||||
|
||||
#endif
|
||||
#ifndef _TEXCACHE_H_
|
||||
#define _TEXCACHE_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define MAX_TEXTURE 500
|
||||
#ifdef SSE2
|
||||
struct ALIGN(16) TextureCache
|
||||
#else
|
||||
struct ALIGN(8) TextureCache
|
||||
#endif
|
||||
{
|
||||
u32 id;
|
||||
u32 frm;
|
||||
u32 mode;
|
||||
u32 pal;
|
||||
u32 sizeX;
|
||||
u32 sizeY;
|
||||
float invSizeX;
|
||||
float invSizeY;
|
||||
|
||||
struct {
|
||||
int textureSize, indexSize;
|
||||
u8 texture[128*1024]; // 128Kb texture slot
|
||||
u8 palette[256*2];
|
||||
} dump;
|
||||
|
||||
//set if this texture is suspected be invalid due to a vram reconfigure
|
||||
bool suspectedInvalid;
|
||||
|
||||
};
|
||||
|
||||
extern TextureCache texcache[MAX_TEXTURE+1];
|
||||
|
||||
extern void (*TexCache_BindTexture)(u32 texnum);
|
||||
extern void (*TexCache_BindTextureData)(u32 texnum, u8* data);
|
||||
|
||||
void TexCache_Reset();
|
||||
void TexCache_SetTexture(unsigned int format, unsigned int texpal);
|
||||
void TexCache_Invalidate();
|
||||
|
||||
extern u8 TexCache_texMAP[1024*2048*4];
|
||||
TextureCache* TexCache_Curr();
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,346 +1,346 @@
|
|||
/* Copyright (C) 2005 Guillaume Duhamel
|
||||
|
||||
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 TYPES_HPP
|
||||
#define TYPES_HPP
|
||||
|
||||
//--------------
|
||||
//configuration
|
||||
//#define DEVELOPER
|
||||
//--------------
|
||||
|
||||
#define DESMUME_NAME "DeSmuME"
|
||||
|
||||
#ifdef _WIN64
|
||||
#define DESMUME_PLATFORM_STRING " x64"
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#define DESMUME_PLATFORM_STRING " x86"
|
||||
#else
|
||||
#define DESMUME_PLATFORM_STRING ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SSE2
|
||||
#define DESMUME_CPUEXT_STRING " SSE2"
|
||||
#else
|
||||
#define DESMUME_CPUEXT_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
#define DESMUME_FEATURE_STRING " dev+"
|
||||
#else
|
||||
#define DESMUME_FEATURE_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DESMUME_SUBVERSION_STRING " debug"
|
||||
#else
|
||||
#ifdef RELEASE
|
||||
#define DESMUME_SUBVERSION_STRING ""
|
||||
#else
|
||||
#define DESMUME_SUBVERSION_STRING " prerelease"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define DESMUME_COMPILER " (Intel) "
|
||||
#define DESMUME_COMPILER_DETAIL " (Intel) "
|
||||
#elif defined(_MSC_VER)
|
||||
#define DESMUME_COMPILER ""
|
||||
#define DESMUME_COMPILER_DETAIL " msvc " _Py_STRINGIZE(_MSC_VER)
|
||||
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
||||
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
||||
#define _Py_STRINGIZE2(X) #X
|
||||
//re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5
|
||||
#else
|
||||
// TODO: make for others compilers
|
||||
#define DESMUME_COMPILER ""
|
||||
#define DESMUME_COMPILER_DETAIL ""
|
||||
#endif
|
||||
|
||||
#define DESMUME_VERSION_NUMERIC 90200
|
||||
#define DESMUME_VERSION_STRING " " "0.9.2" DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_SUBVERSION_STRING DESMUME_COMPILER
|
||||
#define DESMUME_NAME_AND_VERSION " " DESMUME_NAME DESMUME_VERSION_STRING
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strcasecmp(x,y) _stricmp(x,y)
|
||||
#else
|
||||
#define WINAPI
|
||||
#endif
|
||||
/* Copyright (C) 2005 Guillaume Duhamel
|
||||
|
||||
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 TYPES_HPP
|
||||
#define TYPES_HPP
|
||||
|
||||
//--------------
|
||||
//configuration
|
||||
//#define DEVELOPER
|
||||
//--------------
|
||||
|
||||
#define DESMUME_NAME "DeSmuME"
|
||||
|
||||
#ifdef _WIN64
|
||||
#define DESMUME_PLATFORM_STRING " x64"
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#define DESMUME_PLATFORM_STRING " x86"
|
||||
#else
|
||||
#define DESMUME_PLATFORM_STRING ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SSE2
|
||||
#define DESMUME_CPUEXT_STRING " SSE2"
|
||||
#else
|
||||
#define DESMUME_CPUEXT_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
#define DESMUME_FEATURE_STRING " dev+"
|
||||
#else
|
||||
#define DESMUME_FEATURE_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DESMUME_SUBVERSION_STRING " debug"
|
||||
#else
|
||||
#ifdef RELEASE
|
||||
#define DESMUME_SUBVERSION_STRING ""
|
||||
#else
|
||||
#define DESMUME_SUBVERSION_STRING " prerelease"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define DESMUME_COMPILER " (Intel) "
|
||||
#define DESMUME_COMPILER_DETAIL " (Intel) "
|
||||
#elif defined(_MSC_VER)
|
||||
#define DESMUME_COMPILER ""
|
||||
#define DESMUME_COMPILER_DETAIL " msvc " _Py_STRINGIZE(_MSC_VER)
|
||||
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
||||
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
||||
#define _Py_STRINGIZE2(X) #X
|
||||
//re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5
|
||||
#else
|
||||
// TODO: make for others compilers
|
||||
#define DESMUME_COMPILER ""
|
||||
#define DESMUME_COMPILER_DETAIL ""
|
||||
#endif
|
||||
|
||||
#define DESMUME_VERSION_NUMERIC 90200
|
||||
#define DESMUME_VERSION_STRING " " "0.9.2" DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_SUBVERSION_STRING DESMUME_COMPILER
|
||||
#define DESMUME_NAME_AND_VERSION " " DESMUME_NAME DESMUME_VERSION_STRING
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strcasecmp(x,y) _stricmp(x,y)
|
||||
#else
|
||||
#define WINAPI
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <limits.h>
|
||||
#define MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define ALIGN(X) __declspec(align(X))
|
||||
#elif __GNUC__
|
||||
#define ALIGN(X) __attribute__ ((aligned (X)))
|
||||
#else
|
||||
#define ALIGN(X)
|
||||
#endif
|
||||
|
||||
#define CACHE_ALIGN ALIGN(32)
|
||||
|
||||
#ifndef FASTCALL
|
||||
#ifdef __MINGW32__
|
||||
#define FASTCALL __attribute__((fastcall))
|
||||
#elif defined (__i386__)
|
||||
#define FASTCALL __attribute__((regparm(3)))
|
||||
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define FASTCALL
|
||||
#else
|
||||
#define FASTCALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INLINE
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define INLINE _inline
|
||||
#else
|
||||
#define INLINE inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FORCEINLINE
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define FORCEINLINE __forceinline
|
||||
#else
|
||||
#define FORCEINLINE INLINE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__)
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long u64;
|
||||
typedef unsigned long pointer;
|
||||
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed int s32;
|
||||
typedef signed long s64;
|
||||
#else
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
typedef unsigned __int64 u64;
|
||||
#else
|
||||
typedef unsigned long long u64;
|
||||
#endif
|
||||
typedef unsigned long pointer;
|
||||
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed long s32;
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
typedef __int64 s64;
|
||||
#else
|
||||
typedef signed long long s64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef u8 uint8;
|
||||
typedef u16 uint16;
|
||||
|
||||
#ifndef OBJ_C
|
||||
typedef u32 uint32;
|
||||
#else
|
||||
#define uint32 u32 //uint32 is defined in Leopard somewhere, avoid conflicts
|
||||
#endif
|
||||
|
||||
/*---------- GPU3D fixed-points types -----------*/
|
||||
|
||||
typedef s32 f32;
|
||||
#define inttof32(n) ((n) << 12)
|
||||
#define f32toint(n) ((n) >> 12)
|
||||
#define floattof32(n) ((int32)((n) * (1 << 12)))
|
||||
#define f32tofloat(n) (((float)(n)) / (float)(1<<12))
|
||||
|
||||
typedef s16 t16;
|
||||
#define f32tot16(n) ((t16)(n >> 8))
|
||||
#define inttot16(n) ((n) << 4)
|
||||
#define t16toint(n) ((n) >> 4)
|
||||
#define floattot16(n) ((t16)((n) * (1 << 4)))
|
||||
#define t16ofloat(n) (((float)(n)) / (float)(1<<4))
|
||||
|
||||
typedef s16 v16;
|
||||
#define inttov16(n) ((n) << 12)
|
||||
#define f32tov16(n) (n)
|
||||
#define floattov16(n) ((v16)((n) * (1 << 12)))
|
||||
#define v16toint(n) ((n) >> 12)
|
||||
#define v16tofloat(n) (((float)(n)) / (float)(1<<12))
|
||||
|
||||
typedef s16 v10;
|
||||
#define inttov10(n) ((n) << 9)
|
||||
#define f32tov10(n) ((v10)(n >> 3))
|
||||
#define v10toint(n) ((n) >> 9)
|
||||
#define floattov10(n) ((v10)((n) * (1 << 9)))
|
||||
#define v10tofloat(n) (((float)(n)) / (float)(1<<9))
|
||||
|
||||
/*----------------------*/
|
||||
|
||||
#ifndef OBJ_C
|
||||
typedef int BOOL;
|
||||
#else
|
||||
//apple also defines BOOL
|
||||
typedef int desmume_BOOL;
|
||||
#define BOOL desmume_BOOL
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#define WORDS_BIGENDIAN
|
||||
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define ALIGN(X) __declspec(align(X))
|
||||
#elif __GNUC__
|
||||
#define ALIGN(X) __attribute__ ((aligned (X)))
|
||||
#else
|
||||
#define ALIGN(X)
|
||||
#endif
|
||||
|
||||
#define CACHE_ALIGN ALIGN(32)
|
||||
|
||||
#ifndef FASTCALL
|
||||
#ifdef __MINGW32__
|
||||
#define FASTCALL __attribute__((fastcall))
|
||||
#elif defined (__i386__)
|
||||
#define FASTCALL __attribute__((regparm(3)))
|
||||
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define FASTCALL
|
||||
#else
|
||||
#define FASTCALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INLINE
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define INLINE _inline
|
||||
#else
|
||||
#define INLINE inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FORCEINLINE
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define FORCEINLINE __forceinline
|
||||
#else
|
||||
#define FORCEINLINE INLINE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__)
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long u64;
|
||||
typedef unsigned long pointer;
|
||||
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed int s32;
|
||||
typedef signed long s64;
|
||||
#else
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
typedef unsigned __int64 u64;
|
||||
#else
|
||||
typedef unsigned long long u64;
|
||||
#endif
|
||||
typedef unsigned long pointer;
|
||||
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed long s32;
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
typedef __int64 s64;
|
||||
#else
|
||||
typedef signed long long s64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef u8 uint8;
|
||||
typedef u16 uint16;
|
||||
|
||||
#ifndef OBJ_C
|
||||
typedef u32 uint32;
|
||||
#else
|
||||
#define uint32 u32 //uint32 is defined in Leopard somewhere, avoid conflicts
|
||||
#endif
|
||||
|
||||
/*---------- GPU3D fixed-points types -----------*/
|
||||
|
||||
typedef s32 f32;
|
||||
#define inttof32(n) ((n) << 12)
|
||||
#define f32toint(n) ((n) >> 12)
|
||||
#define floattof32(n) ((int32)((n) * (1 << 12)))
|
||||
#define f32tofloat(n) (((float)(n)) / (float)(1<<12))
|
||||
|
||||
typedef s16 t16;
|
||||
#define f32tot16(n) ((t16)(n >> 8))
|
||||
#define inttot16(n) ((n) << 4)
|
||||
#define t16toint(n) ((n) >> 4)
|
||||
#define floattot16(n) ((t16)((n) * (1 << 4)))
|
||||
#define t16ofloat(n) (((float)(n)) / (float)(1<<4))
|
||||
|
||||
typedef s16 v16;
|
||||
#define inttov16(n) ((n) << 12)
|
||||
#define f32tov16(n) (n)
|
||||
#define floattov16(n) ((v16)((n) * (1 << 12)))
|
||||
#define v16toint(n) ((n) >> 12)
|
||||
#define v16tofloat(n) (((float)(n)) / (float)(1<<12))
|
||||
|
||||
typedef s16 v10;
|
||||
#define inttov10(n) ((n) << 9)
|
||||
#define f32tov10(n) ((v10)(n >> 3))
|
||||
#define v10toint(n) ((n) >> 9)
|
||||
#define floattov10(n) ((v10)((n) * (1 << 9)))
|
||||
#define v10tofloat(n) (((float)(n)) / (float)(1<<9))
|
||||
|
||||
/*----------------------*/
|
||||
|
||||
#ifndef OBJ_C
|
||||
typedef int BOOL;
|
||||
#else
|
||||
//apple also defines BOOL
|
||||
typedef int desmume_BOOL;
|
||||
#define BOOL desmume_BOOL
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#define WORDS_BIGENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define LOCAL_BE
|
||||
#else
|
||||
# define LOCAL_LE
|
||||
#endif
|
||||
|
||||
/* little endian (ds' endianess) to local endianess convert macros */
|
||||
#ifdef LOCAL_BE /* local arch is big endian */
|
||||
# define LE_TO_LOCAL_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff))
|
||||
# define LE_TO_LOCAL_32(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff))
|
||||
# define LE_TO_LOCAL_64(x) ((((x)&0xff)<<56)|(((x)&0xff00)<<40)|(((x)&0xff0000)<<24)|(((x)&0xff000000)<<8)|(((x)>>8)&0xff000000)|(((x)>>24)&0xff00)|(((x)>>40)&0xff00)|(((x)>>56)&0xff))
|
||||
# define LOCAL_TO_LE_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff))
|
||||
# define LOCAL_TO_LE_32(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff))
|
||||
# define LOCAL_TO_LE_64(x) ((((x)&0xff)<<56)|(((x)&0xff00)<<40)|(((x)&0xff0000)<<24)|(((x)&0xff000000)<<8)|(((x)>>8)&0xff000000)|(((x)>>24)&0xff00)|(((x)>>40)&0xff00)|(((x)>>56)&0xff))
|
||||
#else /* local arch is little endian */
|
||||
# define LE_TO_LOCAL_16(x) (x)
|
||||
# define LE_TO_LOCAL_32(x) (x)
|
||||
# define LE_TO_LOCAL_64(x) (x)
|
||||
# define LOCAL_TO_LE_16(x) (x)
|
||||
# define LOCAL_TO_LE_32(x) (x)
|
||||
# define LOCAL_TO_LE_64(x) (x)
|
||||
#endif
|
||||
|
||||
// kilobytes and megabytes macro
|
||||
#define MB(x) ((x)*1024*1024)
|
||||
#define KB(x) ((x)*1024)
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
#define CPU_STR(c) ((c==ARM9)?"ARM9":"ARM7")
|
||||
typedef enum
|
||||
{
|
||||
ARM9 = 0,
|
||||
ARM7 = 1
|
||||
} cpu_id_t;
|
||||
|
||||
///endian-flips count bytes. count should be even and nonzero.
|
||||
inline void FlipByteOrder(u8 *src, u32 count)
|
||||
{
|
||||
u8 *start=src;
|
||||
u8 *end=src+count-1;
|
||||
|
||||
if((count&1) || !count) return; /* This shouldn't happen. */
|
||||
|
||||
while(count--)
|
||||
{
|
||||
u8 tmp;
|
||||
|
||||
tmp=*end;
|
||||
*end=*start;
|
||||
*start=tmp;
|
||||
end--;
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline u64 double_to_u64(double d) {
|
||||
union {
|
||||
u64 a;
|
||||
double b;
|
||||
} fuxor;
|
||||
fuxor.b = d;
|
||||
return fuxor.a;
|
||||
}
|
||||
|
||||
inline double u64_to_double(u64 u) {
|
||||
union {
|
||||
u64 a;
|
||||
double b;
|
||||
} fuxor;
|
||||
fuxor.a = u;
|
||||
return fuxor.b;
|
||||
}
|
||||
|
||||
|
||||
///stores a 32bit value into the provided byte array in guaranteed little endian form
|
||||
inline void en32lsb(u8 *buf, u32 morp)
|
||||
{
|
||||
buf[0]=morp;
|
||||
buf[1]=morp>>8;
|
||||
buf[2]=morp>>16;
|
||||
buf[3]=morp>>24;
|
||||
}
|
||||
|
||||
inline void en16lsb(u8* buf, u16 morp)
|
||||
{
|
||||
buf[0]=morp;
|
||||
buf[1]=morp>>8;
|
||||
}
|
||||
|
||||
///unpacks a 64bit little endian value from the provided byte array into host byte order
|
||||
inline u64 de64lsb(u8 *morp)
|
||||
{
|
||||
return morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24)|((u64)morp[4]<<32)|((u64)morp[5]<<40)|((u64)morp[6]<<48)|((u64)morp[7]<<56);
|
||||
}
|
||||
|
||||
///unpacks a 32bit little endian value from the provided byte array into host byte order
|
||||
inline u32 de32lsb(u8 *morp)
|
||||
{
|
||||
return morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24);
|
||||
}
|
||||
|
||||
///unpacks a 16bit little endian value from the provided byte array into host byte order
|
||||
inline u16 de16lsb(u8 *morp)
|
||||
{
|
||||
return morp[0]|(morp[1]<<8);
|
||||
}
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
//taken from winnt.h
|
||||
extern "C++" // templates cannot be declared to have 'C' linkage
|
||||
template <typename T, size_t N>
|
||||
char (*BLAHBLAHBLAH( UNALIGNED T (&)[N] ))[N];
|
||||
|
||||
#define ARRAY_SIZE(A) (sizeof(*BLAHBLAHBLAH(A)))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define LOCAL_BE
|
||||
#else
|
||||
# define LOCAL_LE
|
||||
#endif
|
||||
|
||||
/* little endian (ds' endianess) to local endianess convert macros */
|
||||
#ifdef LOCAL_BE /* local arch is big endian */
|
||||
# define LE_TO_LOCAL_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff))
|
||||
# define LE_TO_LOCAL_32(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff))
|
||||
# define LE_TO_LOCAL_64(x) ((((x)&0xff)<<56)|(((x)&0xff00)<<40)|(((x)&0xff0000)<<24)|(((x)&0xff000000)<<8)|(((x)>>8)&0xff000000)|(((x)>>24)&0xff00)|(((x)>>40)&0xff00)|(((x)>>56)&0xff))
|
||||
# define LOCAL_TO_LE_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff))
|
||||
# define LOCAL_TO_LE_32(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff))
|
||||
# define LOCAL_TO_LE_64(x) ((((x)&0xff)<<56)|(((x)&0xff00)<<40)|(((x)&0xff0000)<<24)|(((x)&0xff000000)<<8)|(((x)>>8)&0xff000000)|(((x)>>24)&0xff00)|(((x)>>40)&0xff00)|(((x)>>56)&0xff))
|
||||
#else /* local arch is little endian */
|
||||
# define LE_TO_LOCAL_16(x) (x)
|
||||
# define LE_TO_LOCAL_32(x) (x)
|
||||
# define LE_TO_LOCAL_64(x) (x)
|
||||
# define LOCAL_TO_LE_16(x) (x)
|
||||
# define LOCAL_TO_LE_32(x) (x)
|
||||
# define LOCAL_TO_LE_64(x) (x)
|
||||
#endif
|
||||
|
||||
// kilobytes and megabytes macro
|
||||
#define MB(x) ((x)*1024*1024)
|
||||
#define KB(x) ((x)*1024)
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
#define CPU_STR(c) ((c==ARM9)?"ARM9":"ARM7")
|
||||
typedef enum
|
||||
{
|
||||
ARM9 = 0,
|
||||
ARM7 = 1
|
||||
} cpu_id_t;
|
||||
|
||||
///endian-flips count bytes. count should be even and nonzero.
|
||||
inline void FlipByteOrder(u8 *src, u32 count)
|
||||
{
|
||||
u8 *start=src;
|
||||
u8 *end=src+count-1;
|
||||
|
||||
if((count&1) || !count) return; /* This shouldn't happen. */
|
||||
|
||||
while(count--)
|
||||
{
|
||||
u8 tmp;
|
||||
|
||||
tmp=*end;
|
||||
*end=*start;
|
||||
*start=tmp;
|
||||
end--;
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline u64 double_to_u64(double d) {
|
||||
union {
|
||||
u64 a;
|
||||
double b;
|
||||
} fuxor;
|
||||
fuxor.b = d;
|
||||
return fuxor.a;
|
||||
}
|
||||
|
||||
inline double u64_to_double(u64 u) {
|
||||
union {
|
||||
u64 a;
|
||||
double b;
|
||||
} fuxor;
|
||||
fuxor.a = u;
|
||||
return fuxor.b;
|
||||
}
|
||||
|
||||
|
||||
///stores a 32bit value into the provided byte array in guaranteed little endian form
|
||||
inline void en32lsb(u8 *buf, u32 morp)
|
||||
{
|
||||
buf[0]=morp;
|
||||
buf[1]=morp>>8;
|
||||
buf[2]=morp>>16;
|
||||
buf[3]=morp>>24;
|
||||
}
|
||||
|
||||
inline void en16lsb(u8* buf, u16 morp)
|
||||
{
|
||||
buf[0]=morp;
|
||||
buf[1]=morp>>8;
|
||||
}
|
||||
|
||||
///unpacks a 64bit little endian value from the provided byte array into host byte order
|
||||
inline u64 de64lsb(u8 *morp)
|
||||
{
|
||||
return morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24)|((u64)morp[4]<<32)|((u64)morp[5]<<40)|((u64)morp[6]<<48)|((u64)morp[7]<<56);
|
||||
}
|
||||
|
||||
///unpacks a 32bit little endian value from the provided byte array into host byte order
|
||||
inline u32 de32lsb(u8 *morp)
|
||||
{
|
||||
return morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24);
|
||||
}
|
||||
|
||||
///unpacks a 16bit little endian value from the provided byte array into host byte order
|
||||
inline u16 de16lsb(u8 *morp)
|
||||
{
|
||||
return morp[0]|(morp[1]<<8);
|
||||
}
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
//taken from winnt.h
|
||||
extern "C++" // templates cannot be declared to have 'C' linkage
|
||||
template <typename T, size_t N>
|
||||
char (*BLAHBLAHBLAH( UNALIGNED T (&)[N] ))[N];
|
||||
|
||||
#define ARRAY_SIZE(A) (sizeof(*BLAHBLAHBLAH(A)))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//taken from ndstool
|
||||
//taken from ndstool
|
||||
//http://devkitpro.cvs.sourceforge.net/viewvc/devkitpro/tools/nds/ndstool/source/crc.cpp?revision=1.2
|
||||
|
||||
/* crc.cpp - this file is part of DeSmuME
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/* decrypt.h - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2006 Rafael Vuijk
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _DECRYPT_H_
|
||||
#define _DECRYPT_H_
|
||||
|
||||
void DecryptSecureArea(u8 *romdata, long romlen);
|
||||
|
||||
#endif
|
||||
/* decrypt.h - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2006 Rafael Vuijk
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _DECRYPT_H_
|
||||
#define _DECRYPT_H_
|
||||
|
||||
void DecryptSecureArea(u8 *romdata, long romlen);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,133 +1,133 @@
|
|||
//taken from ndstool
|
||||
//http://devkitpro.cvs.sourceforge.net/viewvc/devkitpro/tools/nds/ndstool/include/header.h?revision=1.14
|
||||
|
||||
/* header.h - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2005-2006 Rafael Vuijk
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _HEADER_H_
|
||||
#define _HEADER_H_
|
||||
|
||||
|
||||
#include "../../types.h"
|
||||
|
||||
#include "../../PACKED.h"
|
||||
struct __PACKED Header
|
||||
{
|
||||
char title[0xC];
|
||||
char gamecode[0x4];
|
||||
char makercode[2];
|
||||
unsigned char unitcode; // product code. 0 = Nintendo DS
|
||||
unsigned char devicetype; // device code. 0 = normal
|
||||
unsigned char devicecap; // device size. (1<<n Mbit)
|
||||
unsigned char reserved1[0x9]; // 0x015..0x01D
|
||||
unsigned char romversion;
|
||||
unsigned char reserved2; // 0x01F
|
||||
u32 arm9_rom_offset; // points to libsyscall and rest of ARM9 binary
|
||||
u32 arm9_entry_address;
|
||||
u32 arm9_ram_address;
|
||||
u32 arm9_size;
|
||||
u32 arm7_rom_offset;
|
||||
u32 arm7_entry_address;
|
||||
u32 arm7_ram_address;
|
||||
u32 arm7_size;
|
||||
u32 fnt_offset;
|
||||
u32 fnt_size;
|
||||
u32 fat_offset;
|
||||
u32 fat_size;
|
||||
u32 arm9_overlay_offset;
|
||||
u32 arm9_overlay_size;
|
||||
u32 arm7_overlay_offset;
|
||||
u32 arm7_overlay_size;
|
||||
u32 rom_control_info1; // 0x00416657 for OneTimePROM
|
||||
u32 rom_control_info2; // 0x081808F8 for OneTimePROM
|
||||
u32 banner_offset;
|
||||
u16 secure_area_crc;
|
||||
u16 rom_control_info3; // 0x0D7E for OneTimePROM
|
||||
u32 offset_0x70; // magic1 (64 bit encrypted magic code to disable LFSR)
|
||||
u32 offset_0x74; // magic2
|
||||
u32 offset_0x78; // unique ID for homebrew
|
||||
u32 offset_0x7C; // unique ID for homebrew
|
||||
u32 application_end_offset; // rom size
|
||||
u32 rom_header_size;
|
||||
u32 offset_0x88; // reserved... ?
|
||||
u32 offset_0x8C;
|
||||
|
||||
// reserved
|
||||
u32 offset_0x90;
|
||||
u32 offset_0x94;
|
||||
u32 offset_0x98;
|
||||
u32 offset_0x9C;
|
||||
u32 offset_0xA0;
|
||||
u32 offset_0xA4;
|
||||
u32 offset_0xA8;
|
||||
u32 offset_0xAC;
|
||||
u32 offset_0xB0;
|
||||
u32 offset_0xB4;
|
||||
u32 offset_0xB8;
|
||||
u32 offset_0xBC;
|
||||
|
||||
unsigned char logo[156]; // character data
|
||||
u16 logo_crc;
|
||||
u16 header_crc;
|
||||
|
||||
// 0x160..0x17F reserved
|
||||
u32 offset_0x160;
|
||||
u32 offset_0x164;
|
||||
u32 offset_0x168;
|
||||
u32 offset_0x16C;
|
||||
unsigned char zero[0x90];
|
||||
};
|
||||
#include "../../PACKED_END.h"
|
||||
|
||||
|
||||
|
||||
struct Country
|
||||
{
|
||||
const char countrycode;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct Maker
|
||||
{
|
||||
const char *makercode;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
extern Country countries[];
|
||||
extern int NumCountries;
|
||||
|
||||
extern Maker makers[];
|
||||
extern int NumMakers;
|
||||
|
||||
unsigned short CalcHeaderCRC(Header &header);
|
||||
unsigned short CalcLogoCRC(Header &header);
|
||||
void FixHeaderCRC(char *ndsfilename);
|
||||
void ShowInfo(char *ndsfilename);
|
||||
int HashAndCompareWithList(char *filename, unsigned char sha1[]);
|
||||
int DetectRomType(const Header& header, char* romdata);
|
||||
unsigned short CalcSecureAreaCRC(bool encrypt);
|
||||
|
||||
#define ROMTYPE_HOMEBREW 0
|
||||
#define ROMTYPE_MULTIBOOT 1
|
||||
#define ROMTYPE_NDSDUMPED 2 // decrypted secure area
|
||||
#define ROMTYPE_ENCRSECURE 3
|
||||
#define ROMTYPE_MASKROM 4 // unknown layout
|
||||
|
||||
#endif
|
||||
//taken from ndstool
|
||||
//http://devkitpro.cvs.sourceforge.net/viewvc/devkitpro/tools/nds/ndstool/include/header.h?revision=1.14
|
||||
|
||||
/* header.h - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2005-2006 Rafael Vuijk
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _HEADER_H_
|
||||
#define _HEADER_H_
|
||||
|
||||
|
||||
#include "../../types.h"
|
||||
|
||||
#include "../../PACKED.h"
|
||||
struct __PACKED Header
|
||||
{
|
||||
char title[0xC];
|
||||
char gamecode[0x4];
|
||||
char makercode[2];
|
||||
unsigned char unitcode; // product code. 0 = Nintendo DS
|
||||
unsigned char devicetype; // device code. 0 = normal
|
||||
unsigned char devicecap; // device size. (1<<n Mbit)
|
||||
unsigned char reserved1[0x9]; // 0x015..0x01D
|
||||
unsigned char romversion;
|
||||
unsigned char reserved2; // 0x01F
|
||||
u32 arm9_rom_offset; // points to libsyscall and rest of ARM9 binary
|
||||
u32 arm9_entry_address;
|
||||
u32 arm9_ram_address;
|
||||
u32 arm9_size;
|
||||
u32 arm7_rom_offset;
|
||||
u32 arm7_entry_address;
|
||||
u32 arm7_ram_address;
|
||||
u32 arm7_size;
|
||||
u32 fnt_offset;
|
||||
u32 fnt_size;
|
||||
u32 fat_offset;
|
||||
u32 fat_size;
|
||||
u32 arm9_overlay_offset;
|
||||
u32 arm9_overlay_size;
|
||||
u32 arm7_overlay_offset;
|
||||
u32 arm7_overlay_size;
|
||||
u32 rom_control_info1; // 0x00416657 for OneTimePROM
|
||||
u32 rom_control_info2; // 0x081808F8 for OneTimePROM
|
||||
u32 banner_offset;
|
||||
u16 secure_area_crc;
|
||||
u16 rom_control_info3; // 0x0D7E for OneTimePROM
|
||||
u32 offset_0x70; // magic1 (64 bit encrypted magic code to disable LFSR)
|
||||
u32 offset_0x74; // magic2
|
||||
u32 offset_0x78; // unique ID for homebrew
|
||||
u32 offset_0x7C; // unique ID for homebrew
|
||||
u32 application_end_offset; // rom size
|
||||
u32 rom_header_size;
|
||||
u32 offset_0x88; // reserved... ?
|
||||
u32 offset_0x8C;
|
||||
|
||||
// reserved
|
||||
u32 offset_0x90;
|
||||
u32 offset_0x94;
|
||||
u32 offset_0x98;
|
||||
u32 offset_0x9C;
|
||||
u32 offset_0xA0;
|
||||
u32 offset_0xA4;
|
||||
u32 offset_0xA8;
|
||||
u32 offset_0xAC;
|
||||
u32 offset_0xB0;
|
||||
u32 offset_0xB4;
|
||||
u32 offset_0xB8;
|
||||
u32 offset_0xBC;
|
||||
|
||||
unsigned char logo[156]; // character data
|
||||
u16 logo_crc;
|
||||
u16 header_crc;
|
||||
|
||||
// 0x160..0x17F reserved
|
||||
u32 offset_0x160;
|
||||
u32 offset_0x164;
|
||||
u32 offset_0x168;
|
||||
u32 offset_0x16C;
|
||||
unsigned char zero[0x90];
|
||||
};
|
||||
#include "../../PACKED_END.h"
|
||||
|
||||
|
||||
|
||||
struct Country
|
||||
{
|
||||
const char countrycode;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct Maker
|
||||
{
|
||||
const char *makercode;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
extern Country countries[];
|
||||
extern int NumCountries;
|
||||
|
||||
extern Maker makers[];
|
||||
extern int NumMakers;
|
||||
|
||||
unsigned short CalcHeaderCRC(Header &header);
|
||||
unsigned short CalcLogoCRC(Header &header);
|
||||
void FixHeaderCRC(char *ndsfilename);
|
||||
void ShowInfo(char *ndsfilename);
|
||||
int HashAndCompareWithList(char *filename, unsigned char sha1[]);
|
||||
int DetectRomType(const Header& header, char* romdata);
|
||||
unsigned short CalcSecureAreaCRC(bool encrypt);
|
||||
|
||||
#define ROMTYPE_HOMEBREW 0
|
||||
#define ROMTYPE_MULTIBOOT 1
|
||||
#define ROMTYPE_NDSDUMPED 2 // decrypted secure area
|
||||
#define ROMTYPE_ENCRSECURE 3
|
||||
#define ROMTYPE_MASKROM 4 // unknown layout
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
/* guid.cpp
|
||||
*
|
||||
* Copyright (C) 2008 Zeromus
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include "guid.h"
|
||||
#include "../types.h"
|
||||
|
||||
void Desmume_Guid::newGuid()
|
||||
{
|
||||
for(int i=0;i<size;i++)
|
||||
data[i] = rand();
|
||||
}
|
||||
|
||||
std::string Desmume_Guid::toString()
|
||||
{
|
||||
char buf[37];
|
||||
sprintf(buf,"%08lX-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X",
|
||||
de32lsb(data),de16lsb(data+4),de16lsb(data+6),de16lsb(data+8),data[10],data[11],data[12],data[13],data[14],data[15]);
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
Desmume_Guid Desmume_Guid::fromString(std::string str)
|
||||
{
|
||||
Desmume_Guid ret;
|
||||
ret.scan(str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint8 Desmume_Guid::hexToByte(char** ptrptr)
|
||||
{
|
||||
char a = toupper(**ptrptr);
|
||||
(*ptrptr)++;
|
||||
char b = toupper(**ptrptr);
|
||||
(*ptrptr)++;
|
||||
if(a>='A') a=a-'A'+10;
|
||||
else a-='0';
|
||||
if(b>='A') b=b-'A'+10;
|
||||
else b-='0';
|
||||
return ((unsigned char)a<<4)|(unsigned char)b;
|
||||
}
|
||||
|
||||
void Desmume_Guid::scan(std::string& str)
|
||||
{
|
||||
char* endptr = (char*)str.c_str();
|
||||
en32lsb(data,strtoul(endptr,&endptr,16));
|
||||
en16lsb(data+4,strtoul(endptr+1,&endptr,16));
|
||||
en16lsb(data+6,strtoul(endptr+1,&endptr,16));
|
||||
en16lsb(data+8,strtoul(endptr+1,&endptr,16));
|
||||
endptr++;
|
||||
for(int i=0;i<6;i++)
|
||||
data[10+i] = hexToByte(&endptr);
|
||||
}
|
||||
/* guid.cpp
|
||||
*
|
||||
* Copyright (C) 2008 Zeromus
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include "guid.h"
|
||||
#include "../types.h"
|
||||
|
||||
void Desmume_Guid::newGuid()
|
||||
{
|
||||
for(int i=0;i<size;i++)
|
||||
data[i] = rand();
|
||||
}
|
||||
|
||||
std::string Desmume_Guid::toString()
|
||||
{
|
||||
char buf[37];
|
||||
sprintf(buf,"%08lX-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X",
|
||||
de32lsb(data),de16lsb(data+4),de16lsb(data+6),de16lsb(data+8),data[10],data[11],data[12],data[13],data[14],data[15]);
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
Desmume_Guid Desmume_Guid::fromString(std::string str)
|
||||
{
|
||||
Desmume_Guid ret;
|
||||
ret.scan(str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint8 Desmume_Guid::hexToByte(char** ptrptr)
|
||||
{
|
||||
char a = toupper(**ptrptr);
|
||||
(*ptrptr)++;
|
||||
char b = toupper(**ptrptr);
|
||||
(*ptrptr)++;
|
||||
if(a>='A') a=a-'A'+10;
|
||||
else a-='0';
|
||||
if(b>='A') b=b-'A'+10;
|
||||
else b-='0';
|
||||
return ((unsigned char)a<<4)|(unsigned char)b;
|
||||
}
|
||||
|
||||
void Desmume_Guid::scan(std::string& str)
|
||||
{
|
||||
char* endptr = (char*)str.c_str();
|
||||
en32lsb(data,strtoul(endptr,&endptr,16));
|
||||
en16lsb(data+4,strtoul(endptr+1,&endptr,16));
|
||||
en16lsb(data+6,strtoul(endptr+1,&endptr,16));
|
||||
en16lsb(data+8,strtoul(endptr+1,&endptr,16));
|
||||
endptr++;
|
||||
for(int i=0;i<6;i++)
|
||||
data[10+i] = hexToByte(&endptr);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#ifndef _guid_h_
|
||||
#define _guid_h_
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "../types.h"
|
||||
#include "valuearray.h"
|
||||
|
||||
struct Desmume_Guid : public ValueArray<u8,16>
|
||||
{
|
||||
void newGuid();
|
||||
std::string toString();
|
||||
static Desmume_Guid fromString(std::string str);
|
||||
static uint8 hexToByte(char** ptrptr);
|
||||
void scan(std::string& str);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef _guid_h_
|
||||
#define _guid_h_
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "../types.h"
|
||||
#include "valuearray.h"
|
||||
|
||||
struct Desmume_Guid : public ValueArray<u8,16>
|
||||
{
|
||||
void newGuid();
|
||||
std::string toString();
|
||||
static Desmume_Guid fromString(std::string str);
|
||||
static uint8 hexToByte(char** ptrptr);
|
||||
void scan(std::string& str);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,248 +1,248 @@
|
|||
/// \file
|
||||
/// \brief RFC 1321 compliant MD5 implementation,
|
||||
/// RFC 1321 compliant MD5 implementation,
|
||||
/// by Christophe Devine <devine@cr0.net>;
|
||||
/// this program is licensed under the GPL.
|
||||
|
||||
//Modified October 3, 2003, to remove testing code, and add include of "types.h".
|
||||
//Added simple MD5 to ASCII string conversion function.
|
||||
// -Xodnizel
|
||||
|
||||
#include <string.h>
|
||||
#include "../types.h"
|
||||
#include "md5.h"
|
||||
|
||||
typedef u8 uint8;
|
||||
typedef u16 uint16;
|
||||
typedef u32 uint32;
|
||||
|
||||
#define GET_UINT32(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32) (b)[(i) + 3] << 24 ) \
|
||||
| ( (uint32) (b)[(i) + 2] << 16 ) \
|
||||
| ( (uint32) (b)[(i) + 1] << 8 ) \
|
||||
| ( (uint32) (b)[(i) ] ); \
|
||||
}
|
||||
|
||||
#define PUT_UINT32(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (uint8) ( (n) ); \
|
||||
(b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
|
||||
(b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
|
||||
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
|
||||
}
|
||||
|
||||
void md5_starts( struct md5_context *ctx )
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
static void md5_process( struct md5_context *ctx, uint8 data[64] )
|
||||
{
|
||||
uint32 A, B, C, D, X[16];
|
||||
|
||||
GET_UINT32( X[0], data, 0 );
|
||||
GET_UINT32( X[1], data, 4 );
|
||||
GET_UINT32( X[2], data, 8 );
|
||||
GET_UINT32( X[3], data, 12 );
|
||||
GET_UINT32( X[4], data, 16 );
|
||||
GET_UINT32( X[5], data, 20 );
|
||||
GET_UINT32( X[6], data, 24 );
|
||||
GET_UINT32( X[7], data, 28 );
|
||||
GET_UINT32( X[8], data, 32 );
|
||||
GET_UINT32( X[9], data, 36 );
|
||||
GET_UINT32( X[10], data, 40 );
|
||||
GET_UINT32( X[11], data, 44 );
|
||||
GET_UINT32( X[12], data, 48 );
|
||||
GET_UINT32( X[13], data, 52 );
|
||||
GET_UINT32( X[14], data, 56 );
|
||||
GET_UINT32( X[15], data, 60 );
|
||||
|
||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
#define P(a,b,c,d,k,s,t) \
|
||||
{ \
|
||||
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
|
||||
#define F(x,y,z) (z ^ (x & (y ^ z)))
|
||||
|
||||
P( A, B, C, D, 0, 7, 0xD76AA478 );
|
||||
P( D, A, B, C, 1, 12, 0xE8C7B756 );
|
||||
P( C, D, A, B, 2, 17, 0x242070DB );
|
||||
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
|
||||
P( A, B, C, D, 4, 7, 0xF57C0FAF );
|
||||
P( D, A, B, C, 5, 12, 0x4787C62A );
|
||||
P( C, D, A, B, 6, 17, 0xA8304613 );
|
||||
P( B, C, D, A, 7, 22, 0xFD469501 );
|
||||
P( A, B, C, D, 8, 7, 0x698098D8 );
|
||||
P( D, A, B, C, 9, 12, 0x8B44F7AF );
|
||||
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
|
||||
P( B, C, D, A, 11, 22, 0x895CD7BE );
|
||||
P( A, B, C, D, 12, 7, 0x6B901122 );
|
||||
P( D, A, B, C, 13, 12, 0xFD987193 );
|
||||
P( C, D, A, B, 14, 17, 0xA679438E );
|
||||
P( B, C, D, A, 15, 22, 0x49B40821 );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (z & (x ^ y)))
|
||||
|
||||
P( A, B, C, D, 1, 5, 0xF61E2562 );
|
||||
P( D, A, B, C, 6, 9, 0xC040B340 );
|
||||
P( C, D, A, B, 11, 14, 0x265E5A51 );
|
||||
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
|
||||
P( A, B, C, D, 5, 5, 0xD62F105D );
|
||||
P( D, A, B, C, 10, 9, 0x02441453 );
|
||||
P( C, D, A, B, 15, 14, 0xD8A1E681 );
|
||||
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
|
||||
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
|
||||
P( D, A, B, C, 14, 9, 0xC33707D6 );
|
||||
P( C, D, A, B, 3, 14, 0xF4D50D87 );
|
||||
P( B, C, D, A, 8, 20, 0x455A14ED );
|
||||
P( A, B, C, D, 13, 5, 0xA9E3E905 );
|
||||
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
|
||||
P( C, D, A, B, 7, 14, 0x676F02D9 );
|
||||
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
|
||||
P( A, B, C, D, 5, 4, 0xFFFA3942 );
|
||||
P( D, A, B, C, 8, 11, 0x8771F681 );
|
||||
P( C, D, A, B, 11, 16, 0x6D9D6122 );
|
||||
P( B, C, D, A, 14, 23, 0xFDE5380C );
|
||||
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
|
||||
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
|
||||
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
|
||||
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
|
||||
P( A, B, C, D, 13, 4, 0x289B7EC6 );
|
||||
P( D, A, B, C, 0, 11, 0xEAA127FA );
|
||||
P( C, D, A, B, 3, 16, 0xD4EF3085 );
|
||||
P( B, C, D, A, 6, 23, 0x04881D05 );
|
||||
P( A, B, C, D, 9, 4, 0xD9D4D039 );
|
||||
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
|
||||
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
|
||||
P( B, C, D, A, 2, 23, 0xC4AC5665 );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (x | ~z))
|
||||
|
||||
P( A, B, C, D, 0, 6, 0xF4292244 );
|
||||
P( D, A, B, C, 7, 10, 0x432AFF97 );
|
||||
P( C, D, A, B, 14, 15, 0xAB9423A7 );
|
||||
P( B, C, D, A, 5, 21, 0xFC93A039 );
|
||||
P( A, B, C, D, 12, 6, 0x655B59C3 );
|
||||
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
|
||||
P( C, D, A, B, 10, 15, 0xFFEFF47D );
|
||||
P( B, C, D, A, 1, 21, 0x85845DD1 );
|
||||
P( A, B, C, D, 8, 6, 0x6FA87E4F );
|
||||
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
|
||||
P( C, D, A, B, 6, 15, 0xA3014314 );
|
||||
P( B, C, D, A, 13, 21, 0x4E0811A1 );
|
||||
P( A, B, C, D, 4, 6, 0xF7537E82 );
|
||||
P( D, A, B, C, 11, 10, 0xBD3AF235 );
|
||||
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
|
||||
P( B, C, D, A, 9, 21, 0xEB86D391 );
|
||||
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
}
|
||||
|
||||
void md5_update( struct md5_context *ctx, uint8 *input, uint32 length )
|
||||
{
|
||||
uint32 left, fill;
|
||||
|
||||
if( ! length ) return;
|
||||
|
||||
left = ( ctx->total[0] >> 3 ) & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += length << 3;
|
||||
ctx->total[1] += length >> 29;
|
||||
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
ctx->total[1] += ctx->total[0] < ( length << 3 );
|
||||
|
||||
if( left && length >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left), (void *) input, fill );
|
||||
md5_process( ctx, ctx->buffer );
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( length >= 64 )
|
||||
{
|
||||
md5_process( ctx, input );
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
|
||||
if( length )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left), (void *) input, length );
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 md5_padding[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
void md5_finish( struct md5_context *ctx, uint8 digest[16] )
|
||||
{
|
||||
uint32 last, padn;
|
||||
uint8 msglen[8];
|
||||
|
||||
PUT_UINT32( ctx->total[0], msglen, 0 );
|
||||
PUT_UINT32( ctx->total[1], msglen, 4 );
|
||||
|
||||
last = ( ctx->total[0] >> 3 ) & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
|
||||
md5_update( ctx, md5_padding, padn );
|
||||
md5_update( ctx, msglen, 8 );
|
||||
|
||||
PUT_UINT32( ctx->state[0], digest, 0 );
|
||||
PUT_UINT32( ctx->state[1], digest, 4 );
|
||||
PUT_UINT32( ctx->state[2], digest, 8 );
|
||||
PUT_UINT32( ctx->state[3], digest, 12 );
|
||||
}
|
||||
|
||||
|
||||
/* Uses a static buffer, so beware of how it's used. */
|
||||
char *md5_asciistr(MD5DATA& md5)
|
||||
{
|
||||
uint8* digest = md5.data;
|
||||
static char str[33];
|
||||
static char trans[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
||||
int x;
|
||||
|
||||
for(x=0;x<16;x++)
|
||||
{
|
||||
str[x*2]=trans[digest[x]&0x0F];
|
||||
str[x*2+1]=trans[digest[x]>>4];
|
||||
}
|
||||
return(str);
|
||||
}
|
||||
/// \file
|
||||
/// \brief RFC 1321 compliant MD5 implementation,
|
||||
/// RFC 1321 compliant MD5 implementation,
|
||||
/// by Christophe Devine <devine@cr0.net>;
|
||||
/// this program is licensed under the GPL.
|
||||
|
||||
//Modified October 3, 2003, to remove testing code, and add include of "types.h".
|
||||
//Added simple MD5 to ASCII string conversion function.
|
||||
// -Xodnizel
|
||||
|
||||
#include <string.h>
|
||||
#include "../types.h"
|
||||
#include "md5.h"
|
||||
|
||||
typedef u8 uint8;
|
||||
typedef u16 uint16;
|
||||
typedef u32 uint32;
|
||||
|
||||
#define GET_UINT32(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32) (b)[(i) + 3] << 24 ) \
|
||||
| ( (uint32) (b)[(i) + 2] << 16 ) \
|
||||
| ( (uint32) (b)[(i) + 1] << 8 ) \
|
||||
| ( (uint32) (b)[(i) ] ); \
|
||||
}
|
||||
|
||||
#define PUT_UINT32(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (uint8) ( (n) ); \
|
||||
(b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
|
||||
(b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
|
||||
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
|
||||
}
|
||||
|
||||
void md5_starts( struct md5_context *ctx )
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
static void md5_process( struct md5_context *ctx, uint8 data[64] )
|
||||
{
|
||||
uint32 A, B, C, D, X[16];
|
||||
|
||||
GET_UINT32( X[0], data, 0 );
|
||||
GET_UINT32( X[1], data, 4 );
|
||||
GET_UINT32( X[2], data, 8 );
|
||||
GET_UINT32( X[3], data, 12 );
|
||||
GET_UINT32( X[4], data, 16 );
|
||||
GET_UINT32( X[5], data, 20 );
|
||||
GET_UINT32( X[6], data, 24 );
|
||||
GET_UINT32( X[7], data, 28 );
|
||||
GET_UINT32( X[8], data, 32 );
|
||||
GET_UINT32( X[9], data, 36 );
|
||||
GET_UINT32( X[10], data, 40 );
|
||||
GET_UINT32( X[11], data, 44 );
|
||||
GET_UINT32( X[12], data, 48 );
|
||||
GET_UINT32( X[13], data, 52 );
|
||||
GET_UINT32( X[14], data, 56 );
|
||||
GET_UINT32( X[15], data, 60 );
|
||||
|
||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
#define P(a,b,c,d,k,s,t) \
|
||||
{ \
|
||||
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
|
||||
#define F(x,y,z) (z ^ (x & (y ^ z)))
|
||||
|
||||
P( A, B, C, D, 0, 7, 0xD76AA478 );
|
||||
P( D, A, B, C, 1, 12, 0xE8C7B756 );
|
||||
P( C, D, A, B, 2, 17, 0x242070DB );
|
||||
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
|
||||
P( A, B, C, D, 4, 7, 0xF57C0FAF );
|
||||
P( D, A, B, C, 5, 12, 0x4787C62A );
|
||||
P( C, D, A, B, 6, 17, 0xA8304613 );
|
||||
P( B, C, D, A, 7, 22, 0xFD469501 );
|
||||
P( A, B, C, D, 8, 7, 0x698098D8 );
|
||||
P( D, A, B, C, 9, 12, 0x8B44F7AF );
|
||||
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
|
||||
P( B, C, D, A, 11, 22, 0x895CD7BE );
|
||||
P( A, B, C, D, 12, 7, 0x6B901122 );
|
||||
P( D, A, B, C, 13, 12, 0xFD987193 );
|
||||
P( C, D, A, B, 14, 17, 0xA679438E );
|
||||
P( B, C, D, A, 15, 22, 0x49B40821 );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (z & (x ^ y)))
|
||||
|
||||
P( A, B, C, D, 1, 5, 0xF61E2562 );
|
||||
P( D, A, B, C, 6, 9, 0xC040B340 );
|
||||
P( C, D, A, B, 11, 14, 0x265E5A51 );
|
||||
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
|
||||
P( A, B, C, D, 5, 5, 0xD62F105D );
|
||||
P( D, A, B, C, 10, 9, 0x02441453 );
|
||||
P( C, D, A, B, 15, 14, 0xD8A1E681 );
|
||||
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
|
||||
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
|
||||
P( D, A, B, C, 14, 9, 0xC33707D6 );
|
||||
P( C, D, A, B, 3, 14, 0xF4D50D87 );
|
||||
P( B, C, D, A, 8, 20, 0x455A14ED );
|
||||
P( A, B, C, D, 13, 5, 0xA9E3E905 );
|
||||
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
|
||||
P( C, D, A, B, 7, 14, 0x676F02D9 );
|
||||
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
|
||||
P( A, B, C, D, 5, 4, 0xFFFA3942 );
|
||||
P( D, A, B, C, 8, 11, 0x8771F681 );
|
||||
P( C, D, A, B, 11, 16, 0x6D9D6122 );
|
||||
P( B, C, D, A, 14, 23, 0xFDE5380C );
|
||||
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
|
||||
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
|
||||
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
|
||||
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
|
||||
P( A, B, C, D, 13, 4, 0x289B7EC6 );
|
||||
P( D, A, B, C, 0, 11, 0xEAA127FA );
|
||||
P( C, D, A, B, 3, 16, 0xD4EF3085 );
|
||||
P( B, C, D, A, 6, 23, 0x04881D05 );
|
||||
P( A, B, C, D, 9, 4, 0xD9D4D039 );
|
||||
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
|
||||
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
|
||||
P( B, C, D, A, 2, 23, 0xC4AC5665 );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (x | ~z))
|
||||
|
||||
P( A, B, C, D, 0, 6, 0xF4292244 );
|
||||
P( D, A, B, C, 7, 10, 0x432AFF97 );
|
||||
P( C, D, A, B, 14, 15, 0xAB9423A7 );
|
||||
P( B, C, D, A, 5, 21, 0xFC93A039 );
|
||||
P( A, B, C, D, 12, 6, 0x655B59C3 );
|
||||
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
|
||||
P( C, D, A, B, 10, 15, 0xFFEFF47D );
|
||||
P( B, C, D, A, 1, 21, 0x85845DD1 );
|
||||
P( A, B, C, D, 8, 6, 0x6FA87E4F );
|
||||
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
|
||||
P( C, D, A, B, 6, 15, 0xA3014314 );
|
||||
P( B, C, D, A, 13, 21, 0x4E0811A1 );
|
||||
P( A, B, C, D, 4, 6, 0xF7537E82 );
|
||||
P( D, A, B, C, 11, 10, 0xBD3AF235 );
|
||||
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
|
||||
P( B, C, D, A, 9, 21, 0xEB86D391 );
|
||||
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
}
|
||||
|
||||
void md5_update( struct md5_context *ctx, uint8 *input, uint32 length )
|
||||
{
|
||||
uint32 left, fill;
|
||||
|
||||
if( ! length ) return;
|
||||
|
||||
left = ( ctx->total[0] >> 3 ) & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += length << 3;
|
||||
ctx->total[1] += length >> 29;
|
||||
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
ctx->total[1] += ctx->total[0] < ( length << 3 );
|
||||
|
||||
if( left && length >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left), (void *) input, fill );
|
||||
md5_process( ctx, ctx->buffer );
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( length >= 64 )
|
||||
{
|
||||
md5_process( ctx, input );
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
|
||||
if( length )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left), (void *) input, length );
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 md5_padding[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
void md5_finish( struct md5_context *ctx, uint8 digest[16] )
|
||||
{
|
||||
uint32 last, padn;
|
||||
uint8 msglen[8];
|
||||
|
||||
PUT_UINT32( ctx->total[0], msglen, 0 );
|
||||
PUT_UINT32( ctx->total[1], msglen, 4 );
|
||||
|
||||
last = ( ctx->total[0] >> 3 ) & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
|
||||
md5_update( ctx, md5_padding, padn );
|
||||
md5_update( ctx, msglen, 8 );
|
||||
|
||||
PUT_UINT32( ctx->state[0], digest, 0 );
|
||||
PUT_UINT32( ctx->state[1], digest, 4 );
|
||||
PUT_UINT32( ctx->state[2], digest, 8 );
|
||||
PUT_UINT32( ctx->state[3], digest, 12 );
|
||||
}
|
||||
|
||||
|
||||
/* Uses a static buffer, so beware of how it's used. */
|
||||
char *md5_asciistr(MD5DATA& md5)
|
||||
{
|
||||
uint8* digest = md5.data;
|
||||
static char str[33];
|
||||
static char trans[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
||||
int x;
|
||||
|
||||
for(x=0;x<16;x++)
|
||||
{
|
||||
str[x*2]=trans[digest[x]&0x0F];
|
||||
str[x*2+1]=trans[digest[x]>>4];
|
||||
}
|
||||
return(str);
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
#ifndef _MD5_H
|
||||
#define _MD5_H
|
||||
|
||||
#include "../types.h"
|
||||
#include "valuearray.h"
|
||||
|
||||
struct md5_context
|
||||
{
|
||||
u32 total[2];
|
||||
u32 state[4];
|
||||
u8 buffer[64];
|
||||
};
|
||||
|
||||
typedef ValueArray<uint8,16> MD5DATA;
|
||||
|
||||
void md5_starts( struct md5_context *ctx );
|
||||
void md5_update( struct md5_context *ctx, u8 *input, u32 length );
|
||||
void md5_finish( struct md5_context *ctx, u8 digest[16] );
|
||||
|
||||
/* Uses a static buffer, so beware of how it's used. */
|
||||
char *md5_asciistr(MD5DATA& md5);
|
||||
|
||||
#endif /* md5.h */
|
||||
#ifndef _MD5_H
|
||||
#define _MD5_H
|
||||
|
||||
#include "../types.h"
|
||||
#include "valuearray.h"
|
||||
|
||||
struct md5_context
|
||||
{
|
||||
u32 total[2];
|
||||
u32 state[4];
|
||||
u8 buffer[64];
|
||||
};
|
||||
|
||||
typedef ValueArray<uint8,16> MD5DATA;
|
||||
|
||||
void md5_starts( struct md5_context *ctx );
|
||||
void md5_update( struct md5_context *ctx, u8 *input, u32 length );
|
||||
void md5_finish( struct md5_context *ctx, u8 digest[16] );
|
||||
|
||||
/* Uses a static buffer, so beware of how it's used. */
|
||||
char *md5_asciistr(MD5DATA& md5);
|
||||
|
||||
#endif /* md5.h */
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#ifndef _VALUEARRAY_H_
|
||||
#define _VALUEARRAY_H_
|
||||
|
||||
template<typename T, int N>
|
||||
struct ValueArray
|
||||
{
|
||||
T data[N];
|
||||
T &operator[](int index) { return data[index]; }
|
||||
static const int size = N;
|
||||
bool operator!=(ValueArray<T,N> &other) { return !operator==(other); }
|
||||
bool operator==(ValueArray<T,N> &other)
|
||||
{
|
||||
for(int i=0;i<size;i++)
|
||||
if(data[i] != other[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _VALUEARRAY_H_
|
||||
#define _VALUEARRAY_H_
|
||||
|
||||
template<typename T, int N>
|
||||
struct ValueArray
|
||||
{
|
||||
T data[N];
|
||||
T &operator[](int index) { return data[index]; }
|
||||
static const int size = N;
|
||||
bool operator!=(ValueArray<T,N> &other) { return !operator==(other); }
|
||||
bool operator==(ValueArray<T,N> &other)
|
||||
{
|
||||
for(int i=0;i<size;i++)
|
||||
if(data[i] != other[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,114 +1,114 @@
|
|||
//taken from fceux on 10/27/08
|
||||
|
||||
#ifndef _STRINGUTIL_H_
|
||||
#define _STRINGUTIL_H_
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
|
||||
//definitions for str_strip() flags
|
||||
#define STRIP_SP 0x01 // space
|
||||
#define STRIP_TAB 0x02 // tab
|
||||
#define STRIP_CR 0x04 // carriage return
|
||||
#define STRIP_LF 0x08 // line feed
|
||||
|
||||
|
||||
int str_ucase(char *str);
|
||||
int str_lcase(char *str);
|
||||
int str_ltrim(char *str, int flags);
|
||||
int str_rtrim(char *str, int flags);
|
||||
int str_strip(char *str, int flags);
|
||||
int chr_replace(char *str, char search, char replace);
|
||||
int str_replace(char *str, char *search, char *replace);
|
||||
|
||||
int HexStringToBytesLength(const std::string& str);
|
||||
int Base64StringToBytesLength(const std::string& str);
|
||||
std::string BytesToString(const void* data, int len);
|
||||
bool StringToBytes(const std::string& str, void* data, int len);
|
||||
|
||||
std::vector<std::string> tokenize_str(const std::string & str,const std::string & delims);
|
||||
void splitpath(const char* path, char* drv, char* dir, char* name, char* ext);
|
||||
|
||||
uint16 FastStrToU16(char* s, bool& valid);
|
||||
char *U16ToDecStr(uint16 a);
|
||||
char *U32ToDecStr(uint32 a);
|
||||
char *U32ToDecStr(char* buf, uint32 a);
|
||||
char *U8ToDecStr(uint8 a);
|
||||
char *U8ToHexStr(uint8 a);
|
||||
char *U16ToHexStr(uint16 a);
|
||||
|
||||
std::string stditoa(int n);
|
||||
|
||||
std::string readNullTerminatedAscii(std::istream* is);
|
||||
|
||||
//extracts a decimal uint from an istream
|
||||
template<typename T> T templateIntegerDecFromIstream(std::istream* is)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
bool pre = true;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int c = is->get();
|
||||
if(c == -1) return ret;
|
||||
int d = c - '0';
|
||||
if((d<0 || d>9))
|
||||
{
|
||||
if(!pre)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
pre = false;
|
||||
ret *= 10;
|
||||
ret += d;
|
||||
}
|
||||
}
|
||||
is->unget();
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline u32 u32DecFromIstream(std::istream* is) { return templateIntegerDecFromIstream<u32>(is); }
|
||||
inline u64 u64DecFromIstream(std::istream* is) { return templateIntegerDecFromIstream<u64>(is); }
|
||||
|
||||
//puts an optionally 0-padded decimal integer of type T into the ostream (0-padding is quicker)
|
||||
template<typename T, int DIGITS, bool PAD> void putdec(std::ostream* os, T dec)
|
||||
{
|
||||
char temp[DIGITS];
|
||||
int ctr = 0;
|
||||
for(int i=0;i<DIGITS;i++)
|
||||
{
|
||||
int quot = dec/10;
|
||||
int rem = dec%10;
|
||||
temp[DIGITS-1-i] = '0' + rem;
|
||||
if(!PAD)
|
||||
{
|
||||
if(rem != 0) ctr = i;
|
||||
}
|
||||
dec = quot;
|
||||
}
|
||||
if(!PAD)
|
||||
os->write(temp+DIGITS-ctr-1,ctr+1);
|
||||
else
|
||||
os->write(temp,DIGITS);
|
||||
}
|
||||
|
||||
std::string mass_replace(const std::string &source, const std::string &victim, const std::string &replacement);
|
||||
|
||||
std::wstring mbstowcs(std::string str);
|
||||
std::string wcstombs(std::wstring str);
|
||||
|
||||
|
||||
|
||||
//TODO - dont we already have another function that can do this
|
||||
std::string getExtension(const char* input);
|
||||
|
||||
|
||||
#endif
|
||||
//taken from fceux on 10/27/08
|
||||
|
||||
#ifndef _STRINGUTIL_H_
|
||||
#define _STRINGUTIL_H_
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
|
||||
//definitions for str_strip() flags
|
||||
#define STRIP_SP 0x01 // space
|
||||
#define STRIP_TAB 0x02 // tab
|
||||
#define STRIP_CR 0x04 // carriage return
|
||||
#define STRIP_LF 0x08 // line feed
|
||||
|
||||
|
||||
int str_ucase(char *str);
|
||||
int str_lcase(char *str);
|
||||
int str_ltrim(char *str, int flags);
|
||||
int str_rtrim(char *str, int flags);
|
||||
int str_strip(char *str, int flags);
|
||||
int chr_replace(char *str, char search, char replace);
|
||||
int str_replace(char *str, char *search, char *replace);
|
||||
|
||||
int HexStringToBytesLength(const std::string& str);
|
||||
int Base64StringToBytesLength(const std::string& str);
|
||||
std::string BytesToString(const void* data, int len);
|
||||
bool StringToBytes(const std::string& str, void* data, int len);
|
||||
|
||||
std::vector<std::string> tokenize_str(const std::string & str,const std::string & delims);
|
||||
void splitpath(const char* path, char* drv, char* dir, char* name, char* ext);
|
||||
|
||||
uint16 FastStrToU16(char* s, bool& valid);
|
||||
char *U16ToDecStr(uint16 a);
|
||||
char *U32ToDecStr(uint32 a);
|
||||
char *U32ToDecStr(char* buf, uint32 a);
|
||||
char *U8ToDecStr(uint8 a);
|
||||
char *U8ToHexStr(uint8 a);
|
||||
char *U16ToHexStr(uint16 a);
|
||||
|
||||
std::string stditoa(int n);
|
||||
|
||||
std::string readNullTerminatedAscii(std::istream* is);
|
||||
|
||||
//extracts a decimal uint from an istream
|
||||
template<typename T> T templateIntegerDecFromIstream(std::istream* is)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
bool pre = true;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int c = is->get();
|
||||
if(c == -1) return ret;
|
||||
int d = c - '0';
|
||||
if((d<0 || d>9))
|
||||
{
|
||||
if(!pre)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
pre = false;
|
||||
ret *= 10;
|
||||
ret += d;
|
||||
}
|
||||
}
|
||||
is->unget();
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline u32 u32DecFromIstream(std::istream* is) { return templateIntegerDecFromIstream<u32>(is); }
|
||||
inline u64 u64DecFromIstream(std::istream* is) { return templateIntegerDecFromIstream<u64>(is); }
|
||||
|
||||
//puts an optionally 0-padded decimal integer of type T into the ostream (0-padding is quicker)
|
||||
template<typename T, int DIGITS, bool PAD> void putdec(std::ostream* os, T dec)
|
||||
{
|
||||
char temp[DIGITS];
|
||||
int ctr = 0;
|
||||
for(int i=0;i<DIGITS;i++)
|
||||
{
|
||||
int quot = dec/10;
|
||||
int rem = dec%10;
|
||||
temp[DIGITS-1-i] = '0' + rem;
|
||||
if(!PAD)
|
||||
{
|
||||
if(rem != 0) ctr = i;
|
||||
}
|
||||
dec = quot;
|
||||
}
|
||||
if(!PAD)
|
||||
os->write(temp+DIGITS-ctr-1,ctr+1);
|
||||
else
|
||||
os->write(temp,DIGITS);
|
||||
}
|
||||
|
||||
std::string mass_replace(const std::string &source, const std::string &victim, const std::string &replacement);
|
||||
|
||||
std::wstring mbstowcs(std::string str);
|
||||
std::string wcstombs(std::wstring str);
|
||||
|
||||
|
||||
|
||||
//TODO - dont we already have another function that can do this
|
||||
std::string getExtension(const char* input);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
3022
desmume/src/wifi.cpp
3022
desmume/src/wifi.cpp
File diff suppressed because it is too large
Load Diff
1168
desmume/src/wifi.h
1168
desmume/src/wifi.h
File diff suppressed because it is too large
Load Diff
|
@ -1,335 +1,335 @@
|
|||
/* 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 "CWindow.h"
|
||||
#include "debug.h"
|
||||
|
||||
WINCLASS::WINCLASS(LPSTR rclass, HINSTANCE hInst)
|
||||
{
|
||||
memset(regclass, 0, sizeof(regclass));
|
||||
memcpy(regclass, rclass, strlen(rclass));
|
||||
|
||||
hwnd = NULL;
|
||||
hmenu = NULL;
|
||||
hInstance = hInst;
|
||||
|
||||
minWidth = 0;
|
||||
minHeight = 0;
|
||||
}
|
||||
|
||||
WINCLASS::~WINCLASS()
|
||||
{
|
||||
}
|
||||
|
||||
bool WINCLASS::create(LPSTR caption, int x, int y, int width, int height, int style, HMENU menu)
|
||||
{
|
||||
if (hwnd != NULL) return false;
|
||||
|
||||
hwnd = CreateWindow(regclass, caption, style, x, y, width, height, NULL, menu, hInstance, NULL);
|
||||
|
||||
if (hwnd != NULL) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WINCLASS::createEx(LPSTR caption, int x, int y, int width, int height, int style, int styleEx, HMENU menu)
|
||||
{
|
||||
if (hwnd != NULL) return false;
|
||||
|
||||
hwnd = CreateWindowEx(styleEx, regclass, caption, style, x, y, width, height, NULL, menu, hInstance, NULL);
|
||||
|
||||
if (hwnd != NULL) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WINCLASS::setMenu(HMENU menu)
|
||||
{
|
||||
hmenu = menu;
|
||||
return SetMenu(hwnd, hmenu);
|
||||
}
|
||||
|
||||
DWORD WINCLASS::checkMenu(UINT idd, UINT check)
|
||||
{
|
||||
return CheckMenuItem(hmenu, idd, check);
|
||||
}
|
||||
|
||||
HWND WINCLASS::getHWnd()
|
||||
{
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
void WINCLASS::Show(int mode)
|
||||
{
|
||||
ShowWindow(hwnd, mode);
|
||||
}
|
||||
|
||||
void WINCLASS::Hide()
|
||||
{
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
}
|
||||
|
||||
void WINCLASS::setMinSize(int width, int height)
|
||||
{
|
||||
minWidth = width;
|
||||
minHeight = height;
|
||||
}
|
||||
|
||||
void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, BOOL keepRatio)
|
||||
{
|
||||
RECT *rect = (RECT*)lParam;
|
||||
|
||||
int _minWidth, _minHeight;
|
||||
|
||||
int xborder, yborder;
|
||||
int ymenu, ymenunew;
|
||||
int ycaption;
|
||||
|
||||
MENUBARINFO mbi;
|
||||
|
||||
/* Get the size of the border */
|
||||
xborder = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
yborder = GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
|
||||
/* Get the size of the menu bar */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenu = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
/* Get the size of the caption bar */
|
||||
ycaption = GetSystemMetrics(SM_CYCAPTION);
|
||||
|
||||
/* Calculate the minimum size in pixels */
|
||||
_minWidth = (xborder + minWidth + xborder);
|
||||
_minHeight = (ycaption + yborder + ymenu + minHeight + yborder);
|
||||
|
||||
/* Clamp the size to the minimum size (256x384) */
|
||||
rect->right = (rect->left + std::max(_minWidth, (int)(rect->right - rect->left)));
|
||||
rect->bottom = (rect->top + std::max(_minHeight, (int)(rect->bottom - rect->top)));
|
||||
|
||||
/* Apply the ratio stuff */
|
||||
if(keepRatio)
|
||||
{
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_RIGHT:
|
||||
case WMSZ_TOPLEFT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
{
|
||||
float ratio = ((rect->right - rect->left - xborder - xborder) / (float)minWidth);
|
||||
rect->bottom = (rect->top + ycaption + yborder + ymenu + (minHeight * ratio) + yborder);
|
||||
}
|
||||
break;
|
||||
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_BOTTOM:
|
||||
{
|
||||
float ratio = ((rect->bottom - rect->top - ycaption - yborder - ymenu - yborder) / (float)minHeight);
|
||||
rect->right = (rect->left + xborder + (minWidth * ratio) + xborder);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the height of the menu has changed during the resize */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenunew = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
if(ymenunew != ymenu)
|
||||
rect->bottom += (ymenunew - ymenu);
|
||||
}
|
||||
|
||||
void WINCLASS::setClientSize(int width, int height)
|
||||
{
|
||||
int xborder, yborder;
|
||||
int ymenu, ymenunew;
|
||||
int ycaption;
|
||||
|
||||
MENUBARINFO mbi;
|
||||
|
||||
RECT wndRect;
|
||||
int finalx, finaly;
|
||||
|
||||
/* Get the size of the border */
|
||||
xborder = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
yborder = GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
|
||||
/* Get the size of the menu bar */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenu = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
/* Get the size of the caption bar */
|
||||
ycaption = GetSystemMetrics(SM_CYCAPTION);
|
||||
|
||||
/* Finally, resize the window */
|
||||
GetWindowRect(hwnd, &wndRect);
|
||||
finalx = (xborder + width + xborder);
|
||||
finaly = (ycaption + yborder + ymenu + height + yborder);
|
||||
MoveWindow(hwnd, wndRect.left, wndRect.top, finalx, finaly, TRUE);
|
||||
|
||||
/* Oops, we also need to check if the height */
|
||||
/* of the menu bar has changed after the resize */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenunew = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
if(ymenunew != ymenu)
|
||||
MoveWindow(hwnd, wndRect.left, wndRect.top, finalx, (finaly + (ymenunew - ymenu)), TRUE);
|
||||
}
|
||||
|
||||
//========================================================= Thread class
|
||||
extern DWORD WINAPI ThreadProc(LPVOID lpParameter)
|
||||
{
|
||||
THREADCLASS *tmp = (THREADCLASS *)lpParameter;
|
||||
return tmp->ThreadFunc();
|
||||
}
|
||||
|
||||
THREADCLASS::THREADCLASS()
|
||||
{
|
||||
hThread = NULL;
|
||||
}
|
||||
|
||||
THREADCLASS::~THREADCLASS()
|
||||
{
|
||||
closeThread();
|
||||
}
|
||||
|
||||
void THREADCLASS::closeThread()
|
||||
{
|
||||
if (hThread)
|
||||
{
|
||||
CloseHandle(hThread);
|
||||
hThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool THREADCLASS::createThread()
|
||||
{
|
||||
if (hThread) return false;
|
||||
|
||||
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, this, 0, &threadID);
|
||||
if (!hThread) return false;
|
||||
//WaitForSingleObject(hThread, INFINITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
//========================================================= Tools class
|
||||
TOOLSCLASS::TOOLSCLASS(HINSTANCE hInst, int IDD, DLGPROC dlgproc)
|
||||
{
|
||||
this->dlgproc = dlgproc;
|
||||
hwnd = NULL;
|
||||
hInstance = hInst;
|
||||
idd=IDD;
|
||||
memset(class_name, 0, sizeof(class_name));
|
||||
memset(class_name2, 0, sizeof(class_name2));
|
||||
}
|
||||
|
||||
TOOLSCLASS::~TOOLSCLASS()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
bool TOOLSCLASS::open()
|
||||
{
|
||||
if (!createThread()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TOOLSCLASS::close()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
DWORD TOOLSCLASS::ThreadFunc()
|
||||
{
|
||||
MSG messages;
|
||||
LOG("Start thread\n");
|
||||
|
||||
GetLastError();
|
||||
hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(idd), NULL, (DLGPROC) dlgproc);
|
||||
|
||||
if (!hwnd)
|
||||
{
|
||||
LOG("error creating dialog\n");
|
||||
return (-2);
|
||||
}
|
||||
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
while (GetMessage (&messages, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&messages);
|
||||
DispatchMessage(&messages);
|
||||
}
|
||||
|
||||
unregClass();
|
||||
hwnd = NULL;
|
||||
|
||||
closeThread();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TOOLSCLASS::regClass(LPSTR class_name, WNDPROC wproc, bool SecondReg)
|
||||
{
|
||||
WNDCLASSEX wc;
|
||||
|
||||
wc.cbSize = sizeof(wc);
|
||||
if (SecondReg)
|
||||
strcpy(this->class_name2, class_name);
|
||||
else
|
||||
strcpy(this->class_name, class_name);
|
||||
|
||||
wc.lpszClassName = class_name;
|
||||
wc.hInstance = hInstance;
|
||||
wc.lpfnWndProc = wproc;
|
||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
wc.hIcon = 0;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_BTNFACE);
|
||||
wc.style = 0;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hIconSm = 0;
|
||||
|
||||
RegisterClassEx(&wc);
|
||||
}
|
||||
|
||||
void TOOLSCLASS::unregClass()
|
||||
{
|
||||
if (class_name[0])
|
||||
{
|
||||
UnregisterClass(class_name, hInstance);
|
||||
}
|
||||
if (class_name2[0])
|
||||
{
|
||||
UnregisterClass(class_name2, hInstance);
|
||||
}
|
||||
memset(class_name, 0, sizeof(class_name));
|
||||
memset(class_name2, 0, sizeof(class_name2));
|
||||
}
|
||||
/* 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 "CWindow.h"
|
||||
#include "debug.h"
|
||||
|
||||
WINCLASS::WINCLASS(LPSTR rclass, HINSTANCE hInst)
|
||||
{
|
||||
memset(regclass, 0, sizeof(regclass));
|
||||
memcpy(regclass, rclass, strlen(rclass));
|
||||
|
||||
hwnd = NULL;
|
||||
hmenu = NULL;
|
||||
hInstance = hInst;
|
||||
|
||||
minWidth = 0;
|
||||
minHeight = 0;
|
||||
}
|
||||
|
||||
WINCLASS::~WINCLASS()
|
||||
{
|
||||
}
|
||||
|
||||
bool WINCLASS::create(LPSTR caption, int x, int y, int width, int height, int style, HMENU menu)
|
||||
{
|
||||
if (hwnd != NULL) return false;
|
||||
|
||||
hwnd = CreateWindow(regclass, caption, style, x, y, width, height, NULL, menu, hInstance, NULL);
|
||||
|
||||
if (hwnd != NULL) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WINCLASS::createEx(LPSTR caption, int x, int y, int width, int height, int style, int styleEx, HMENU menu)
|
||||
{
|
||||
if (hwnd != NULL) return false;
|
||||
|
||||
hwnd = CreateWindowEx(styleEx, regclass, caption, style, x, y, width, height, NULL, menu, hInstance, NULL);
|
||||
|
||||
if (hwnd != NULL) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WINCLASS::setMenu(HMENU menu)
|
||||
{
|
||||
hmenu = menu;
|
||||
return SetMenu(hwnd, hmenu);
|
||||
}
|
||||
|
||||
DWORD WINCLASS::checkMenu(UINT idd, UINT check)
|
||||
{
|
||||
return CheckMenuItem(hmenu, idd, check);
|
||||
}
|
||||
|
||||
HWND WINCLASS::getHWnd()
|
||||
{
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
void WINCLASS::Show(int mode)
|
||||
{
|
||||
ShowWindow(hwnd, mode);
|
||||
}
|
||||
|
||||
void WINCLASS::Hide()
|
||||
{
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
}
|
||||
|
||||
void WINCLASS::setMinSize(int width, int height)
|
||||
{
|
||||
minWidth = width;
|
||||
minHeight = height;
|
||||
}
|
||||
|
||||
void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, BOOL keepRatio)
|
||||
{
|
||||
RECT *rect = (RECT*)lParam;
|
||||
|
||||
int _minWidth, _minHeight;
|
||||
|
||||
int xborder, yborder;
|
||||
int ymenu, ymenunew;
|
||||
int ycaption;
|
||||
|
||||
MENUBARINFO mbi;
|
||||
|
||||
/* Get the size of the border */
|
||||
xborder = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
yborder = GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
|
||||
/* Get the size of the menu bar */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenu = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
/* Get the size of the caption bar */
|
||||
ycaption = GetSystemMetrics(SM_CYCAPTION);
|
||||
|
||||
/* Calculate the minimum size in pixels */
|
||||
_minWidth = (xborder + minWidth + xborder);
|
||||
_minHeight = (ycaption + yborder + ymenu + minHeight + yborder);
|
||||
|
||||
/* Clamp the size to the minimum size (256x384) */
|
||||
rect->right = (rect->left + std::max(_minWidth, (int)(rect->right - rect->left)));
|
||||
rect->bottom = (rect->top + std::max(_minHeight, (int)(rect->bottom - rect->top)));
|
||||
|
||||
/* Apply the ratio stuff */
|
||||
if(keepRatio)
|
||||
{
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_RIGHT:
|
||||
case WMSZ_TOPLEFT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
{
|
||||
float ratio = ((rect->right - rect->left - xborder - xborder) / (float)minWidth);
|
||||
rect->bottom = (rect->top + ycaption + yborder + ymenu + (minHeight * ratio) + yborder);
|
||||
}
|
||||
break;
|
||||
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_BOTTOM:
|
||||
{
|
||||
float ratio = ((rect->bottom - rect->top - ycaption - yborder - ymenu - yborder) / (float)minHeight);
|
||||
rect->right = (rect->left + xborder + (minWidth * ratio) + xborder);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the height of the menu has changed during the resize */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenunew = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
if(ymenunew != ymenu)
|
||||
rect->bottom += (ymenunew - ymenu);
|
||||
}
|
||||
|
||||
void WINCLASS::setClientSize(int width, int height)
|
||||
{
|
||||
int xborder, yborder;
|
||||
int ymenu, ymenunew;
|
||||
int ycaption;
|
||||
|
||||
MENUBARINFO mbi;
|
||||
|
||||
RECT wndRect;
|
||||
int finalx, finaly;
|
||||
|
||||
/* Get the size of the border */
|
||||
xborder = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
yborder = GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
|
||||
/* Get the size of the menu bar */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenu = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
/* Get the size of the caption bar */
|
||||
ycaption = GetSystemMetrics(SM_CYCAPTION);
|
||||
|
||||
/* Finally, resize the window */
|
||||
GetWindowRect(hwnd, &wndRect);
|
||||
finalx = (xborder + width + xborder);
|
||||
finaly = (ycaption + yborder + ymenu + height + yborder);
|
||||
MoveWindow(hwnd, wndRect.left, wndRect.top, finalx, finaly, TRUE);
|
||||
|
||||
/* Oops, we also need to check if the height */
|
||||
/* of the menu bar has changed after the resize */
|
||||
ZeroMemory(&mbi, sizeof(mbi));
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
|
||||
ymenunew = (mbi.rcBar.bottom - mbi.rcBar.top + 1);
|
||||
|
||||
if(ymenunew != ymenu)
|
||||
MoveWindow(hwnd, wndRect.left, wndRect.top, finalx, (finaly + (ymenunew - ymenu)), TRUE);
|
||||
}
|
||||
|
||||
//========================================================= Thread class
|
||||
extern DWORD WINAPI ThreadProc(LPVOID lpParameter)
|
||||
{
|
||||
THREADCLASS *tmp = (THREADCLASS *)lpParameter;
|
||||
return tmp->ThreadFunc();
|
||||
}
|
||||
|
||||
THREADCLASS::THREADCLASS()
|
||||
{
|
||||
hThread = NULL;
|
||||
}
|
||||
|
||||
THREADCLASS::~THREADCLASS()
|
||||
{
|
||||
closeThread();
|
||||
}
|
||||
|
||||
void THREADCLASS::closeThread()
|
||||
{
|
||||
if (hThread)
|
||||
{
|
||||
CloseHandle(hThread);
|
||||
hThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool THREADCLASS::createThread()
|
||||
{
|
||||
if (hThread) return false;
|
||||
|
||||
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, this, 0, &threadID);
|
||||
if (!hThread) return false;
|
||||
//WaitForSingleObject(hThread, INFINITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
//========================================================= Tools class
|
||||
TOOLSCLASS::TOOLSCLASS(HINSTANCE hInst, int IDD, DLGPROC dlgproc)
|
||||
{
|
||||
this->dlgproc = dlgproc;
|
||||
hwnd = NULL;
|
||||
hInstance = hInst;
|
||||
idd=IDD;
|
||||
memset(class_name, 0, sizeof(class_name));
|
||||
memset(class_name2, 0, sizeof(class_name2));
|
||||
}
|
||||
|
||||
TOOLSCLASS::~TOOLSCLASS()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
bool TOOLSCLASS::open()
|
||||
{
|
||||
if (!createThread()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TOOLSCLASS::close()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
DWORD TOOLSCLASS::ThreadFunc()
|
||||
{
|
||||
MSG messages;
|
||||
LOG("Start thread\n");
|
||||
|
||||
GetLastError();
|
||||
hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(idd), NULL, (DLGPROC) dlgproc);
|
||||
|
||||
if (!hwnd)
|
||||
{
|
||||
LOG("error creating dialog\n");
|
||||
return (-2);
|
||||
}
|
||||
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
while (GetMessage (&messages, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&messages);
|
||||
DispatchMessage(&messages);
|
||||
}
|
||||
|
||||
unregClass();
|
||||
hwnd = NULL;
|
||||
|
||||
closeThread();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TOOLSCLASS::regClass(LPSTR class_name, WNDPROC wproc, bool SecondReg)
|
||||
{
|
||||
WNDCLASSEX wc;
|
||||
|
||||
wc.cbSize = sizeof(wc);
|
||||
if (SecondReg)
|
||||
strcpy(this->class_name2, class_name);
|
||||
else
|
||||
strcpy(this->class_name, class_name);
|
||||
|
||||
wc.lpszClassName = class_name;
|
||||
wc.hInstance = hInstance;
|
||||
wc.lpfnWndProc = wproc;
|
||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
wc.hIcon = 0;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_BTNFACE);
|
||||
wc.style = 0;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hIconSm = 0;
|
||||
|
||||
RegisterClassEx(&wc);
|
||||
}
|
||||
|
||||
void TOOLSCLASS::unregClass()
|
||||
{
|
||||
if (class_name[0])
|
||||
{
|
||||
UnregisterClass(class_name, hInstance);
|
||||
}
|
||||
if (class_name2[0])
|
||||
{
|
||||
UnregisterClass(class_name2, hInstance);
|
||||
}
|
||||
memset(class_name, 0, sizeof(class_name));
|
||||
memset(class_name2, 0, sizeof(class_name2));
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -114,12 +114,12 @@ BOOL CALLBACK IoregView_Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
{
|
||||
KillTimer(hwnd, IDT_VIEW_IOREG);
|
||||
IORegView->autoup = false;
|
||||
}
|
||||
|
||||
if (IORegView!=NULL)
|
||||
{
|
||||
delete IORegView;
|
||||
IORegView = NULL;
|
||||
}
|
||||
|
||||
if (IORegView!=NULL)
|
||||
{
|
||||
delete IORegView;
|
||||
IORegView = NULL;
|
||||
}
|
||||
PostQuitMessage(0);
|
||||
return 1;
|
||||
|
|
|
@ -1,453 +1,453 @@
|
|||
/* aviout.cpp
|
||||
*
|
||||
* Copyright (C) 2006-2008 Zeromus
|
||||
*
|
||||
* 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 "types.h"
|
||||
#include "windriver.h"
|
||||
#include "console.h"
|
||||
#include "gfx3d.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <vfw.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
void EMU_PrintError(const char* msg) {
|
||||
LOG(msg);
|
||||
}
|
||||
|
||||
void EMU_PrintMessage(const char* msg) {
|
||||
LOG(msg);
|
||||
}
|
||||
|
||||
bool DRV_AviBegin(const char* fname);
|
||||
void DRV_AviEnd();
|
||||
void DRV_AviSoundUpdate(void* soundData, int soundLen);
|
||||
bool DRV_AviIsRecording();
|
||||
void DRV_AviVideoUpdate(const u16* buffer);
|
||||
|
||||
//extern PALETTEENTRY *color_palette;
|
||||
//extern WAVEFORMATEX wf;
|
||||
//extern int soundo;
|
||||
|
||||
#define VIDEO_STREAM 0
|
||||
#define AUDIO_STREAM 1
|
||||
|
||||
#define VIDEO_WIDTH 256
|
||||
|
||||
static struct AVIFile
|
||||
{
|
||||
int valid;
|
||||
int fps;
|
||||
int fps_scale;
|
||||
|
||||
int video_added;
|
||||
BITMAPINFOHEADER bitmap_format;
|
||||
|
||||
int sound_added;
|
||||
WAVEFORMATEX wave_format;
|
||||
|
||||
AVISTREAMINFO avi_video_header;
|
||||
AVISTREAMINFO avi_sound_header;
|
||||
PAVIFILE avi_file;
|
||||
PAVISTREAM streams[2];
|
||||
PAVISTREAM compressed_streams[2];
|
||||
|
||||
AVICOMPRESSOPTIONS compress_options[2];
|
||||
AVICOMPRESSOPTIONS* compress_options_ptr[2];
|
||||
|
||||
int video_frames;
|
||||
int sound_samples;
|
||||
|
||||
u8 convert_buffer[256*384*3];
|
||||
int start_scanline;
|
||||
int end_scanline;
|
||||
|
||||
long tBytes, ByteBuffer;
|
||||
} *avi_file = NULL;
|
||||
|
||||
struct VideoSystemInfo
|
||||
{
|
||||
int start_scanline;
|
||||
int end_scanline;
|
||||
int fps;
|
||||
};
|
||||
|
||||
|
||||
static char saved_cur_avi_fnameandext[MAX_PATH];
|
||||
static char saved_avi_fname[MAX_PATH];
|
||||
static char saved_avi_ext[MAX_PATH];
|
||||
static int avi_segnum=0;
|
||||
//static FILE* avi_check_file=0;
|
||||
static struct AVIFile saved_avi_info;
|
||||
static int use_prev_options=0;
|
||||
static bool use_sound=false;
|
||||
|
||||
|
||||
|
||||
static bool truncate_existing(const char* filename)
|
||||
{
|
||||
// this is only here because AVIFileOpen doesn't seem to do it for us
|
||||
FILE* fd = fopen(filename, "wb");
|
||||
if(fd)
|
||||
{
|
||||
fclose(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void avi_create(struct AVIFile** avi_out)
|
||||
{
|
||||
*avi_out = (struct AVIFile*)malloc(sizeof(struct AVIFile));
|
||||
memset(*avi_out, 0, sizeof(struct AVIFile));
|
||||
AVIFileInit();
|
||||
}
|
||||
|
||||
static void avi_destroy(struct AVIFile** avi_out)
|
||||
{
|
||||
if(!(*avi_out))
|
||||
return;
|
||||
|
||||
if((*avi_out)->sound_added)
|
||||
{
|
||||
if((*avi_out)->compressed_streams[AUDIO_STREAM])
|
||||
{
|
||||
LONG test = AVIStreamClose((*avi_out)->compressed_streams[AUDIO_STREAM]);
|
||||
(*avi_out)->compressed_streams[AUDIO_STREAM] = NULL;
|
||||
(*avi_out)->streams[AUDIO_STREAM] = NULL; // compressed_streams[AUDIO_STREAM] is just a copy of streams[AUDIO_STREAM]
|
||||
}
|
||||
}
|
||||
|
||||
if((*avi_out)->video_added)
|
||||
{
|
||||
if((*avi_out)->compressed_streams[VIDEO_STREAM])
|
||||
{
|
||||
AVIStreamClose((*avi_out)->compressed_streams[VIDEO_STREAM]);
|
||||
(*avi_out)->compressed_streams[VIDEO_STREAM] = NULL;
|
||||
}
|
||||
|
||||
if((*avi_out)->streams[VIDEO_STREAM])
|
||||
{
|
||||
AVIStreamClose((*avi_out)->streams[VIDEO_STREAM]);
|
||||
(*avi_out)->streams[VIDEO_STREAM] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if((*avi_out)->avi_file)
|
||||
{
|
||||
AVIFileClose((*avi_out)->avi_file);
|
||||
(*avi_out)->avi_file = NULL;
|
||||
}
|
||||
|
||||
free(*avi_out);
|
||||
*avi_out = NULL;
|
||||
}
|
||||
|
||||
static void set_video_format(const BITMAPINFOHEADER* bitmap_format, struct AVIFile* avi_out)
|
||||
{
|
||||
memcpy(&((*avi_out).bitmap_format), bitmap_format, sizeof(BITMAPINFOHEADER));
|
||||
(*avi_out).video_added = 1;
|
||||
}
|
||||
|
||||
static void set_sound_format(const WAVEFORMATEX* wave_format, struct AVIFile* avi_out)
|
||||
{
|
||||
memcpy(&((*avi_out).wave_format), wave_format, sizeof(WAVEFORMATEX));
|
||||
(*avi_out).sound_added = 1;
|
||||
}
|
||||
|
||||
static int avi_open(const char* filename, const BITMAPINFOHEADER* pbmih, const WAVEFORMATEX* pwfex)
|
||||
{
|
||||
int error = 1;
|
||||
int result = 0;
|
||||
|
||||
do
|
||||
{
|
||||
// close existing first
|
||||
DRV_AviEnd();
|
||||
|
||||
if(!truncate_existing(filename))
|
||||
break;
|
||||
|
||||
if(!pbmih)
|
||||
break;
|
||||
|
||||
// create the object
|
||||
avi_create(&avi_file);
|
||||
|
||||
// set video size and framerate
|
||||
/*avi_file->start_scanline = vsi->start_scanline;
|
||||
avi_file->end_scanline = vsi->end_scanline;
|
||||
avi_file->fps = vsi->fps;
|
||||
avi_file->fps_scale = 16777216-1;
|
||||
avi_file->convert_buffer = new u8[256*384*3];*/
|
||||
|
||||
// open the file
|
||||
if(FAILED(AVIFileOpen(&avi_file->avi_file, filename, OF_CREATE | OF_WRITE, NULL)))
|
||||
break;
|
||||
|
||||
// create the video stream
|
||||
set_video_format(pbmih, avi_file);
|
||||
|
||||
memset(&avi_file->avi_video_header, 0, sizeof(AVISTREAMINFO));
|
||||
avi_file->avi_video_header.fccType = streamtypeVIDEO;
|
||||
avi_file->avi_video_header.dwScale = 65536*256;
|
||||
avi_file->avi_video_header.dwRate = (int)(59.8261*65536*256);
|
||||
avi_file->avi_video_header.dwSuggestedBufferSize = avi_file->bitmap_format.biSizeImage;
|
||||
if(FAILED(AVIFileCreateStream(avi_file->avi_file, &avi_file->streams[VIDEO_STREAM], &avi_file->avi_video_header)))
|
||||
break;
|
||||
|
||||
if(use_prev_options)
|
||||
{
|
||||
avi_file->compress_options[VIDEO_STREAM] = saved_avi_info.compress_options[VIDEO_STREAM];
|
||||
avi_file->compress_options_ptr[VIDEO_STREAM] = &avi_file->compress_options[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
// get compression options
|
||||
memset(&avi_file->compress_options[VIDEO_STREAM], 0, sizeof(AVICOMPRESSOPTIONS));
|
||||
avi_file->compress_options_ptr[VIDEO_STREAM] = &avi_file->compress_options[0];
|
||||
//retryAviSaveOptions: //mbg merge 7/17/06 removed
|
||||
error = 0;
|
||||
if(!AVISaveOptions(MainWindow->getHWnd(), 0, 1, &avi_file->streams[VIDEO_STREAM], &avi_file->compress_options_ptr[VIDEO_STREAM]))
|
||||
break;
|
||||
error = 1;
|
||||
}
|
||||
|
||||
// create compressed stream
|
||||
if(FAILED(AVIMakeCompressedStream(&avi_file->compressed_streams[VIDEO_STREAM], avi_file->streams[VIDEO_STREAM], &avi_file->compress_options[VIDEO_STREAM], NULL)))
|
||||
break;
|
||||
|
||||
// set the stream format
|
||||
if(FAILED(AVIStreamSetFormat(avi_file->compressed_streams[VIDEO_STREAM], 0, (void*)&avi_file->bitmap_format, avi_file->bitmap_format.biSize)))
|
||||
break;
|
||||
|
||||
// add sound (if requested)
|
||||
if(pwfex)
|
||||
{
|
||||
// add audio format
|
||||
set_sound_format(pwfex, avi_file);
|
||||
|
||||
// create the audio stream
|
||||
memset(&avi_file->avi_sound_header, 0, sizeof(AVISTREAMINFO));
|
||||
avi_file->avi_sound_header.fccType = streamtypeAUDIO;
|
||||
avi_file->avi_sound_header.dwQuality = (DWORD)-1;
|
||||
avi_file->avi_sound_header.dwScale = avi_file->wave_format.nBlockAlign;
|
||||
avi_file->avi_sound_header.dwRate = avi_file->wave_format.nAvgBytesPerSec;
|
||||
avi_file->avi_sound_header.dwSampleSize = avi_file->wave_format.nBlockAlign;
|
||||
avi_file->avi_sound_header.dwInitialFrames = 1;
|
||||
if(FAILED(AVIFileCreateStream(avi_file->avi_file, &avi_file->streams[AUDIO_STREAM], &avi_file->avi_sound_header)))
|
||||
break;
|
||||
|
||||
// AVISaveOptions doesn't seem to work for audio streams
|
||||
// so here we just copy the pointer for the compressed stream
|
||||
avi_file->compressed_streams[AUDIO_STREAM] = avi_file->streams[AUDIO_STREAM];
|
||||
|
||||
// set the stream format
|
||||
if(FAILED(AVIStreamSetFormat(avi_file->compressed_streams[AUDIO_STREAM], 0, (void*)&avi_file->wave_format, sizeof(WAVEFORMATEX))))
|
||||
break;
|
||||
}
|
||||
|
||||
// initialize counters
|
||||
avi_file->video_frames = 0;
|
||||
avi_file->sound_samples = 0;
|
||||
avi_file->tBytes = 0;
|
||||
avi_file->ByteBuffer = 0;
|
||||
|
||||
// success
|
||||
error = 0;
|
||||
result = 1;
|
||||
avi_file->valid = 1;
|
||||
|
||||
} while(0);
|
||||
|
||||
if(!result)
|
||||
{
|
||||
avi_destroy(&avi_file);
|
||||
if(error)
|
||||
EMU_PrintError("Error writing AVI file");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//converts 16bpp to 24bpp and flips
|
||||
static void do_video_conversion(const u16* buffer)
|
||||
{
|
||||
u8* outbuf = avi_file->convert_buffer + 256*(384-1)*3;
|
||||
|
||||
for(int y=0;y<384;y++)
|
||||
{
|
||||
for(int x=0;x<256;x++)
|
||||
{
|
||||
u16 col16 = *buffer++;
|
||||
col16 &=0x7FFF;
|
||||
u32 col24 = color_15bit_to_24bit[col16];
|
||||
*outbuf++ = (col24>>16)&0xFF;
|
||||
*outbuf++ = (col24>>8)&0xFF;
|
||||
*outbuf++ = col24&0xFF;
|
||||
}
|
||||
|
||||
outbuf -= 256*3*2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool AviNextSegment()
|
||||
{
|
||||
char avi_fname[MAX_PATH];
|
||||
strcpy(avi_fname,saved_avi_fname);
|
||||
char avi_fname_temp[MAX_PATH];
|
||||
sprintf(avi_fname_temp, "%s_part%d%s", avi_fname, avi_segnum+2, saved_avi_ext);
|
||||
saved_avi_info=*avi_file;
|
||||
use_prev_options=1;
|
||||
avi_segnum++;
|
||||
bool ret = DRV_AviBegin(avi_fname_temp);
|
||||
use_prev_options=0;
|
||||
strcpy(saved_avi_fname,avi_fname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool DRV_AviBegin(const char* fname)
|
||||
{
|
||||
DRV_AviEnd();
|
||||
|
||||
BITMAPINFOHEADER bi;
|
||||
memset(&bi, 0, sizeof(bi));
|
||||
bi.biSize = 0x28;
|
||||
bi.biPlanes = 1;
|
||||
bi.biBitCount = 24;
|
||||
bi.biWidth = 256;
|
||||
bi.biHeight = 384;
|
||||
bi.biSizeImage = 3 * 256 * 384;
|
||||
|
||||
WAVEFORMATEX wf;
|
||||
wf.cbSize = sizeof(WAVEFORMATEX);
|
||||
wf.nAvgBytesPerSec = 44100 * 4;
|
||||
wf.nBlockAlign = 4;
|
||||
wf.nChannels = 2;
|
||||
wf.nSamplesPerSec = 44100;
|
||||
wf.wBitsPerSample = 16;
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
|
||||
|
||||
saved_avi_ext[0]='\0';
|
||||
|
||||
//mbg 8/10/08 - decide whether there will be sound in this movie
|
||||
//if this is a new movie..
|
||||
/*if(!avi_file) {
|
||||
if(FSettings.SndRate)
|
||||
use_sound = true;
|
||||
else use_sound = false;
|
||||
}*/
|
||||
|
||||
//mbg 8/10/08 - if there is no sound in this movie, then dont open the audio stream
|
||||
WAVEFORMATEX* pwf = &wf;
|
||||
//if(!use_sound)
|
||||
// pwf = 0;
|
||||
|
||||
|
||||
if(!avi_open(fname, &bi, pwf))
|
||||
{
|
||||
saved_avi_fname[0]='\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Don't display at file splits
|
||||
if(!avi_segnum)
|
||||
EMU_PrintMessage("AVI recording started.");
|
||||
|
||||
strncpy(saved_cur_avi_fnameandext,fname,MAX_PATH);
|
||||
strncpy(saved_avi_fname,fname,MAX_PATH);
|
||||
char* dot = strrchr(saved_avi_fname, '.');
|
||||
if(dot && dot > strrchr(saved_avi_fname, '/') && dot > strrchr(saved_avi_fname, '\\'))
|
||||
{
|
||||
strcpy(saved_avi_ext,dot);
|
||||
dot[0]='\0';
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void DRV_AviVideoUpdate(const u16* buffer)
|
||||
{
|
||||
if(!avi_file || !avi_file->valid)
|
||||
return;
|
||||
|
||||
do_video_conversion(buffer);
|
||||
|
||||
if(FAILED(AVIStreamWrite(avi_file->compressed_streams[VIDEO_STREAM],
|
||||
avi_file->video_frames, 1, avi_file->convert_buffer,
|
||||
avi_file->bitmap_format.biSizeImage, AVIIF_KEYFRAME,
|
||||
NULL, &avi_file->ByteBuffer)))
|
||||
{
|
||||
avi_file->valid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
avi_file->video_frames++;
|
||||
avi_file->tBytes += avi_file->ByteBuffer;
|
||||
|
||||
// segment / split AVI when it's almost 2 GB (2000MB, to be precise)
|
||||
if(!(avi_file->video_frames % 60) && avi_file->tBytes > 2097152000)
|
||||
AviNextSegment();
|
||||
}
|
||||
|
||||
void DRV_AviSoundUpdate(void* soundData, int soundLen)
|
||||
{
|
||||
int nBytes;
|
||||
|
||||
if(!avi_file || !avi_file->valid || !avi_file->sound_added)
|
||||
return;
|
||||
|
||||
nBytes = soundLen * avi_file->wave_format.nBlockAlign;
|
||||
if(FAILED(AVIStreamWrite(avi_file->compressed_streams[AUDIO_STREAM],
|
||||
avi_file->sound_samples, soundLen,
|
||||
soundData, nBytes, 0, NULL, &avi_file->ByteBuffer)))
|
||||
{
|
||||
avi_file->valid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
avi_file->sound_samples += soundLen;
|
||||
avi_file->tBytes += avi_file->ByteBuffer;
|
||||
}
|
||||
|
||||
void DRV_AviEnd()
|
||||
{
|
||||
if(!avi_file)
|
||||
return;
|
||||
|
||||
// Don't display if we're just starting another segment
|
||||
if(avi_file->tBytes <= 2097152000)
|
||||
EMU_PrintMessage("AVI recording ended.");
|
||||
|
||||
avi_destroy(&avi_file);
|
||||
}
|
||||
|
||||
bool DRV_AviIsRecording()
|
||||
{
|
||||
if(avi_file)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
/* aviout.cpp
|
||||
*
|
||||
* Copyright (C) 2006-2008 Zeromus
|
||||
*
|
||||
* 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 "types.h"
|
||||
#include "windriver.h"
|
||||
#include "console.h"
|
||||
#include "gfx3d.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <vfw.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
void EMU_PrintError(const char* msg) {
|
||||
LOG(msg);
|
||||
}
|
||||
|
||||
void EMU_PrintMessage(const char* msg) {
|
||||
LOG(msg);
|
||||
}
|
||||
|
||||
bool DRV_AviBegin(const char* fname);
|
||||
void DRV_AviEnd();
|
||||
void DRV_AviSoundUpdate(void* soundData, int soundLen);
|
||||
bool DRV_AviIsRecording();
|
||||
void DRV_AviVideoUpdate(const u16* buffer);
|
||||
|
||||
//extern PALETTEENTRY *color_palette;
|
||||
//extern WAVEFORMATEX wf;
|
||||
//extern int soundo;
|
||||
|
||||
#define VIDEO_STREAM 0
|
||||
#define AUDIO_STREAM 1
|
||||
|
||||
#define VIDEO_WIDTH 256
|
||||
|
||||
static struct AVIFile
|
||||
{
|
||||
int valid;
|
||||
int fps;
|
||||
int fps_scale;
|
||||
|
||||
int video_added;
|
||||
BITMAPINFOHEADER bitmap_format;
|
||||
|
||||
int sound_added;
|
||||
WAVEFORMATEX wave_format;
|
||||
|
||||
AVISTREAMINFO avi_video_header;
|
||||
AVISTREAMINFO avi_sound_header;
|
||||
PAVIFILE avi_file;
|
||||
PAVISTREAM streams[2];
|
||||
PAVISTREAM compressed_streams[2];
|
||||
|
||||
AVICOMPRESSOPTIONS compress_options[2];
|
||||
AVICOMPRESSOPTIONS* compress_options_ptr[2];
|
||||
|
||||
int video_frames;
|
||||
int sound_samples;
|
||||
|
||||
u8 convert_buffer[256*384*3];
|
||||
int start_scanline;
|
||||
int end_scanline;
|
||||
|
||||
long tBytes, ByteBuffer;
|
||||
} *avi_file = NULL;
|
||||
|
||||
struct VideoSystemInfo
|
||||
{
|
||||
int start_scanline;
|
||||
int end_scanline;
|
||||
int fps;
|
||||
};
|
||||
|
||||
|
||||
static char saved_cur_avi_fnameandext[MAX_PATH];
|
||||
static char saved_avi_fname[MAX_PATH];
|
||||
static char saved_avi_ext[MAX_PATH];
|
||||
static int avi_segnum=0;
|
||||
//static FILE* avi_check_file=0;
|
||||
static struct AVIFile saved_avi_info;
|
||||
static int use_prev_options=0;
|
||||
static bool use_sound=false;
|
||||
|
||||
|
||||
|
||||
static bool truncate_existing(const char* filename)
|
||||
{
|
||||
// this is only here because AVIFileOpen doesn't seem to do it for us
|
||||
FILE* fd = fopen(filename, "wb");
|
||||
if(fd)
|
||||
{
|
||||
fclose(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void avi_create(struct AVIFile** avi_out)
|
||||
{
|
||||
*avi_out = (struct AVIFile*)malloc(sizeof(struct AVIFile));
|
||||
memset(*avi_out, 0, sizeof(struct AVIFile));
|
||||
AVIFileInit();
|
||||
}
|
||||
|
||||
static void avi_destroy(struct AVIFile** avi_out)
|
||||
{
|
||||
if(!(*avi_out))
|
||||
return;
|
||||
|
||||
if((*avi_out)->sound_added)
|
||||
{
|
||||
if((*avi_out)->compressed_streams[AUDIO_STREAM])
|
||||
{
|
||||
LONG test = AVIStreamClose((*avi_out)->compressed_streams[AUDIO_STREAM]);
|
||||
(*avi_out)->compressed_streams[AUDIO_STREAM] = NULL;
|
||||
(*avi_out)->streams[AUDIO_STREAM] = NULL; // compressed_streams[AUDIO_STREAM] is just a copy of streams[AUDIO_STREAM]
|
||||
}
|
||||
}
|
||||
|
||||
if((*avi_out)->video_added)
|
||||
{
|
||||
if((*avi_out)->compressed_streams[VIDEO_STREAM])
|
||||
{
|
||||
AVIStreamClose((*avi_out)->compressed_streams[VIDEO_STREAM]);
|
||||
(*avi_out)->compressed_streams[VIDEO_STREAM] = NULL;
|
||||
}
|
||||
|
||||
if((*avi_out)->streams[VIDEO_STREAM])
|
||||
{
|
||||
AVIStreamClose((*avi_out)->streams[VIDEO_STREAM]);
|
||||
(*avi_out)->streams[VIDEO_STREAM] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if((*avi_out)->avi_file)
|
||||
{
|
||||
AVIFileClose((*avi_out)->avi_file);
|
||||
(*avi_out)->avi_file = NULL;
|
||||
}
|
||||
|
||||
free(*avi_out);
|
||||
*avi_out = NULL;
|
||||
}
|
||||
|
||||
static void set_video_format(const BITMAPINFOHEADER* bitmap_format, struct AVIFile* avi_out)
|
||||
{
|
||||
memcpy(&((*avi_out).bitmap_format), bitmap_format, sizeof(BITMAPINFOHEADER));
|
||||
(*avi_out).video_added = 1;
|
||||
}
|
||||
|
||||
static void set_sound_format(const WAVEFORMATEX* wave_format, struct AVIFile* avi_out)
|
||||
{
|
||||
memcpy(&((*avi_out).wave_format), wave_format, sizeof(WAVEFORMATEX));
|
||||
(*avi_out).sound_added = 1;
|
||||
}
|
||||
|
||||
static int avi_open(const char* filename, const BITMAPINFOHEADER* pbmih, const WAVEFORMATEX* pwfex)
|
||||
{
|
||||
int error = 1;
|
||||
int result = 0;
|
||||
|
||||
do
|
||||
{
|
||||
// close existing first
|
||||
DRV_AviEnd();
|
||||
|
||||
if(!truncate_existing(filename))
|
||||
break;
|
||||
|
||||
if(!pbmih)
|
||||
break;
|
||||
|
||||
// create the object
|
||||
avi_create(&avi_file);
|
||||
|
||||
// set video size and framerate
|
||||
/*avi_file->start_scanline = vsi->start_scanline;
|
||||
avi_file->end_scanline = vsi->end_scanline;
|
||||
avi_file->fps = vsi->fps;
|
||||
avi_file->fps_scale = 16777216-1;
|
||||
avi_file->convert_buffer = new u8[256*384*3];*/
|
||||
|
||||
// open the file
|
||||
if(FAILED(AVIFileOpen(&avi_file->avi_file, filename, OF_CREATE | OF_WRITE, NULL)))
|
||||
break;
|
||||
|
||||
// create the video stream
|
||||
set_video_format(pbmih, avi_file);
|
||||
|
||||
memset(&avi_file->avi_video_header, 0, sizeof(AVISTREAMINFO));
|
||||
avi_file->avi_video_header.fccType = streamtypeVIDEO;
|
||||
avi_file->avi_video_header.dwScale = 65536*256;
|
||||
avi_file->avi_video_header.dwRate = (int)(59.8261*65536*256);
|
||||
avi_file->avi_video_header.dwSuggestedBufferSize = avi_file->bitmap_format.biSizeImage;
|
||||
if(FAILED(AVIFileCreateStream(avi_file->avi_file, &avi_file->streams[VIDEO_STREAM], &avi_file->avi_video_header)))
|
||||
break;
|
||||
|
||||
if(use_prev_options)
|
||||
{
|
||||
avi_file->compress_options[VIDEO_STREAM] = saved_avi_info.compress_options[VIDEO_STREAM];
|
||||
avi_file->compress_options_ptr[VIDEO_STREAM] = &avi_file->compress_options[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
// get compression options
|
||||
memset(&avi_file->compress_options[VIDEO_STREAM], 0, sizeof(AVICOMPRESSOPTIONS));
|
||||
avi_file->compress_options_ptr[VIDEO_STREAM] = &avi_file->compress_options[0];
|
||||
//retryAviSaveOptions: //mbg merge 7/17/06 removed
|
||||
error = 0;
|
||||
if(!AVISaveOptions(MainWindow->getHWnd(), 0, 1, &avi_file->streams[VIDEO_STREAM], &avi_file->compress_options_ptr[VIDEO_STREAM]))
|
||||
break;
|
||||
error = 1;
|
||||
}
|
||||
|
||||
// create compressed stream
|
||||
if(FAILED(AVIMakeCompressedStream(&avi_file->compressed_streams[VIDEO_STREAM], avi_file->streams[VIDEO_STREAM], &avi_file->compress_options[VIDEO_STREAM], NULL)))
|
||||
break;
|
||||
|
||||
// set the stream format
|
||||
if(FAILED(AVIStreamSetFormat(avi_file->compressed_streams[VIDEO_STREAM], 0, (void*)&avi_file->bitmap_format, avi_file->bitmap_format.biSize)))
|
||||
break;
|
||||
|
||||
// add sound (if requested)
|
||||
if(pwfex)
|
||||
{
|
||||
// add audio format
|
||||
set_sound_format(pwfex, avi_file);
|
||||
|
||||
// create the audio stream
|
||||
memset(&avi_file->avi_sound_header, 0, sizeof(AVISTREAMINFO));
|
||||
avi_file->avi_sound_header.fccType = streamtypeAUDIO;
|
||||
avi_file->avi_sound_header.dwQuality = (DWORD)-1;
|
||||
avi_file->avi_sound_header.dwScale = avi_file->wave_format.nBlockAlign;
|
||||
avi_file->avi_sound_header.dwRate = avi_file->wave_format.nAvgBytesPerSec;
|
||||
avi_file->avi_sound_header.dwSampleSize = avi_file->wave_format.nBlockAlign;
|
||||
avi_file->avi_sound_header.dwInitialFrames = 1;
|
||||
if(FAILED(AVIFileCreateStream(avi_file->avi_file, &avi_file->streams[AUDIO_STREAM], &avi_file->avi_sound_header)))
|
||||
break;
|
||||
|
||||
// AVISaveOptions doesn't seem to work for audio streams
|
||||
// so here we just copy the pointer for the compressed stream
|
||||
avi_file->compressed_streams[AUDIO_STREAM] = avi_file->streams[AUDIO_STREAM];
|
||||
|
||||
// set the stream format
|
||||
if(FAILED(AVIStreamSetFormat(avi_file->compressed_streams[AUDIO_STREAM], 0, (void*)&avi_file->wave_format, sizeof(WAVEFORMATEX))))
|
||||
break;
|
||||
}
|
||||
|
||||
// initialize counters
|
||||
avi_file->video_frames = 0;
|
||||
avi_file->sound_samples = 0;
|
||||
avi_file->tBytes = 0;
|
||||
avi_file->ByteBuffer = 0;
|
||||
|
||||
// success
|
||||
error = 0;
|
||||
result = 1;
|
||||
avi_file->valid = 1;
|
||||
|
||||
} while(0);
|
||||
|
||||
if(!result)
|
||||
{
|
||||
avi_destroy(&avi_file);
|
||||
if(error)
|
||||
EMU_PrintError("Error writing AVI file");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//converts 16bpp to 24bpp and flips
|
||||
static void do_video_conversion(const u16* buffer)
|
||||
{
|
||||
u8* outbuf = avi_file->convert_buffer + 256*(384-1)*3;
|
||||
|
||||
for(int y=0;y<384;y++)
|
||||
{
|
||||
for(int x=0;x<256;x++)
|
||||
{
|
||||
u16 col16 = *buffer++;
|
||||
col16 &=0x7FFF;
|
||||
u32 col24 = color_15bit_to_24bit[col16];
|
||||
*outbuf++ = (col24>>16)&0xFF;
|
||||
*outbuf++ = (col24>>8)&0xFF;
|
||||
*outbuf++ = col24&0xFF;
|
||||
}
|
||||
|
||||
outbuf -= 256*3*2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool AviNextSegment()
|
||||
{
|
||||
char avi_fname[MAX_PATH];
|
||||
strcpy(avi_fname,saved_avi_fname);
|
||||
char avi_fname_temp[MAX_PATH];
|
||||
sprintf(avi_fname_temp, "%s_part%d%s", avi_fname, avi_segnum+2, saved_avi_ext);
|
||||
saved_avi_info=*avi_file;
|
||||
use_prev_options=1;
|
||||
avi_segnum++;
|
||||
bool ret = DRV_AviBegin(avi_fname_temp);
|
||||
use_prev_options=0;
|
||||
strcpy(saved_avi_fname,avi_fname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool DRV_AviBegin(const char* fname)
|
||||
{
|
||||
DRV_AviEnd();
|
||||
|
||||
BITMAPINFOHEADER bi;
|
||||
memset(&bi, 0, sizeof(bi));
|
||||
bi.biSize = 0x28;
|
||||
bi.biPlanes = 1;
|
||||
bi.biBitCount = 24;
|
||||
bi.biWidth = 256;
|
||||
bi.biHeight = 384;
|
||||
bi.biSizeImage = 3 * 256 * 384;
|
||||
|
||||
WAVEFORMATEX wf;
|
||||
wf.cbSize = sizeof(WAVEFORMATEX);
|
||||
wf.nAvgBytesPerSec = 44100 * 4;
|
||||
wf.nBlockAlign = 4;
|
||||
wf.nChannels = 2;
|
||||
wf.nSamplesPerSec = 44100;
|
||||
wf.wBitsPerSample = 16;
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
|
||||
|
||||
saved_avi_ext[0]='\0';
|
||||
|
||||
//mbg 8/10/08 - decide whether there will be sound in this movie
|
||||
//if this is a new movie..
|
||||
/*if(!avi_file) {
|
||||
if(FSettings.SndRate)
|
||||
use_sound = true;
|
||||
else use_sound = false;
|
||||
}*/
|
||||
|
||||
//mbg 8/10/08 - if there is no sound in this movie, then dont open the audio stream
|
||||
WAVEFORMATEX* pwf = &wf;
|
||||
//if(!use_sound)
|
||||
// pwf = 0;
|
||||
|
||||
|
||||
if(!avi_open(fname, &bi, pwf))
|
||||
{
|
||||
saved_avi_fname[0]='\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Don't display at file splits
|
||||
if(!avi_segnum)
|
||||
EMU_PrintMessage("AVI recording started.");
|
||||
|
||||
strncpy(saved_cur_avi_fnameandext,fname,MAX_PATH);
|
||||
strncpy(saved_avi_fname,fname,MAX_PATH);
|
||||
char* dot = strrchr(saved_avi_fname, '.');
|
||||
if(dot && dot > strrchr(saved_avi_fname, '/') && dot > strrchr(saved_avi_fname, '\\'))
|
||||
{
|
||||
strcpy(saved_avi_ext,dot);
|
||||
dot[0]='\0';
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void DRV_AviVideoUpdate(const u16* buffer)
|
||||
{
|
||||
if(!avi_file || !avi_file->valid)
|
||||
return;
|
||||
|
||||
do_video_conversion(buffer);
|
||||
|
||||
if(FAILED(AVIStreamWrite(avi_file->compressed_streams[VIDEO_STREAM],
|
||||
avi_file->video_frames, 1, avi_file->convert_buffer,
|
||||
avi_file->bitmap_format.biSizeImage, AVIIF_KEYFRAME,
|
||||
NULL, &avi_file->ByteBuffer)))
|
||||
{
|
||||
avi_file->valid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
avi_file->video_frames++;
|
||||
avi_file->tBytes += avi_file->ByteBuffer;
|
||||
|
||||
// segment / split AVI when it's almost 2 GB (2000MB, to be precise)
|
||||
if(!(avi_file->video_frames % 60) && avi_file->tBytes > 2097152000)
|
||||
AviNextSegment();
|
||||
}
|
||||
|
||||
void DRV_AviSoundUpdate(void* soundData, int soundLen)
|
||||
{
|
||||
int nBytes;
|
||||
|
||||
if(!avi_file || !avi_file->valid || !avi_file->sound_added)
|
||||
return;
|
||||
|
||||
nBytes = soundLen * avi_file->wave_format.nBlockAlign;
|
||||
if(FAILED(AVIStreamWrite(avi_file->compressed_streams[AUDIO_STREAM],
|
||||
avi_file->sound_samples, soundLen,
|
||||
soundData, nBytes, 0, NULL, &avi_file->ByteBuffer)))
|
||||
{
|
||||
avi_file->valid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
avi_file->sound_samples += soundLen;
|
||||
avi_file->tBytes += avi_file->ByteBuffer;
|
||||
}
|
||||
|
||||
void DRV_AviEnd()
|
||||
{
|
||||
if(!avi_file)
|
||||
return;
|
||||
|
||||
// Don't display if we're just starting another segment
|
||||
if(avi_file->tBytes <= 2097152000)
|
||||
EMU_PrintMessage("AVI recording ended.");
|
||||
|
||||
avi_destroy(&avi_file);
|
||||
}
|
||||
|
||||
bool DRV_AviIsRecording()
|
||||
{
|
||||
if(avi_file)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,28 +1,28 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
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 "../common.h"
|
||||
|
||||
extern void CheatsListDialog(HWND hwnd);
|
||||
extern void CheatsSearchDialog(HWND hwnd);
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
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 "../common.h"
|
||||
|
||||
extern void CheatsListDialog(HWND hwnd);
|
||||
extern void CheatsSearchDialog(HWND hwnd);
|
||||
extern void CheatsSearchReset();
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include "types.h"
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include "types.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////// Console
|
||||
|
@ -63,8 +63,8 @@ void OpenConsole()
|
|||
//redirect stdio
|
||||
long lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
int hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
|
||||
FILE *fp = _fdopen( hConHandle, "w" );
|
||||
*stdout = *fp;
|
||||
FILE *fp = _fdopen( hConHandle, "w" );
|
||||
*stdout = *fp;
|
||||
}
|
||||
|
||||
void CloseConsole() {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,99 +1,99 @@
|
|||
/*==========================================================================;
|
||||
*
|
||||
*
|
||||
* File: dxerr8.h
|
||||
* Content: DirectX Error Library Include File
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _DXERR8_H_
|
||||
#define _DXERR8_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
//
|
||||
// DXGetErrorString8
|
||||
//
|
||||
// Desc: Converts a DirectX HRESULT to a string
|
||||
//
|
||||
// Args: HRESULT hr Can be any error code from
|
||||
// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
|
||||
//
|
||||
// Return: Converted string
|
||||
//
|
||||
const char* WINAPI DXGetErrorString8A(HRESULT hr);
|
||||
const WCHAR* WINAPI DXGetErrorString8W(HRESULT hr);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXGetErrorString8 DXGetErrorString8W
|
||||
#else
|
||||
#define DXGetErrorString8 DXGetErrorString8A
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// DXGetErrorDescription8
|
||||
//
|
||||
// Desc: Returns a string description of a DirectX HRESULT
|
||||
//
|
||||
// Args: HRESULT hr Can be any error code from
|
||||
// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
|
||||
//
|
||||
// Return: String description
|
||||
//
|
||||
const char* WINAPI DXGetErrorDescription8A(HRESULT hr);
|
||||
const WCHAR* WINAPI DXGetErrorDescription8W(HRESULT hr);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXGetErrorDescription8 DXGetErrorDescription8W
|
||||
#else
|
||||
#define DXGetErrorDescription8 DXGetErrorDescription8A
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// DXTrace
|
||||
//
|
||||
// Desc: Outputs a formatted error message to the debug stream
|
||||
//
|
||||
// Args: CHAR* strFile The current file, typically passed in using the
|
||||
// __FILE__ macro.
|
||||
// DWORD dwLine The current line number, typically passed in using the
|
||||
// __LINE__ macro.
|
||||
// HRESULT hr An HRESULT that will be traced to the debug stream.
|
||||
// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
|
||||
// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
|
||||
//
|
||||
// Return: The hr that was passed in.
|
||||
//
|
||||
HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox );
|
||||
HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox );
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXTrace DXTraceW
|
||||
#else
|
||||
#define DXTrace DXTraceA
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Helper macros
|
||||
//
|
||||
#if defined(DEBUG) | defined(_DEBUG)
|
||||
#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
|
||||
#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
|
||||
#define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
|
||||
#else
|
||||
#define DXTRACE_MSG(str) (0L)
|
||||
#define DXTRACE_ERR(str,hr) (hr)
|
||||
#define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif // _DXERR8_H_
|
||||
/*==========================================================================;
|
||||
*
|
||||
*
|
||||
* File: dxerr8.h
|
||||
* Content: DirectX Error Library Include File
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _DXERR8_H_
|
||||
#define _DXERR8_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
//
|
||||
// DXGetErrorString8
|
||||
//
|
||||
// Desc: Converts a DirectX HRESULT to a string
|
||||
//
|
||||
// Args: HRESULT hr Can be any error code from
|
||||
// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
|
||||
//
|
||||
// Return: Converted string
|
||||
//
|
||||
const char* WINAPI DXGetErrorString8A(HRESULT hr);
|
||||
const WCHAR* WINAPI DXGetErrorString8W(HRESULT hr);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXGetErrorString8 DXGetErrorString8W
|
||||
#else
|
||||
#define DXGetErrorString8 DXGetErrorString8A
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// DXGetErrorDescription8
|
||||
//
|
||||
// Desc: Returns a string description of a DirectX HRESULT
|
||||
//
|
||||
// Args: HRESULT hr Can be any error code from
|
||||
// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
|
||||
//
|
||||
// Return: String description
|
||||
//
|
||||
const char* WINAPI DXGetErrorDescription8A(HRESULT hr);
|
||||
const WCHAR* WINAPI DXGetErrorDescription8W(HRESULT hr);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXGetErrorDescription8 DXGetErrorDescription8W
|
||||
#else
|
||||
#define DXGetErrorDescription8 DXGetErrorDescription8A
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// DXTrace
|
||||
//
|
||||
// Desc: Outputs a formatted error message to the debug stream
|
||||
//
|
||||
// Args: CHAR* strFile The current file, typically passed in using the
|
||||
// __FILE__ macro.
|
||||
// DWORD dwLine The current line number, typically passed in using the
|
||||
// __LINE__ macro.
|
||||
// HRESULT hr An HRESULT that will be traced to the debug stream.
|
||||
// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
|
||||
// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
|
||||
//
|
||||
// Return: The hr that was passed in.
|
||||
//
|
||||
HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox );
|
||||
HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox );
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXTrace DXTraceW
|
||||
#else
|
||||
#define DXTrace DXTraceA
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Helper macros
|
||||
//
|
||||
#if defined(DEBUG) | defined(_DEBUG)
|
||||
#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
|
||||
#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
|
||||
#define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
|
||||
#else
|
||||
#define DXTRACE_MSG(str) (0L)
|
||||
#define DXTRACE_ERR(str,hr) (hr)
|
||||
#define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif // _DXERR8_H_
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct
|
|||
u16 mode;
|
||||
} disview_struct;
|
||||
|
||||
disview_struct *DisView7 = NULL;
|
||||
disview_struct *DisView7 = NULL;
|
||||
disview_struct *DisView9 = NULL;
|
||||
|
||||
static HWND DisViewWnd[2] = {NULL, NULL};
|
||||
|
@ -314,13 +314,13 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
KillTimer(hwnd, IDT_VIEW_DISASM7);
|
||||
DisView7->autoup = false;
|
||||
}
|
||||
if (DisView7!=NULL)
|
||||
{
|
||||
delete DisView7;
|
||||
DisView7 = NULL;
|
||||
}
|
||||
DisViewWnd[1] = NULL;
|
||||
//INFO("Close ARM7 disassembler\n");
|
||||
if (DisView7!=NULL)
|
||||
{
|
||||
delete DisView7;
|
||||
DisView7 = NULL;
|
||||
}
|
||||
DisViewWnd[1] = NULL;
|
||||
//INFO("Close ARM7 disassembler\n");
|
||||
PostQuitMessage(0);
|
||||
return 1;
|
||||
}
|
||||
|
@ -433,9 +433,9 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
case IDC_AUTO_UPDATE_SECS:
|
||||
{
|
||||
u16 t = GetDlgItemInt(hwnd, IDC_AUTO_UPDATE_SECS, FALSE, TRUE);
|
||||
if (!DisView7)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
if (!DisView7)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
}
|
||||
if (t != DisView7->autoup_secs)
|
||||
{
|
||||
|
@ -558,13 +558,13 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
KillTimer(hwnd, IDT_VIEW_DISASM9);
|
||||
DisView9->autoup = false;
|
||||
}
|
||||
if (DisView9!=NULL)
|
||||
{
|
||||
delete DisView9;
|
||||
DisView9 = NULL;
|
||||
}
|
||||
DisViewWnd[0] = NULL;
|
||||
//INFO("Close ARM9 disassembler\n");
|
||||
if (DisView9!=NULL)
|
||||
{
|
||||
delete DisView9;
|
||||
DisView9 = NULL;
|
||||
}
|
||||
DisViewWnd[0] = NULL;
|
||||
//INFO("Close ARM9 disassembler\n");
|
||||
PostQuitMessage(0);
|
||||
return 1;
|
||||
}
|
||||
|
@ -677,9 +677,9 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
case IDC_AUTO_UPDATE_SECS:
|
||||
{
|
||||
u16 t = GetDlgItemInt(hwnd, IDC_AUTO_UPDATE_SECS, FALSE, TRUE);
|
||||
if (!DisView9)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
if (!DisView9)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
}
|
||||
if (t != DisView9->autoup_secs)
|
||||
{
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
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
|
||||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "gbaslot_config.h"
|
||||
|
@ -27,7 +27,7 @@
|
|||
#include "debug.h"
|
||||
#include "../addons.h"
|
||||
#include "../NDSSystem.h"
|
||||
#include <shlobj.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
WNDCLASSEX wc;
|
||||
HWND wndConfig;
|
||||
|
@ -99,29 +99,29 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
{
|
||||
case IDC_BBROWSE:
|
||||
{
|
||||
int filterSize = 0, i = 0;
|
||||
OPENFILENAME ofn;
|
||||
char filename[MAX_PATH] = "",
|
||||
fileFilter[512]="";
|
||||
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = dialog;
|
||||
|
||||
strncpy (fileFilter, "Compact Flash image (*.img)|*.img||",512 - strlen(fileFilter));
|
||||
strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter));
|
||||
|
||||
filterSize = strlen(fileFilter);
|
||||
for (i = 0; i < filterSize; i++)
|
||||
if (fileFilter[i] == '|') fileFilter[i] = '\0';
|
||||
ofn.lpstrFilter = fileFilter;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrDefExt = "img";
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT;
|
||||
|
||||
if(!GetOpenFileName(&ofn)) return FALSE;
|
||||
int filterSize = 0, i = 0;
|
||||
OPENFILENAME ofn;
|
||||
char filename[MAX_PATH] = "",
|
||||
fileFilter[512]="";
|
||||
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = dialog;
|
||||
|
||||
strncpy (fileFilter, "Compact Flash image (*.img)|*.img||",512 - strlen(fileFilter));
|
||||
strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter));
|
||||
|
||||
filterSize = strlen(fileFilter);
|
||||
for (i = 0; i < filterSize; i++)
|
||||
if (fileFilter[i] == '|') fileFilter[i] = '\0';
|
||||
ofn.lpstrFilter = fileFilter;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrDefExt = "img";
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT;
|
||||
|
||||
if(!GetOpenFileName(&ofn)) return FALSE;
|
||||
|
||||
SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), filename);
|
||||
strcpy(tmp_cflash_filename, filename);
|
||||
|
@ -134,17 +134,17 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
|
||||
case IDC_BBROWSE2:
|
||||
{
|
||||
BROWSEINFO bp={0};
|
||||
|
||||
bp.hwndOwner=dialog;
|
||||
bp.pidlRoot=NULL;
|
||||
bp.pszDisplayName=NULL;
|
||||
bp.lpszTitle="Select directory for Compact Flash";
|
||||
bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
||||
bp.lpfn=NULL;
|
||||
|
||||
BROWSEINFO bp={0};
|
||||
|
||||
bp.hwndOwner=dialog;
|
||||
bp.pidlRoot=NULL;
|
||||
bp.pszDisplayName=NULL;
|
||||
bp.lpszTitle="Select directory for Compact Flash";
|
||||
bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
||||
bp.lpfn=NULL;
|
||||
|
||||
LPITEMIDLIST tmp = SHBrowseForFolder((LPBROWSEINFO)&bp);
|
||||
if (tmp!=NULL)
|
||||
if (tmp!=NULL)
|
||||
{
|
||||
memset(tmp_cflash_path, 0, sizeof(tmp_cflash_path));
|
||||
SHGetPathFromIDList(tmp, tmp_cflash_path);
|
||||
|
@ -256,30 +256,30 @@ BOOL CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
{
|
||||
case IDC_BBROWSE:
|
||||
{
|
||||
int filterSize = 0, i = 0;
|
||||
OPENFILENAME ofn;
|
||||
char filename[MAX_PATH] = "",
|
||||
fileFilter[512]="";
|
||||
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = dialog;
|
||||
|
||||
// TODO: add another gba file formats and archs
|
||||
strncpy (fileFilter, "GameBoy Advance ROM (*.gba)|*.gba||",512 - strlen(fileFilter));
|
||||
strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter));
|
||||
|
||||
filterSize = strlen(fileFilter);
|
||||
for (i = 0; i < filterSize; i++)
|
||||
if (fileFilter[i] == '|') fileFilter[i] = '\0';
|
||||
ofn.lpstrFilter = fileFilter;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrDefExt = "gba";
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
|
||||
|
||||
if(!GetOpenFileName(&ofn)) return FALSE;
|
||||
int filterSize = 0, i = 0;
|
||||
OPENFILENAME ofn;
|
||||
char filename[MAX_PATH] = "",
|
||||
fileFilter[512]="";
|
||||
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = dialog;
|
||||
|
||||
// TODO: add another gba file formats and archs
|
||||
strncpy (fileFilter, "GameBoy Advance ROM (*.gba)|*.gba||",512 - strlen(fileFilter));
|
||||
strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter));
|
||||
|
||||
filterSize = strlen(fileFilter);
|
||||
for (i = 0; i < filterSize; i++)
|
||||
if (fileFilter[i] == '|') fileFilter[i] = '\0';
|
||||
ofn.lpstrFilter = fileFilter;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrDefExt = "gba";
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
|
||||
|
||||
if(!GetOpenFileName(&ofn)) return FALSE;
|
||||
|
||||
SetWindowText(GetDlgItem(dialog, IDC_PATHGAME), filename);
|
||||
strcpy(tmp_gbagame_filename, filename);
|
||||
|
@ -319,13 +319,13 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
case WM_INITDIALOG:
|
||||
{
|
||||
OKbutton = GetDlgItem(dialog, IDOK);
|
||||
for(int i = 0; i < NDS_ADDON_COUNT; i++)
|
||||
ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), addonList[i].name);
|
||||
ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type);
|
||||
u8 tmp_info[512];
|
||||
addonList[temp_type].info((char *)tmp_info);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
|
||||
|
||||
for(int i = 0; i < NDS_ADDON_COUNT; i++)
|
||||
ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), addonList[i].name);
|
||||
ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type);
|
||||
u8 tmp_info[512];
|
||||
addonList[temp_type].info((char *)tmp_info);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
|
||||
|
||||
wndConfig=CreateDialog(hAppInst, MAKEINTRESOURCE(GBAslot_IDDs[temp_type]),
|
||||
dialog, (DLGPROC)GBAslot_Procs[temp_type]);
|
||||
if (temp_type == 0)
|
||||
|
@ -342,8 +342,8 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
int Msg = IDYES;
|
||||
if (romloaded)
|
||||
{
|
||||
int Msg = MessageBox(dialog,
|
||||
"After change GBA slot pak game will reset!\nAre you sure to continue?", "DeSmuME",
|
||||
int Msg = MessageBox(dialog,
|
||||
"After change GBA slot pak game will reset!\nAre you sure to continue?", "DeSmuME",
|
||||
MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
|
||||
}
|
||||
if (Msg == IDYES)
|
||||
|
@ -359,7 +359,7 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
return TRUE;
|
||||
|
||||
case IDC_ADDONS_LIST:
|
||||
if (HIWORD(wparam) == CBN_SELENDOK)
|
||||
if (HIWORD(wparam) == CBN_SELENDOK)
|
||||
{
|
||||
temp_type = ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST));
|
||||
if (temp_type != last_type)
|
||||
|
@ -368,8 +368,8 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
wndConfig=CreateDialog(hAppInst,
|
||||
MAKEINTRESOURCE(GBAslot_IDDs[temp_type]), dialog,
|
||||
(DLGPROC)GBAslot_Procs[temp_type]);
|
||||
u8 tmp_info[512];
|
||||
addonList[temp_type].info((char *)tmp_info);
|
||||
u8 tmp_info[512];
|
||||
addonList[temp_type].info((char *)tmp_info);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
|
||||
last_type = temp_type;
|
||||
}
|
||||
|
@ -396,28 +396,28 @@ void GBAslotDialog(HWND hwnd)
|
|||
{
|
||||
switch (temp_type)
|
||||
{
|
||||
case NDS_ADDON_NONE:
|
||||
break;
|
||||
case NDS_ADDON_CFLASH:
|
||||
CFlashUsePath = tmp_CFlashUsePath;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","usePath",CFlashUsePath,IniName);
|
||||
if (tmp_CFlashUsePath)
|
||||
{
|
||||
if (tmp_CFlashUseRomPath)
|
||||
{
|
||||
CFlashUseRomPath = tmp_CFlashUseRomPath;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","useRomPath",CFlashUseRomPath,IniName);
|
||||
break;
|
||||
}
|
||||
strcpy(CFlashPath, tmp_cflash_path);
|
||||
WritePrivateProfileString("GBAslot.CFlash","path",CFlashPath,IniName);
|
||||
break;
|
||||
}
|
||||
strcpy(CFlashName, tmp_cflash_filename);
|
||||
WritePrivateProfileString("GBAslot.CFlash","filename",CFlashName,IniName);
|
||||
break;
|
||||
case NDS_ADDON_RUMBLEPAK:
|
||||
break;
|
||||
case NDS_ADDON_NONE:
|
||||
break;
|
||||
case NDS_ADDON_CFLASH:
|
||||
CFlashUsePath = tmp_CFlashUsePath;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","usePath",CFlashUsePath,IniName);
|
||||
if (tmp_CFlashUsePath)
|
||||
{
|
||||
if (tmp_CFlashUseRomPath)
|
||||
{
|
||||
CFlashUseRomPath = tmp_CFlashUseRomPath;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","useRomPath",CFlashUseRomPath,IniName);
|
||||
break;
|
||||
}
|
||||
strcpy(CFlashPath, tmp_cflash_path);
|
||||
WritePrivateProfileString("GBAslot.CFlash","path",CFlashPath,IniName);
|
||||
break;
|
||||
}
|
||||
strcpy(CFlashName, tmp_cflash_filename);
|
||||
WritePrivateProfileString("GBAslot.CFlash","filename",CFlashName,IniName);
|
||||
break;
|
||||
case NDS_ADDON_RUMBLEPAK:
|
||||
break;
|
||||
case NDS_ADDON_GBAGAME:
|
||||
strcpy(GBAgameName, tmp_gbagame_filename);
|
||||
WritePrivateProfileString("GBAslot.GBAgame","filename",GBAgameName,IniName);
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ public header file
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUS_H
|
||||
#define _GDIPLUS_H
|
||||
|
||||
struct IDirectDrawSurface7;
|
||||
|
||||
typedef signed short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
|
||||
#include <pshpack8.h> // set structure packing to 8
|
||||
|
||||
namespace Gdiplus
|
||||
{
|
||||
namespace DllExports
|
||||
{
|
||||
#include "GdiplusMem.h"
|
||||
};
|
||||
|
||||
#include "GdiplusBase.h"
|
||||
|
||||
#include "GdiplusEnums.h"
|
||||
#include "GdiplusTypes.h"
|
||||
#include "GdiplusInit.h"
|
||||
#include "GdiplusPixelFormats.h"
|
||||
#include "GdiplusColor.h"
|
||||
#include "GdiplusMetaHeader.h"
|
||||
#include "GdiplusImaging.h"
|
||||
#include "GdiplusColorMatrix.h"
|
||||
|
||||
#include "GdiplusGpStubs.h"
|
||||
#include "GdiplusHeaders.h"
|
||||
|
||||
namespace DllExports
|
||||
{
|
||||
#include "GdiplusFlat.h"
|
||||
};
|
||||
|
||||
|
||||
#include "GdiplusImageAttributes.h"
|
||||
#include "GdiplusMatrix.h"
|
||||
#include "GdiplusBrush.h"
|
||||
#include "GdiplusPen.h"
|
||||
#include "GdiplusStringFormat.h"
|
||||
#include "GdiplusPath.h"
|
||||
#include "GdiplusLineCaps.h"
|
||||
#include "GdiplusMetafile.h"
|
||||
#include "GdiplusGraphics.h"
|
||||
#include "GdiplusCachedBitmap.h"
|
||||
#include "GdiplusRegion.h"
|
||||
#include "GdiplusFontCollection.h"
|
||||
#include "GdiplusFontFamily.h"
|
||||
#include "GdiplusFont.h"
|
||||
#include "GdiplusBitmap.h"
|
||||
#include "GdiplusImageCodec.h"
|
||||
|
||||
}; // namespace Gdiplus
|
||||
|
||||
#include <poppack.h> // pop structure packing back to previous state
|
||||
|
||||
#endif // !_GDIPLUS_HPP
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ public header file
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUS_H
|
||||
#define _GDIPLUS_H
|
||||
|
||||
struct IDirectDrawSurface7;
|
||||
|
||||
typedef signed short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
|
||||
#include <pshpack8.h> // set structure packing to 8
|
||||
|
||||
namespace Gdiplus
|
||||
{
|
||||
namespace DllExports
|
||||
{
|
||||
#include "GdiplusMem.h"
|
||||
};
|
||||
|
||||
#include "GdiplusBase.h"
|
||||
|
||||
#include "GdiplusEnums.h"
|
||||
#include "GdiplusTypes.h"
|
||||
#include "GdiplusInit.h"
|
||||
#include "GdiplusPixelFormats.h"
|
||||
#include "GdiplusColor.h"
|
||||
#include "GdiplusMetaHeader.h"
|
||||
#include "GdiplusImaging.h"
|
||||
#include "GdiplusColorMatrix.h"
|
||||
|
||||
#include "GdiplusGpStubs.h"
|
||||
#include "GdiplusHeaders.h"
|
||||
|
||||
namespace DllExports
|
||||
{
|
||||
#include "GdiplusFlat.h"
|
||||
};
|
||||
|
||||
|
||||
#include "GdiplusImageAttributes.h"
|
||||
#include "GdiplusMatrix.h"
|
||||
#include "GdiplusBrush.h"
|
||||
#include "GdiplusPen.h"
|
||||
#include "GdiplusStringFormat.h"
|
||||
#include "GdiplusPath.h"
|
||||
#include "GdiplusLineCaps.h"
|
||||
#include "GdiplusMetafile.h"
|
||||
#include "GdiplusGraphics.h"
|
||||
#include "GdiplusCachedBitmap.h"
|
||||
#include "GdiplusRegion.h"
|
||||
#include "GdiplusFontCollection.h"
|
||||
#include "GdiplusFontFamily.h"
|
||||
#include "GdiplusFont.h"
|
||||
#include "GdiplusBitmap.h"
|
||||
#include "GdiplusImageCodec.h"
|
||||
|
||||
}; // namespace Gdiplus
|
||||
|
||||
#include <poppack.h> // pop structure packing back to previous state
|
||||
|
||||
#endif // !_GDIPLUS_HPP
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusBase.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ base memory allocation class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSBASE_H
|
||||
#define _GDIPLUSBASE_H
|
||||
|
||||
class GdiplusBase
|
||||
{
|
||||
public:
|
||||
void (operator delete)(void* in_pVoid)
|
||||
{
|
||||
DllExports::GdipFree(in_pVoid);
|
||||
}
|
||||
void* (operator new)(size_t in_size)
|
||||
{
|
||||
return DllExports::GdipAlloc(in_size);
|
||||
}
|
||||
void (operator delete[])(void* in_pVoid)
|
||||
{
|
||||
DllExports::GdipFree(in_pVoid);
|
||||
}
|
||||
void* (operator new[])(size_t in_size)
|
||||
{
|
||||
return DllExports::GdipAlloc(in_size);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusBase.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ base memory allocation class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSBASE_H
|
||||
#define _GDIPLUSBASE_H
|
||||
|
||||
class GdiplusBase
|
||||
{
|
||||
public:
|
||||
void (operator delete)(void* in_pVoid)
|
||||
{
|
||||
DllExports::GdipFree(in_pVoid);
|
||||
}
|
||||
void* (operator new)(size_t in_size)
|
||||
{
|
||||
return DllExports::GdipAlloc(in_size);
|
||||
}
|
||||
void (operator delete[])(void* in_pVoid)
|
||||
{
|
||||
DllExports::GdipFree(in_pVoid);
|
||||
}
|
||||
void* (operator new[])(size_t in_size)
|
||||
{
|
||||
return DllExports::GdipAlloc(in_size);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,51 +1,51 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* CachedBitmap class definition
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ CachedBitmap is a representation of an accelerated drawing
|
||||
* that has restrictions on what operations are allowed in order
|
||||
* to accelerate the drawing to the destination.
|
||||
*
|
||||
* Look for class definition in GdiplusHeaders.h
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCACHEDBITMAP_H
|
||||
#define _GDIPLUSCACHEDBITMAP_H
|
||||
|
||||
inline
|
||||
CachedBitmap::CachedBitmap(
|
||||
IN Bitmap *bitmap,
|
||||
IN Graphics *graphics)
|
||||
{
|
||||
nativeCachedBitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateCachedBitmap(
|
||||
(GpBitmap *)bitmap->nativeImage,
|
||||
graphics->nativeGraphics,
|
||||
&nativeCachedBitmap
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
CachedBitmap::~CachedBitmap()
|
||||
{
|
||||
DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
CachedBitmap::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
return (lastStatus);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* CachedBitmap class definition
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ CachedBitmap is a representation of an accelerated drawing
|
||||
* that has restrictions on what operations are allowed in order
|
||||
* to accelerate the drawing to the destination.
|
||||
*
|
||||
* Look for class definition in GdiplusHeaders.h
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCACHEDBITMAP_H
|
||||
#define _GDIPLUSCACHEDBITMAP_H
|
||||
|
||||
inline
|
||||
CachedBitmap::CachedBitmap(
|
||||
IN Bitmap *bitmap,
|
||||
IN Graphics *graphics)
|
||||
{
|
||||
nativeCachedBitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateCachedBitmap(
|
||||
(GpBitmap *)bitmap->nativeImage,
|
||||
graphics->nativeGraphics,
|
||||
&nativeCachedBitmap
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
CachedBitmap::~CachedBitmap()
|
||||
{
|
||||
DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
CachedBitmap::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
return (lastStatus);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,324 +1,324 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusColor.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Color Object
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCOLOR_H
|
||||
#define _GDIPLUSCOLOR_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color mode
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorMode
|
||||
{
|
||||
ColorModeARGB32 = 0,
|
||||
ColorModeARGB64 = 1
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Channel flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorChannelFlags
|
||||
{
|
||||
ColorChannelFlagsC = 0,
|
||||
ColorChannelFlagsM,
|
||||
ColorChannelFlagsY,
|
||||
ColorChannelFlagsK,
|
||||
ColorChannelFlagsLast
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class Color
|
||||
{
|
||||
public:
|
||||
|
||||
Color()
|
||||
{
|
||||
Argb = (ARGB)Color::Black;
|
||||
}
|
||||
|
||||
// Construct an opaque Color object with
|
||||
// the specified Red, Green, Blue values.
|
||||
//
|
||||
// Color values are not premultiplied.
|
||||
|
||||
Color(IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
Argb = MakeARGB(255, r, g, b);
|
||||
}
|
||||
|
||||
Color(IN BYTE a,
|
||||
IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
Argb = MakeARGB(a, r, g, b);
|
||||
}
|
||||
|
||||
Color(IN ARGB argb)
|
||||
{
|
||||
Argb = argb;
|
||||
}
|
||||
|
||||
BYTE GetAlpha() const
|
||||
{
|
||||
return (BYTE) (Argb >> AlphaShift);
|
||||
}
|
||||
|
||||
BYTE GetA() const
|
||||
{
|
||||
return GetAlpha();
|
||||
}
|
||||
|
||||
BYTE GetRed() const
|
||||
{
|
||||
return (BYTE) (Argb >> RedShift);
|
||||
}
|
||||
|
||||
BYTE GetR() const
|
||||
{
|
||||
return GetRed();
|
||||
}
|
||||
|
||||
BYTE GetGreen() const
|
||||
{
|
||||
return (BYTE) (Argb >> GreenShift);
|
||||
}
|
||||
|
||||
BYTE GetG() const
|
||||
{
|
||||
return GetGreen();
|
||||
}
|
||||
|
||||
BYTE GetBlue() const
|
||||
{
|
||||
return (BYTE) (Argb >> BlueShift);
|
||||
}
|
||||
|
||||
BYTE GetB() const
|
||||
{
|
||||
return GetBlue();
|
||||
}
|
||||
|
||||
ARGB GetValue() const
|
||||
{
|
||||
return Argb;
|
||||
}
|
||||
|
||||
VOID SetValue(IN ARGB argb)
|
||||
{
|
||||
Argb = argb;
|
||||
}
|
||||
|
||||
VOID SetFromCOLORREF(IN COLORREF rgb)
|
||||
{
|
||||
Argb = MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
|
||||
}
|
||||
|
||||
COLORREF ToCOLORREF() const
|
||||
{
|
||||
return RGB(GetRed(), GetGreen(), GetBlue());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Common color constants
|
||||
|
||||
enum
|
||||
{
|
||||
AliceBlue = 0xFFF0F8FF,
|
||||
AntiqueWhite = 0xFFFAEBD7,
|
||||
Aqua = 0xFF00FFFF,
|
||||
Aquamarine = 0xFF7FFFD4,
|
||||
Azure = 0xFFF0FFFF,
|
||||
Beige = 0xFFF5F5DC,
|
||||
Bisque = 0xFFFFE4C4,
|
||||
Black = 0xFF000000,
|
||||
BlanchedAlmond = 0xFFFFEBCD,
|
||||
Blue = 0xFF0000FF,
|
||||
BlueViolet = 0xFF8A2BE2,
|
||||
Brown = 0xFFA52A2A,
|
||||
BurlyWood = 0xFFDEB887,
|
||||
CadetBlue = 0xFF5F9EA0,
|
||||
Chartreuse = 0xFF7FFF00,
|
||||
Chocolate = 0xFFD2691E,
|
||||
Coral = 0xFFFF7F50,
|
||||
CornflowerBlue = 0xFF6495ED,
|
||||
Cornsilk = 0xFFFFF8DC,
|
||||
Crimson = 0xFFDC143C,
|
||||
Cyan = 0xFF00FFFF,
|
||||
DarkBlue = 0xFF00008B,
|
||||
DarkCyan = 0xFF008B8B,
|
||||
DarkGoldenrod = 0xFFB8860B,
|
||||
DarkGray = 0xFFA9A9A9,
|
||||
DarkGreen = 0xFF006400,
|
||||
DarkKhaki = 0xFFBDB76B,
|
||||
DarkMagenta = 0xFF8B008B,
|
||||
DarkOliveGreen = 0xFF556B2F,
|
||||
DarkOrange = 0xFFFF8C00,
|
||||
DarkOrchid = 0xFF9932CC,
|
||||
DarkRed = 0xFF8B0000,
|
||||
DarkSalmon = 0xFFE9967A,
|
||||
DarkSeaGreen = 0xFF8FBC8B,
|
||||
DarkSlateBlue = 0xFF483D8B,
|
||||
DarkSlateGray = 0xFF2F4F4F,
|
||||
DarkTurquoise = 0xFF00CED1,
|
||||
DarkViolet = 0xFF9400D3,
|
||||
DeepPink = 0xFFFF1493,
|
||||
DeepSkyBlue = 0xFF00BFFF,
|
||||
DimGray = 0xFF696969,
|
||||
DodgerBlue = 0xFF1E90FF,
|
||||
Firebrick = 0xFFB22222,
|
||||
FloralWhite = 0xFFFFFAF0,
|
||||
ForestGreen = 0xFF228B22,
|
||||
Fuchsia = 0xFFFF00FF,
|
||||
Gainsboro = 0xFFDCDCDC,
|
||||
GhostWhite = 0xFFF8F8FF,
|
||||
Gold = 0xFFFFD700,
|
||||
Goldenrod = 0xFFDAA520,
|
||||
Gray = 0xFF808080,
|
||||
Green = 0xFF008000,
|
||||
GreenYellow = 0xFFADFF2F,
|
||||
Honeydew = 0xFFF0FFF0,
|
||||
HotPink = 0xFFFF69B4,
|
||||
IndianRed = 0xFFCD5C5C,
|
||||
Indigo = 0xFF4B0082,
|
||||
Ivory = 0xFFFFFFF0,
|
||||
Khaki = 0xFFF0E68C,
|
||||
Lavender = 0xFFE6E6FA,
|
||||
LavenderBlush = 0xFFFFF0F5,
|
||||
LawnGreen = 0xFF7CFC00,
|
||||
LemonChiffon = 0xFFFFFACD,
|
||||
LightBlue = 0xFFADD8E6,
|
||||
LightCoral = 0xFFF08080,
|
||||
LightCyan = 0xFFE0FFFF,
|
||||
LightGoldenrodYellow = 0xFFFAFAD2,
|
||||
LightGray = 0xFFD3D3D3,
|
||||
LightGreen = 0xFF90EE90,
|
||||
LightPink = 0xFFFFB6C1,
|
||||
LightSalmon = 0xFFFFA07A,
|
||||
LightSeaGreen = 0xFF20B2AA,
|
||||
LightSkyBlue = 0xFF87CEFA,
|
||||
LightSlateGray = 0xFF778899,
|
||||
LightSteelBlue = 0xFFB0C4DE,
|
||||
LightYellow = 0xFFFFFFE0,
|
||||
Lime = 0xFF00FF00,
|
||||
LimeGreen = 0xFF32CD32,
|
||||
Linen = 0xFFFAF0E6,
|
||||
Magenta = 0xFFFF00FF,
|
||||
Maroon = 0xFF800000,
|
||||
MediumAquamarine = 0xFF66CDAA,
|
||||
MediumBlue = 0xFF0000CD,
|
||||
MediumOrchid = 0xFFBA55D3,
|
||||
MediumPurple = 0xFF9370DB,
|
||||
MediumSeaGreen = 0xFF3CB371,
|
||||
MediumSlateBlue = 0xFF7B68EE,
|
||||
MediumSpringGreen = 0xFF00FA9A,
|
||||
MediumTurquoise = 0xFF48D1CC,
|
||||
MediumVioletRed = 0xFFC71585,
|
||||
MidnightBlue = 0xFF191970,
|
||||
MintCream = 0xFFF5FFFA,
|
||||
MistyRose = 0xFFFFE4E1,
|
||||
Moccasin = 0xFFFFE4B5,
|
||||
NavajoWhite = 0xFFFFDEAD,
|
||||
Navy = 0xFF000080,
|
||||
OldLace = 0xFFFDF5E6,
|
||||
Olive = 0xFF808000,
|
||||
OliveDrab = 0xFF6B8E23,
|
||||
Orange = 0xFFFFA500,
|
||||
OrangeRed = 0xFFFF4500,
|
||||
Orchid = 0xFFDA70D6,
|
||||
PaleGoldenrod = 0xFFEEE8AA,
|
||||
PaleGreen = 0xFF98FB98,
|
||||
PaleTurquoise = 0xFFAFEEEE,
|
||||
PaleVioletRed = 0xFFDB7093,
|
||||
PapayaWhip = 0xFFFFEFD5,
|
||||
PeachPuff = 0xFFFFDAB9,
|
||||
Peru = 0xFFCD853F,
|
||||
Pink = 0xFFFFC0CB,
|
||||
Plum = 0xFFDDA0DD,
|
||||
PowderBlue = 0xFFB0E0E6,
|
||||
Purple = 0xFF800080,
|
||||
Red = 0xFFFF0000,
|
||||
RosyBrown = 0xFFBC8F8F,
|
||||
RoyalBlue = 0xFF4169E1,
|
||||
SaddleBrown = 0xFF8B4513,
|
||||
Salmon = 0xFFFA8072,
|
||||
SandyBrown = 0xFFF4A460,
|
||||
SeaGreen = 0xFF2E8B57,
|
||||
SeaShell = 0xFFFFF5EE,
|
||||
Sienna = 0xFFA0522D,
|
||||
Silver = 0xFFC0C0C0,
|
||||
SkyBlue = 0xFF87CEEB,
|
||||
SlateBlue = 0xFF6A5ACD,
|
||||
SlateGray = 0xFF708090,
|
||||
Snow = 0xFFFFFAFA,
|
||||
SpringGreen = 0xFF00FF7F,
|
||||
SteelBlue = 0xFF4682B4,
|
||||
Tan = 0xFFD2B48C,
|
||||
Teal = 0xFF008080,
|
||||
Thistle = 0xFFD8BFD8,
|
||||
Tomato = 0xFFFF6347,
|
||||
Transparent = 0x00FFFFFF,
|
||||
Turquoise = 0xFF40E0D0,
|
||||
Violet = 0xFFEE82EE,
|
||||
Wheat = 0xFFF5DEB3,
|
||||
White = 0xFFFFFFFF,
|
||||
WhiteSmoke = 0xFFF5F5F5,
|
||||
Yellow = 0xFFFFFF00,
|
||||
YellowGreen = 0xFF9ACD32
|
||||
};
|
||||
|
||||
// Shift count and bit mask for A, R, G, B components
|
||||
|
||||
enum
|
||||
{
|
||||
AlphaShift = 24,
|
||||
RedShift = 16,
|
||||
GreenShift = 8,
|
||||
BlueShift = 0
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AlphaMask = 0xff000000,
|
||||
RedMask = 0x00ff0000,
|
||||
GreenMask = 0x0000ff00,
|
||||
BlueMask = 0x000000ff
|
||||
};
|
||||
|
||||
// Assemble A, R, G, B values into a 32-bit integer
|
||||
|
||||
static ARGB MakeARGB(IN BYTE a,
|
||||
IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
return (((ARGB) (b) << BlueShift) |
|
||||
((ARGB) (g) << GreenShift) |
|
||||
((ARGB) (r) << RedShift) |
|
||||
((ARGB) (a) << AlphaShift));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
ARGB Argb;
|
||||
};
|
||||
|
||||
#endif
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusColor.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Color Object
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCOLOR_H
|
||||
#define _GDIPLUSCOLOR_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color mode
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorMode
|
||||
{
|
||||
ColorModeARGB32 = 0,
|
||||
ColorModeARGB64 = 1
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Channel flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorChannelFlags
|
||||
{
|
||||
ColorChannelFlagsC = 0,
|
||||
ColorChannelFlagsM,
|
||||
ColorChannelFlagsY,
|
||||
ColorChannelFlagsK,
|
||||
ColorChannelFlagsLast
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class Color
|
||||
{
|
||||
public:
|
||||
|
||||
Color()
|
||||
{
|
||||
Argb = (ARGB)Color::Black;
|
||||
}
|
||||
|
||||
// Construct an opaque Color object with
|
||||
// the specified Red, Green, Blue values.
|
||||
//
|
||||
// Color values are not premultiplied.
|
||||
|
||||
Color(IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
Argb = MakeARGB(255, r, g, b);
|
||||
}
|
||||
|
||||
Color(IN BYTE a,
|
||||
IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
Argb = MakeARGB(a, r, g, b);
|
||||
}
|
||||
|
||||
Color(IN ARGB argb)
|
||||
{
|
||||
Argb = argb;
|
||||
}
|
||||
|
||||
BYTE GetAlpha() const
|
||||
{
|
||||
return (BYTE) (Argb >> AlphaShift);
|
||||
}
|
||||
|
||||
BYTE GetA() const
|
||||
{
|
||||
return GetAlpha();
|
||||
}
|
||||
|
||||
BYTE GetRed() const
|
||||
{
|
||||
return (BYTE) (Argb >> RedShift);
|
||||
}
|
||||
|
||||
BYTE GetR() const
|
||||
{
|
||||
return GetRed();
|
||||
}
|
||||
|
||||
BYTE GetGreen() const
|
||||
{
|
||||
return (BYTE) (Argb >> GreenShift);
|
||||
}
|
||||
|
||||
BYTE GetG() const
|
||||
{
|
||||
return GetGreen();
|
||||
}
|
||||
|
||||
BYTE GetBlue() const
|
||||
{
|
||||
return (BYTE) (Argb >> BlueShift);
|
||||
}
|
||||
|
||||
BYTE GetB() const
|
||||
{
|
||||
return GetBlue();
|
||||
}
|
||||
|
||||
ARGB GetValue() const
|
||||
{
|
||||
return Argb;
|
||||
}
|
||||
|
||||
VOID SetValue(IN ARGB argb)
|
||||
{
|
||||
Argb = argb;
|
||||
}
|
||||
|
||||
VOID SetFromCOLORREF(IN COLORREF rgb)
|
||||
{
|
||||
Argb = MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
|
||||
}
|
||||
|
||||
COLORREF ToCOLORREF() const
|
||||
{
|
||||
return RGB(GetRed(), GetGreen(), GetBlue());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Common color constants
|
||||
|
||||
enum
|
||||
{
|
||||
AliceBlue = 0xFFF0F8FF,
|
||||
AntiqueWhite = 0xFFFAEBD7,
|
||||
Aqua = 0xFF00FFFF,
|
||||
Aquamarine = 0xFF7FFFD4,
|
||||
Azure = 0xFFF0FFFF,
|
||||
Beige = 0xFFF5F5DC,
|
||||
Bisque = 0xFFFFE4C4,
|
||||
Black = 0xFF000000,
|
||||
BlanchedAlmond = 0xFFFFEBCD,
|
||||
Blue = 0xFF0000FF,
|
||||
BlueViolet = 0xFF8A2BE2,
|
||||
Brown = 0xFFA52A2A,
|
||||
BurlyWood = 0xFFDEB887,
|
||||
CadetBlue = 0xFF5F9EA0,
|
||||
Chartreuse = 0xFF7FFF00,
|
||||
Chocolate = 0xFFD2691E,
|
||||
Coral = 0xFFFF7F50,
|
||||
CornflowerBlue = 0xFF6495ED,
|
||||
Cornsilk = 0xFFFFF8DC,
|
||||
Crimson = 0xFFDC143C,
|
||||
Cyan = 0xFF00FFFF,
|
||||
DarkBlue = 0xFF00008B,
|
||||
DarkCyan = 0xFF008B8B,
|
||||
DarkGoldenrod = 0xFFB8860B,
|
||||
DarkGray = 0xFFA9A9A9,
|
||||
DarkGreen = 0xFF006400,
|
||||
DarkKhaki = 0xFFBDB76B,
|
||||
DarkMagenta = 0xFF8B008B,
|
||||
DarkOliveGreen = 0xFF556B2F,
|
||||
DarkOrange = 0xFFFF8C00,
|
||||
DarkOrchid = 0xFF9932CC,
|
||||
DarkRed = 0xFF8B0000,
|
||||
DarkSalmon = 0xFFE9967A,
|
||||
DarkSeaGreen = 0xFF8FBC8B,
|
||||
DarkSlateBlue = 0xFF483D8B,
|
||||
DarkSlateGray = 0xFF2F4F4F,
|
||||
DarkTurquoise = 0xFF00CED1,
|
||||
DarkViolet = 0xFF9400D3,
|
||||
DeepPink = 0xFFFF1493,
|
||||
DeepSkyBlue = 0xFF00BFFF,
|
||||
DimGray = 0xFF696969,
|
||||
DodgerBlue = 0xFF1E90FF,
|
||||
Firebrick = 0xFFB22222,
|
||||
FloralWhite = 0xFFFFFAF0,
|
||||
ForestGreen = 0xFF228B22,
|
||||
Fuchsia = 0xFFFF00FF,
|
||||
Gainsboro = 0xFFDCDCDC,
|
||||
GhostWhite = 0xFFF8F8FF,
|
||||
Gold = 0xFFFFD700,
|
||||
Goldenrod = 0xFFDAA520,
|
||||
Gray = 0xFF808080,
|
||||
Green = 0xFF008000,
|
||||
GreenYellow = 0xFFADFF2F,
|
||||
Honeydew = 0xFFF0FFF0,
|
||||
HotPink = 0xFFFF69B4,
|
||||
IndianRed = 0xFFCD5C5C,
|
||||
Indigo = 0xFF4B0082,
|
||||
Ivory = 0xFFFFFFF0,
|
||||
Khaki = 0xFFF0E68C,
|
||||
Lavender = 0xFFE6E6FA,
|
||||
LavenderBlush = 0xFFFFF0F5,
|
||||
LawnGreen = 0xFF7CFC00,
|
||||
LemonChiffon = 0xFFFFFACD,
|
||||
LightBlue = 0xFFADD8E6,
|
||||
LightCoral = 0xFFF08080,
|
||||
LightCyan = 0xFFE0FFFF,
|
||||
LightGoldenrodYellow = 0xFFFAFAD2,
|
||||
LightGray = 0xFFD3D3D3,
|
||||
LightGreen = 0xFF90EE90,
|
||||
LightPink = 0xFFFFB6C1,
|
||||
LightSalmon = 0xFFFFA07A,
|
||||
LightSeaGreen = 0xFF20B2AA,
|
||||
LightSkyBlue = 0xFF87CEFA,
|
||||
LightSlateGray = 0xFF778899,
|
||||
LightSteelBlue = 0xFFB0C4DE,
|
||||
LightYellow = 0xFFFFFFE0,
|
||||
Lime = 0xFF00FF00,
|
||||
LimeGreen = 0xFF32CD32,
|
||||
Linen = 0xFFFAF0E6,
|
||||
Magenta = 0xFFFF00FF,
|
||||
Maroon = 0xFF800000,
|
||||
MediumAquamarine = 0xFF66CDAA,
|
||||
MediumBlue = 0xFF0000CD,
|
||||
MediumOrchid = 0xFFBA55D3,
|
||||
MediumPurple = 0xFF9370DB,
|
||||
MediumSeaGreen = 0xFF3CB371,
|
||||
MediumSlateBlue = 0xFF7B68EE,
|
||||
MediumSpringGreen = 0xFF00FA9A,
|
||||
MediumTurquoise = 0xFF48D1CC,
|
||||
MediumVioletRed = 0xFFC71585,
|
||||
MidnightBlue = 0xFF191970,
|
||||
MintCream = 0xFFF5FFFA,
|
||||
MistyRose = 0xFFFFE4E1,
|
||||
Moccasin = 0xFFFFE4B5,
|
||||
NavajoWhite = 0xFFFFDEAD,
|
||||
Navy = 0xFF000080,
|
||||
OldLace = 0xFFFDF5E6,
|
||||
Olive = 0xFF808000,
|
||||
OliveDrab = 0xFF6B8E23,
|
||||
Orange = 0xFFFFA500,
|
||||
OrangeRed = 0xFFFF4500,
|
||||
Orchid = 0xFFDA70D6,
|
||||
PaleGoldenrod = 0xFFEEE8AA,
|
||||
PaleGreen = 0xFF98FB98,
|
||||
PaleTurquoise = 0xFFAFEEEE,
|
||||
PaleVioletRed = 0xFFDB7093,
|
||||
PapayaWhip = 0xFFFFEFD5,
|
||||
PeachPuff = 0xFFFFDAB9,
|
||||
Peru = 0xFFCD853F,
|
||||
Pink = 0xFFFFC0CB,
|
||||
Plum = 0xFFDDA0DD,
|
||||
PowderBlue = 0xFFB0E0E6,
|
||||
Purple = 0xFF800080,
|
||||
Red = 0xFFFF0000,
|
||||
RosyBrown = 0xFFBC8F8F,
|
||||
RoyalBlue = 0xFF4169E1,
|
||||
SaddleBrown = 0xFF8B4513,
|
||||
Salmon = 0xFFFA8072,
|
||||
SandyBrown = 0xFFF4A460,
|
||||
SeaGreen = 0xFF2E8B57,
|
||||
SeaShell = 0xFFFFF5EE,
|
||||
Sienna = 0xFFA0522D,
|
||||
Silver = 0xFFC0C0C0,
|
||||
SkyBlue = 0xFF87CEEB,
|
||||
SlateBlue = 0xFF6A5ACD,
|
||||
SlateGray = 0xFF708090,
|
||||
Snow = 0xFFFFFAFA,
|
||||
SpringGreen = 0xFF00FF7F,
|
||||
SteelBlue = 0xFF4682B4,
|
||||
Tan = 0xFFD2B48C,
|
||||
Teal = 0xFF008080,
|
||||
Thistle = 0xFFD8BFD8,
|
||||
Tomato = 0xFFFF6347,
|
||||
Transparent = 0x00FFFFFF,
|
||||
Turquoise = 0xFF40E0D0,
|
||||
Violet = 0xFFEE82EE,
|
||||
Wheat = 0xFFF5DEB3,
|
||||
White = 0xFFFFFFFF,
|
||||
WhiteSmoke = 0xFFF5F5F5,
|
||||
Yellow = 0xFFFFFF00,
|
||||
YellowGreen = 0xFF9ACD32
|
||||
};
|
||||
|
||||
// Shift count and bit mask for A, R, G, B components
|
||||
|
||||
enum
|
||||
{
|
||||
AlphaShift = 24,
|
||||
RedShift = 16,
|
||||
GreenShift = 8,
|
||||
BlueShift = 0
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AlphaMask = 0xff000000,
|
||||
RedMask = 0x00ff0000,
|
||||
GreenMask = 0x0000ff00,
|
||||
BlueMask = 0x000000ff
|
||||
};
|
||||
|
||||
// Assemble A, R, G, B values into a 32-bit integer
|
||||
|
||||
static ARGB MakeARGB(IN BYTE a,
|
||||
IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
return (((ARGB) (b) << BlueShift) |
|
||||
((ARGB) (g) << GreenShift) |
|
||||
((ARGB) (r) << RedShift) |
|
||||
((ARGB) (a) << AlphaShift));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
ARGB Argb;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,63 +1,63 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusColorMatrix.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Color Matrix object, used with Graphics.DrawImage
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCOLORMATRIX_H
|
||||
#define _GDIPLUSCOLORMATRIX_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color matrix
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct ColorMatrix
|
||||
{
|
||||
REAL m[5][5];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Matrix flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorMatrixFlags
|
||||
{
|
||||
ColorMatrixFlagsDefault = 0,
|
||||
ColorMatrixFlagsSkipGrays = 1,
|
||||
ColorMatrixFlagsAltGray = 2
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Adjust Type
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorAdjustType
|
||||
{
|
||||
ColorAdjustTypeDefault,
|
||||
ColorAdjustTypeBitmap,
|
||||
ColorAdjustTypeBrush,
|
||||
ColorAdjustTypePen,
|
||||
ColorAdjustTypeText,
|
||||
ColorAdjustTypeCount,
|
||||
ColorAdjustTypeAny // Reserved
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Map
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct ColorMap
|
||||
{
|
||||
Color oldColor;
|
||||
Color newColor;
|
||||
};
|
||||
|
||||
#endif
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusColorMatrix.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Color Matrix object, used with Graphics.DrawImage
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCOLORMATRIX_H
|
||||
#define _GDIPLUSCOLORMATRIX_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color matrix
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct ColorMatrix
|
||||
{
|
||||
REAL m[5][5];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Matrix flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorMatrixFlags
|
||||
{
|
||||
ColorMatrixFlagsDefault = 0,
|
||||
ColorMatrixFlagsSkipGrays = 1,
|
||||
ColorMatrixFlagsAltGray = 2
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Adjust Type
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorAdjustType
|
||||
{
|
||||
ColorAdjustTypeDefault,
|
||||
ColorAdjustTypeBitmap,
|
||||
ColorAdjustTypeBrush,
|
||||
ColorAdjustTypePen,
|
||||
ColorAdjustTypeText,
|
||||
ColorAdjustTypeCount,
|
||||
ColorAdjustTypeAny // Reserved
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Map
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct ColorMap
|
||||
{
|
||||
Color oldColor;
|
||||
Color newColor;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,280 +1,280 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFont.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Font class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSFONT_H
|
||||
#define _GDIPLUSFONT_H
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const HFONT hfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
if (hfont)
|
||||
{
|
||||
LOGFONTA lf;
|
||||
|
||||
if(GetObjectA(hfont, sizeof(LOGFONTA), &lf))
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
else
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const LOGFONTW* logfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
if (logfont)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const LOGFONTA* logfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
if (logfont)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(
|
||||
IN const FontFamily * family,
|
||||
IN REAL emSize,
|
||||
IN INT style,
|
||||
IN Unit unit
|
||||
)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(family ? family->nativeFamily : NULL,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&font);
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(
|
||||
IN const WCHAR * familyName,
|
||||
IN REAL emSize,
|
||||
IN INT style,
|
||||
IN Unit unit,
|
||||
IN const FontCollection * fontCollection
|
||||
)
|
||||
{
|
||||
nativeFont = NULL;
|
||||
|
||||
FontFamily family(familyName, fontCollection);
|
||||
GpFontFamily *nativeFamily = family.nativeFamily;
|
||||
|
||||
lastResult = family.GetLastStatus();
|
||||
|
||||
if (lastResult != Ok)
|
||||
{
|
||||
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
|
||||
lastResult = FontFamily::GenericSansSerif()->lastResult;
|
||||
if (lastResult != Ok)
|
||||
return;
|
||||
}
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(nativeFamily,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&nativeFont);
|
||||
|
||||
if (lastResult != Ok)
|
||||
{
|
||||
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
|
||||
lastResult = FontFamily::GenericSansSerif()->lastResult;
|
||||
if (lastResult != Ok)
|
||||
return;
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(
|
||||
nativeFamily,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&nativeFont);
|
||||
}
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLogFontA(IN const Graphics *g,
|
||||
OUT LOGFONTA *logfontA) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLogFontA(nativeFont, g ? g->nativeGraphics : NULL, logfontA));
|
||||
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLogFontW(IN const Graphics *g,
|
||||
OUT LOGFONTW *logfontW) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLogFontW(nativeFont, g ? g->nativeGraphics : NULL, logfontW));
|
||||
}
|
||||
|
||||
|
||||
inline Font*
|
||||
Font::Clone() const
|
||||
{
|
||||
GpFont *cloneFont = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneFont(nativeFont, &cloneFont));
|
||||
|
||||
return new Font(cloneFont, lastResult);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::~Font()
|
||||
{
|
||||
DllExports::GdipDeleteFont(nativeFont);
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
inline BOOL
|
||||
Font::IsAvailable() const
|
||||
{
|
||||
return (nativeFont ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetFamily(OUT FontFamily *family) const
|
||||
{
|
||||
if (family == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
Status status = DllExports::GdipGetFamily(nativeFont, &(family->nativeFamily));
|
||||
family->SetStatus(status);
|
||||
|
||||
return SetStatus(status);
|
||||
}
|
||||
|
||||
inline INT
|
||||
Font::GetStyle() const
|
||||
{
|
||||
INT style;
|
||||
|
||||
SetStatus(DllExports::GdipGetFontStyle(nativeFont, &style));
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Font::GetSize() const
|
||||
{
|
||||
REAL size;
|
||||
SetStatus(DllExports::GdipGetFontSize(nativeFont, &size));
|
||||
return size;
|
||||
}
|
||||
|
||||
inline Unit
|
||||
Font::GetUnit() const
|
||||
{
|
||||
Unit unit;
|
||||
SetStatus(DllExports::GdipGetFontUnit(nativeFont, &unit));
|
||||
return unit;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Font::GetHeight(IN const Graphics *graphics) const
|
||||
{
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetFontHeight(
|
||||
nativeFont,
|
||||
graphics ? graphics->nativeGraphics : NULL,
|
||||
&height
|
||||
));
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
inline REAL
|
||||
Font::GetHeight(IN REAL dpi) const
|
||||
{
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height));
|
||||
return height;
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN GpFont* font,
|
||||
IN Status status)
|
||||
{
|
||||
lastResult = status;
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline VOID
|
||||
Font::SetNativeFont(GpFont *Font)
|
||||
{
|
||||
nativeFont = Font;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLastStatus(void) const
|
||||
{
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::SetStatus(IN Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFont.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Font class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSFONT_H
|
||||
#define _GDIPLUSFONT_H
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const HFONT hfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
if (hfont)
|
||||
{
|
||||
LOGFONTA lf;
|
||||
|
||||
if(GetObjectA(hfont, sizeof(LOGFONTA), &lf))
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
else
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const LOGFONTW* logfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
if (logfont)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const LOGFONTA* logfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
if (logfont)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(
|
||||
IN const FontFamily * family,
|
||||
IN REAL emSize,
|
||||
IN INT style,
|
||||
IN Unit unit
|
||||
)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(family ? family->nativeFamily : NULL,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&font);
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(
|
||||
IN const WCHAR * familyName,
|
||||
IN REAL emSize,
|
||||
IN INT style,
|
||||
IN Unit unit,
|
||||
IN const FontCollection * fontCollection
|
||||
)
|
||||
{
|
||||
nativeFont = NULL;
|
||||
|
||||
FontFamily family(familyName, fontCollection);
|
||||
GpFontFamily *nativeFamily = family.nativeFamily;
|
||||
|
||||
lastResult = family.GetLastStatus();
|
||||
|
||||
if (lastResult != Ok)
|
||||
{
|
||||
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
|
||||
lastResult = FontFamily::GenericSansSerif()->lastResult;
|
||||
if (lastResult != Ok)
|
||||
return;
|
||||
}
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(nativeFamily,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&nativeFont);
|
||||
|
||||
if (lastResult != Ok)
|
||||
{
|
||||
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
|
||||
lastResult = FontFamily::GenericSansSerif()->lastResult;
|
||||
if (lastResult != Ok)
|
||||
return;
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(
|
||||
nativeFamily,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&nativeFont);
|
||||
}
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLogFontA(IN const Graphics *g,
|
||||
OUT LOGFONTA *logfontA) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLogFontA(nativeFont, g ? g->nativeGraphics : NULL, logfontA));
|
||||
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLogFontW(IN const Graphics *g,
|
||||
OUT LOGFONTW *logfontW) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLogFontW(nativeFont, g ? g->nativeGraphics : NULL, logfontW));
|
||||
}
|
||||
|
||||
|
||||
inline Font*
|
||||
Font::Clone() const
|
||||
{
|
||||
GpFont *cloneFont = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneFont(nativeFont, &cloneFont));
|
||||
|
||||
return new Font(cloneFont, lastResult);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::~Font()
|
||||
{
|
||||
DllExports::GdipDeleteFont(nativeFont);
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
inline BOOL
|
||||
Font::IsAvailable() const
|
||||
{
|
||||
return (nativeFont ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetFamily(OUT FontFamily *family) const
|
||||
{
|
||||
if (family == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
Status status = DllExports::GdipGetFamily(nativeFont, &(family->nativeFamily));
|
||||
family->SetStatus(status);
|
||||
|
||||
return SetStatus(status);
|
||||
}
|
||||
|
||||
inline INT
|
||||
Font::GetStyle() const
|
||||
{
|
||||
INT style;
|
||||
|
||||
SetStatus(DllExports::GdipGetFontStyle(nativeFont, &style));
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Font::GetSize() const
|
||||
{
|
||||
REAL size;
|
||||
SetStatus(DllExports::GdipGetFontSize(nativeFont, &size));
|
||||
return size;
|
||||
}
|
||||
|
||||
inline Unit
|
||||
Font::GetUnit() const
|
||||
{
|
||||
Unit unit;
|
||||
SetStatus(DllExports::GdipGetFontUnit(nativeFont, &unit));
|
||||
return unit;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Font::GetHeight(IN const Graphics *graphics) const
|
||||
{
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetFontHeight(
|
||||
nativeFont,
|
||||
graphics ? graphics->nativeGraphics : NULL,
|
||||
&height
|
||||
));
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
inline REAL
|
||||
Font::GetHeight(IN REAL dpi) const
|
||||
{
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height));
|
||||
return height;
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN GpFont* font,
|
||||
IN Status status)
|
||||
{
|
||||
lastResult = status;
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline VOID
|
||||
Font::SetNativeFont(GpFont *Font)
|
||||
{
|
||||
nativeFont = Font;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLastStatus(void) const
|
||||
{
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::SetStatus(IN Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,134 +1,134 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFontCollection.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* Font collections (Installed and Private)
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSFONTCOLL_H
|
||||
#define _GDIPLUSFONTCOLL_H
|
||||
|
||||
inline
|
||||
FontCollection::FontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
}
|
||||
|
||||
inline
|
||||
FontCollection::~FontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
inline INT
|
||||
FontCollection::GetFamilyCount() const
|
||||
{
|
||||
INT numFound = 0;
|
||||
|
||||
lastResult = DllExports::GdipGetFontCollectionFamilyCount(
|
||||
nativeFontCollection, &numFound);
|
||||
|
||||
|
||||
|
||||
return numFound;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontCollection::GetFamilies(
|
||||
IN INT numSought,
|
||||
OUT FontFamily * gpfamilies,
|
||||
OUT INT * numFound
|
||||
) const
|
||||
{
|
||||
if (numSought <= 0 || gpfamilies == NULL || numFound == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
*numFound = 0;
|
||||
GpFontFamily **nativeFamilyList = new GpFontFamily*[numSought];
|
||||
|
||||
if (nativeFamilyList == NULL)
|
||||
{
|
||||
return SetStatus(OutOfMemory);
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipGetFontCollectionFamilyList(
|
||||
nativeFontCollection,
|
||||
numSought,
|
||||
nativeFamilyList,
|
||||
numFound
|
||||
));
|
||||
if (status == Ok)
|
||||
{
|
||||
for (INT i = 0; i < *numFound; i++)
|
||||
{
|
||||
DllExports::GdipCloneFontFamily(nativeFamilyList[i],
|
||||
&gpfamilies[i].nativeFamily);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] nativeFamilyList;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
inline Status FontCollection::GetLastStatus () const
|
||||
{
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontCollection::SetStatus(IN Status status) const
|
||||
{
|
||||
lastResult = status;
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline
|
||||
InstalledFontCollection::InstalledFontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline
|
||||
InstalledFontCollection::~InstalledFontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
PrivateFontCollection::PrivateFontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
lastResult = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline
|
||||
PrivateFontCollection::~PrivateFontCollection()
|
||||
{
|
||||
DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline Status
|
||||
PrivateFontCollection::AddFontFile(IN const WCHAR* filename)
|
||||
{
|
||||
return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename));
|
||||
}
|
||||
|
||||
inline Status
|
||||
PrivateFontCollection::AddMemoryFont(IN const void* memory,
|
||||
IN INT length)
|
||||
{
|
||||
return SetStatus(DllExports::GdipPrivateAddMemoryFont(
|
||||
nativeFontCollection,
|
||||
memory,
|
||||
length));
|
||||
}
|
||||
|
||||
#endif // _GDIPLUSFONTCOLL_H
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFontCollection.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* Font collections (Installed and Private)
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSFONTCOLL_H
|
||||
#define _GDIPLUSFONTCOLL_H
|
||||
|
||||
inline
|
||||
FontCollection::FontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
}
|
||||
|
||||
inline
|
||||
FontCollection::~FontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
inline INT
|
||||
FontCollection::GetFamilyCount() const
|
||||
{
|
||||
INT numFound = 0;
|
||||
|
||||
lastResult = DllExports::GdipGetFontCollectionFamilyCount(
|
||||
nativeFontCollection, &numFound);
|
||||
|
||||
|
||||
|
||||
return numFound;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontCollection::GetFamilies(
|
||||
IN INT numSought,
|
||||
OUT FontFamily * gpfamilies,
|
||||
OUT INT * numFound
|
||||
) const
|
||||
{
|
||||
if (numSought <= 0 || gpfamilies == NULL || numFound == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
*numFound = 0;
|
||||
GpFontFamily **nativeFamilyList = new GpFontFamily*[numSought];
|
||||
|
||||
if (nativeFamilyList == NULL)
|
||||
{
|
||||
return SetStatus(OutOfMemory);
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipGetFontCollectionFamilyList(
|
||||
nativeFontCollection,
|
||||
numSought,
|
||||
nativeFamilyList,
|
||||
numFound
|
||||
));
|
||||
if (status == Ok)
|
||||
{
|
||||
for (INT i = 0; i < *numFound; i++)
|
||||
{
|
||||
DllExports::GdipCloneFontFamily(nativeFamilyList[i],
|
||||
&gpfamilies[i].nativeFamily);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] nativeFamilyList;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
inline Status FontCollection::GetLastStatus () const
|
||||
{
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontCollection::SetStatus(IN Status status) const
|
||||
{
|
||||
lastResult = status;
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline
|
||||
InstalledFontCollection::InstalledFontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline
|
||||
InstalledFontCollection::~InstalledFontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
PrivateFontCollection::PrivateFontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
lastResult = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline
|
||||
PrivateFontCollection::~PrivateFontCollection()
|
||||
{
|
||||
DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline Status
|
||||
PrivateFontCollection::AddFontFile(IN const WCHAR* filename)
|
||||
{
|
||||
return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename));
|
||||
}
|
||||
|
||||
inline Status
|
||||
PrivateFontCollection::AddMemoryFont(IN const void* memory,
|
||||
IN INT length)
|
||||
{
|
||||
return SetStatus(DllExports::GdipPrivateAddMemoryFont(
|
||||
nativeFontCollection,
|
||||
memory,
|
||||
length));
|
||||
}
|
||||
|
||||
#endif // _GDIPLUSFONTCOLL_H
|
||||
|
|
|
@ -1,207 +1,207 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFontFamily.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Font Family class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUS_FONT_FAMILY_H
|
||||
#define _GDIPLUS_FONT_FAMILY_H
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily() :
|
||||
nativeFamily (NULL),
|
||||
lastResult (Ok)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily(
|
||||
IN const WCHAR* name,
|
||||
IN const FontCollection* fontCollection
|
||||
)
|
||||
{
|
||||
nativeFamily = NULL;
|
||||
lastResult = DllExports::GdipCreateFontFamilyFromName(
|
||||
name,
|
||||
fontCollection ? fontCollection->nativeFontCollection : NULL,
|
||||
&nativeFamily
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily(
|
||||
IN GpFontFamily *nativeOrig,
|
||||
IN Status status
|
||||
)
|
||||
{
|
||||
lastResult = status;
|
||||
nativeFamily = nativeOrig;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericSansSerif()
|
||||
{
|
||||
if (GenericSansSerifFontFamily != NULL)
|
||||
{
|
||||
return GenericSansSerifFontFamily;
|
||||
}
|
||||
|
||||
GenericSansSerifFontFamily =
|
||||
(FontFamily*) GenericSansSerifFontFamilyBuffer;
|
||||
|
||||
GenericSansSerifFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilySansSerif(
|
||||
&(GenericSansSerifFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericSansSerifFontFamily;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericSerif()
|
||||
{
|
||||
if (GenericSerifFontFamily != NULL)
|
||||
{
|
||||
return GenericSerifFontFamily;
|
||||
}
|
||||
|
||||
GenericSerifFontFamily =
|
||||
(FontFamily*) GenericSerifFontFamilyBuffer;
|
||||
|
||||
GenericSerifFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilySerif(
|
||||
&(GenericSerifFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericSerifFontFamily;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericMonospace()
|
||||
{
|
||||
if (GenericMonospaceFontFamily != NULL)
|
||||
{
|
||||
return GenericMonospaceFontFamily;
|
||||
}
|
||||
|
||||
GenericMonospaceFontFamily =
|
||||
(FontFamily*) GenericMonospaceFontFamilyBuffer;
|
||||
|
||||
GenericMonospaceFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilyMonospace(
|
||||
&(GenericMonospaceFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericMonospaceFontFamily;
|
||||
}
|
||||
|
||||
inline FontFamily::~FontFamily()
|
||||
{
|
||||
DllExports::GdipDeleteFontFamily (nativeFamily);
|
||||
}
|
||||
|
||||
inline FontFamily *
|
||||
FontFamily::Clone() const
|
||||
{
|
||||
GpFontFamily * clonedFamily = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneFontFamily (nativeFamily, &clonedFamily));
|
||||
|
||||
return new FontFamily(clonedFamily, lastResult);
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::GetFamilyName(
|
||||
IN WCHAR name[LF_FACESIZE],
|
||||
IN LANGID language
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetFamilyName(nativeFamily,
|
||||
name,
|
||||
language));
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
FontFamily::IsStyleAvailable(IN INT style) const
|
||||
{
|
||||
BOOL StyleAvailable;
|
||||
Status status;
|
||||
|
||||
status = SetStatus(DllExports::GdipIsStyleAvailable(nativeFamily, style, &StyleAvailable));
|
||||
|
||||
if (status != Ok)
|
||||
StyleAvailable = FALSE;
|
||||
|
||||
return StyleAvailable;
|
||||
}
|
||||
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetEmHeight(IN INT style) const
|
||||
{
|
||||
UINT16 EmHeight;
|
||||
|
||||
SetStatus(DllExports::GdipGetEmHeight(nativeFamily, style, &EmHeight));
|
||||
|
||||
return EmHeight;
|
||||
}
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetCellAscent(IN INT style) const
|
||||
{
|
||||
UINT16 CellAscent;
|
||||
|
||||
SetStatus(DllExports::GdipGetCellAscent(nativeFamily, style, &CellAscent));
|
||||
|
||||
return CellAscent;
|
||||
}
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetCellDescent(IN INT style) const
|
||||
{
|
||||
UINT16 CellDescent;
|
||||
|
||||
SetStatus(DllExports::GdipGetCellDescent(nativeFamily, style, &CellDescent));
|
||||
|
||||
return CellDescent;
|
||||
}
|
||||
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetLineSpacing(IN INT style) const
|
||||
{
|
||||
UINT16 LineSpacing;
|
||||
|
||||
SetStatus(DllExports::GdipGetLineSpacing(nativeFamily, style, &LineSpacing));
|
||||
|
||||
return LineSpacing;
|
||||
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFontFamily.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Font Family class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUS_FONT_FAMILY_H
|
||||
#define _GDIPLUS_FONT_FAMILY_H
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily() :
|
||||
nativeFamily (NULL),
|
||||
lastResult (Ok)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily(
|
||||
IN const WCHAR* name,
|
||||
IN const FontCollection* fontCollection
|
||||
)
|
||||
{
|
||||
nativeFamily = NULL;
|
||||
lastResult = DllExports::GdipCreateFontFamilyFromName(
|
||||
name,
|
||||
fontCollection ? fontCollection->nativeFontCollection : NULL,
|
||||
&nativeFamily
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily(
|
||||
IN GpFontFamily *nativeOrig,
|
||||
IN Status status
|
||||
)
|
||||
{
|
||||
lastResult = status;
|
||||
nativeFamily = nativeOrig;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericSansSerif()
|
||||
{
|
||||
if (GenericSansSerifFontFamily != NULL)
|
||||
{
|
||||
return GenericSansSerifFontFamily;
|
||||
}
|
||||
|
||||
GenericSansSerifFontFamily =
|
||||
(FontFamily*) GenericSansSerifFontFamilyBuffer;
|
||||
|
||||
GenericSansSerifFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilySansSerif(
|
||||
&(GenericSansSerifFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericSansSerifFontFamily;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericSerif()
|
||||
{
|
||||
if (GenericSerifFontFamily != NULL)
|
||||
{
|
||||
return GenericSerifFontFamily;
|
||||
}
|
||||
|
||||
GenericSerifFontFamily =
|
||||
(FontFamily*) GenericSerifFontFamilyBuffer;
|
||||
|
||||
GenericSerifFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilySerif(
|
||||
&(GenericSerifFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericSerifFontFamily;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericMonospace()
|
||||
{
|
||||
if (GenericMonospaceFontFamily != NULL)
|
||||
{
|
||||
return GenericMonospaceFontFamily;
|
||||
}
|
||||
|
||||
GenericMonospaceFontFamily =
|
||||
(FontFamily*) GenericMonospaceFontFamilyBuffer;
|
||||
|
||||
GenericMonospaceFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilyMonospace(
|
||||
&(GenericMonospaceFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericMonospaceFontFamily;
|
||||
}
|
||||
|
||||
inline FontFamily::~FontFamily()
|
||||
{
|
||||
DllExports::GdipDeleteFontFamily (nativeFamily);
|
||||
}
|
||||
|
||||
inline FontFamily *
|
||||
FontFamily::Clone() const
|
||||
{
|
||||
GpFontFamily * clonedFamily = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneFontFamily (nativeFamily, &clonedFamily));
|
||||
|
||||
return new FontFamily(clonedFamily, lastResult);
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::GetFamilyName(
|
||||
IN WCHAR name[LF_FACESIZE],
|
||||
IN LANGID language
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetFamilyName(nativeFamily,
|
||||
name,
|
||||
language));
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
FontFamily::IsStyleAvailable(IN INT style) const
|
||||
{
|
||||
BOOL StyleAvailable;
|
||||
Status status;
|
||||
|
||||
status = SetStatus(DllExports::GdipIsStyleAvailable(nativeFamily, style, &StyleAvailable));
|
||||
|
||||
if (status != Ok)
|
||||
StyleAvailable = FALSE;
|
||||
|
||||
return StyleAvailable;
|
||||
}
|
||||
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetEmHeight(IN INT style) const
|
||||
{
|
||||
UINT16 EmHeight;
|
||||
|
||||
SetStatus(DllExports::GdipGetEmHeight(nativeFamily, style, &EmHeight));
|
||||
|
||||
return EmHeight;
|
||||
}
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetCellAscent(IN INT style) const
|
||||
{
|
||||
UINT16 CellAscent;
|
||||
|
||||
SetStatus(DllExports::GdipGetCellAscent(nativeFamily, style, &CellAscent));
|
||||
|
||||
return CellAscent;
|
||||
}
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetCellDescent(IN INT style) const
|
||||
{
|
||||
UINT16 CellDescent;
|
||||
|
||||
SetStatus(DllExports::GdipGetCellDescent(nativeFamily, style, &CellDescent));
|
||||
|
||||
return CellDescent;
|
||||
}
|
||||
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetLineSpacing(IN INT style) const
|
||||
{
|
||||
UINT16 LineSpacing;
|
||||
|
||||
SetStatus(DllExports::GdipGetLineSpacing(nativeFamily, style, &LineSpacing));
|
||||
|
||||
return LineSpacing;
|
||||
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,107 +1,107 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusGpStubs.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* Private GDI+ header file.
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSGPSTUBS_H
|
||||
#define _GDIPLUSGPSTUBS_H
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// GDI+ classes for forward reference
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class Graphics;
|
||||
class Pen;
|
||||
class Brush;
|
||||
class Matrix;
|
||||
class Bitmap;
|
||||
class Metafile;
|
||||
class GraphicsPath;
|
||||
class PathIterator;
|
||||
class Region;
|
||||
class Image;
|
||||
class TextureBrush;
|
||||
class HatchBrush;
|
||||
class SolidBrush;
|
||||
class LinearGradientBrush;
|
||||
class PathGradientBrush;
|
||||
class Font;
|
||||
class FontFamily;
|
||||
class FontCollection;
|
||||
class InstalledFontCollection;
|
||||
class PrivateFontCollection;
|
||||
class ImageAttributes;
|
||||
class CachedBitmap;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Private GDI+ classes for internal type checking
|
||||
//---------------------------------------------------------------------------
|
||||
class GpGraphics {};
|
||||
|
||||
class GpBrush {};
|
||||
class GpTexture : public GpBrush {};
|
||||
class GpSolidFill : public GpBrush {};
|
||||
class GpLineGradient : public GpBrush {};
|
||||
class GpPathGradient : public GpBrush {};
|
||||
class GpHatch : public GpBrush {};
|
||||
|
||||
class GpPen {};
|
||||
class GpCustomLineCap {};
|
||||
class GpAdjustableArrowCap : public GpCustomLineCap {};
|
||||
|
||||
class GpImage {};
|
||||
class GpBitmap : public GpImage {};
|
||||
class GpMetafile : public GpImage {};
|
||||
class GpImageAttributes {};
|
||||
|
||||
class GpPath {};
|
||||
class GpRegion {};
|
||||
class GpPathIterator {};
|
||||
|
||||
class GpFontFamily {};
|
||||
class GpFont {};
|
||||
class GpStringFormat {};
|
||||
class GpFontCollection {};
|
||||
class GpInstalledFontCollection : public GpFontCollection {};
|
||||
class GpPrivateFontCollection : public GpFontCollection {};
|
||||
|
||||
class GpCachedBitmap;
|
||||
|
||||
typedef Status GpStatus;
|
||||
typedef FillMode GpFillMode;
|
||||
typedef WrapMode GpWrapMode;
|
||||
typedef Unit GpUnit;
|
||||
typedef CoordinateSpace GpCoordinateSpace;
|
||||
typedef PointF GpPointF;
|
||||
typedef Point GpPoint;
|
||||
typedef RectF GpRectF;
|
||||
typedef Rect GpRect;
|
||||
typedef SizeF GpSizeF;
|
||||
typedef HatchStyle GpHatchStyle;
|
||||
typedef DashStyle GpDashStyle;
|
||||
typedef LineCap GpLineCap;
|
||||
typedef DashCap GpDashCap;
|
||||
|
||||
|
||||
typedef PenAlignment GpPenAlignment;
|
||||
|
||||
typedef LineJoin GpLineJoin;
|
||||
typedef PenType GpPenType;
|
||||
|
||||
typedef Matrix GpMatrix;
|
||||
typedef BrushType GpBrushType;
|
||||
typedef MatrixOrder GpMatrixOrder;
|
||||
typedef FlushIntention GpFlushIntention;
|
||||
typedef PathData GpPathData;
|
||||
|
||||
#endif // !_GDIPLUSGPSTUBS.HPP
|
||||
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusGpStubs.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* Private GDI+ header file.
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSGPSTUBS_H
|
||||
#define _GDIPLUSGPSTUBS_H
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// GDI+ classes for forward reference
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class Graphics;
|
||||
class Pen;
|
||||
class Brush;
|
||||
class Matrix;
|
||||
class Bitmap;
|
||||
class Metafile;
|
||||
class GraphicsPath;
|
||||
class PathIterator;
|
||||
class Region;
|
||||
class Image;
|
||||
class TextureBrush;
|
||||
class HatchBrush;
|
||||
class SolidBrush;
|
||||
class LinearGradientBrush;
|
||||
class PathGradientBrush;
|
||||
class Font;
|
||||
class FontFamily;
|
||||
class FontCollection;
|
||||
class InstalledFontCollection;
|
||||
class PrivateFontCollection;
|
||||
class ImageAttributes;
|
||||
class CachedBitmap;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Private GDI+ classes for internal type checking
|
||||
//---------------------------------------------------------------------------
|
||||
class GpGraphics {};
|
||||
|
||||
class GpBrush {};
|
||||
class GpTexture : public GpBrush {};
|
||||
class GpSolidFill : public GpBrush {};
|
||||
class GpLineGradient : public GpBrush {};
|
||||
class GpPathGradient : public GpBrush {};
|
||||
class GpHatch : public GpBrush {};
|
||||
|
||||
class GpPen {};
|
||||
class GpCustomLineCap {};
|
||||
class GpAdjustableArrowCap : public GpCustomLineCap {};
|
||||
|
||||
class GpImage {};
|
||||
class GpBitmap : public GpImage {};
|
||||
class GpMetafile : public GpImage {};
|
||||
class GpImageAttributes {};
|
||||
|
||||
class GpPath {};
|
||||
class GpRegion {};
|
||||
class GpPathIterator {};
|
||||
|
||||
class GpFontFamily {};
|
||||
class GpFont {};
|
||||
class GpStringFormat {};
|
||||
class GpFontCollection {};
|
||||
class GpInstalledFontCollection : public GpFontCollection {};
|
||||
class GpPrivateFontCollection : public GpFontCollection {};
|
||||
|
||||
class GpCachedBitmap;
|
||||
|
||||
typedef Status GpStatus;
|
||||
typedef FillMode GpFillMode;
|
||||
typedef WrapMode GpWrapMode;
|
||||
typedef Unit GpUnit;
|
||||
typedef CoordinateSpace GpCoordinateSpace;
|
||||
typedef PointF GpPointF;
|
||||
typedef Point GpPoint;
|
||||
typedef RectF GpRectF;
|
||||
typedef Rect GpRect;
|
||||
typedef SizeF GpSizeF;
|
||||
typedef HatchStyle GpHatchStyle;
|
||||
typedef DashStyle GpDashStyle;
|
||||
typedef LineCap GpLineCap;
|
||||
typedef DashCap GpDashCap;
|
||||
|
||||
|
||||
typedef PenAlignment GpPenAlignment;
|
||||
|
||||
typedef LineJoin GpLineJoin;
|
||||
typedef PenType GpPenType;
|
||||
|
||||
typedef Matrix GpMatrix;
|
||||
typedef BrushType GpBrushType;
|
||||
typedef MatrixOrder GpMatrixOrder;
|
||||
typedef FlushIntention GpFlushIntention;
|
||||
typedef PathData GpPathData;
|
||||
|
||||
#endif // !_GDIPLUSGPSTUBS.HPP
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,59 +1,59 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusImageCodec.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Codec Image APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSIMAGECODEC_H
|
||||
#define _GDIPLUSIMAGECODEC_H
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Codec Management APIs
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
inline Status
|
||||
GetImageDecodersSize(
|
||||
OUT UINT *numDecoders,
|
||||
OUT UINT *size)
|
||||
{
|
||||
return DllExports::GdipGetImageDecodersSize(numDecoders, size);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageDecoders(
|
||||
IN UINT numDecoders,
|
||||
IN UINT size,
|
||||
OUT ImageCodecInfo *decoders)
|
||||
{
|
||||
return DllExports::GdipGetImageDecoders(numDecoders, size, decoders);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageEncodersSize(
|
||||
OUT UINT *numEncoders,
|
||||
OUT UINT *size)
|
||||
{
|
||||
return DllExports::GdipGetImageEncodersSize(numEncoders, size);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageEncoders(
|
||||
IN UINT numEncoders,
|
||||
IN UINT size,
|
||||
OUT ImageCodecInfo *encoders)
|
||||
{
|
||||
return DllExports::GdipGetImageEncoders(numEncoders, size, encoders);
|
||||
}
|
||||
|
||||
#endif // _GDIPLUSIMAGECODEC_H
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusImageCodec.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Codec Image APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSIMAGECODEC_H
|
||||
#define _GDIPLUSIMAGECODEC_H
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Codec Management APIs
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
inline Status
|
||||
GetImageDecodersSize(
|
||||
OUT UINT *numDecoders,
|
||||
OUT UINT *size)
|
||||
{
|
||||
return DllExports::GdipGetImageDecodersSize(numDecoders, size);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageDecoders(
|
||||
IN UINT numDecoders,
|
||||
IN UINT size,
|
||||
OUT ImageCodecInfo *decoders)
|
||||
{
|
||||
return DllExports::GdipGetImageDecoders(numDecoders, size, decoders);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageEncodersSize(
|
||||
OUT UINT *numEncoders,
|
||||
OUT UINT *size)
|
||||
{
|
||||
return DllExports::GdipGetImageEncodersSize(numEncoders, size);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageEncoders(
|
||||
IN UINT numEncoders,
|
||||
IN UINT size,
|
||||
OUT ImageCodecInfo *encoders)
|
||||
{
|
||||
return DllExports::GdipGetImageEncoders(numEncoders, size, encoders);
|
||||
}
|
||||
|
||||
#endif // _GDIPLUSIMAGECODEC_H
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,97 +1,97 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2001 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus initialization
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Startup and Shutdown APIs
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSINIT_H
|
||||
#define _GDIPLUSINIT_H
|
||||
|
||||
enum DebugEventLevel
|
||||
{
|
||||
DebugEventLevelFatal,
|
||||
DebugEventLevelWarning
|
||||
};
|
||||
|
||||
// Callback function that GDI+ can call, on debug builds, for assertions
|
||||
// and warnings.
|
||||
|
||||
typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message);
|
||||
|
||||
// Notification functions which the user must call appropriately if
|
||||
// "SuppressBackgroundThread" (below) is set.
|
||||
|
||||
typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token);
|
||||
typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token);
|
||||
|
||||
// Input structure for GdiplusStartup()
|
||||
|
||||
struct GdiplusStartupInput
|
||||
{
|
||||
UINT32 GdiplusVersion; // Must be 1
|
||||
DebugEventProc DebugEventCallback; // Ignored on free builds
|
||||
BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call
|
||||
// the hook/unhook functions properly
|
||||
BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use
|
||||
// its internal image codecs.
|
||||
|
||||
GdiplusStartupInput(
|
||||
DebugEventProc debugEventCallback = NULL,
|
||||
BOOL suppressBackgroundThread = FALSE,
|
||||
BOOL suppressExternalCodecs = FALSE)
|
||||
{
|
||||
GdiplusVersion = 1;
|
||||
DebugEventCallback = debugEventCallback;
|
||||
SuppressBackgroundThread = suppressBackgroundThread;
|
||||
SuppressExternalCodecs = suppressExternalCodecs;
|
||||
}
|
||||
};
|
||||
|
||||
// Output structure for GdiplusStartup()
|
||||
|
||||
struct GdiplusStartupOutput
|
||||
{
|
||||
// The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
|
||||
// Otherwise, they are functions which must be called appropriately to
|
||||
// replace the background thread.
|
||||
//
|
||||
// These should be called on the application's main message loop - i.e.
|
||||
// a message loop which is active for the lifetime of GDI+.
|
||||
// "NotificationHook" should be called before starting the loop,
|
||||
// and "NotificationUnhook" should be called after the loop ends.
|
||||
|
||||
NotificationHookProc NotificationHook;
|
||||
NotificationUnhookProc NotificationUnhook;
|
||||
};
|
||||
|
||||
// GDI+ initialization. Must not be called from DllMain - can cause deadlock.
|
||||
//
|
||||
// Must be called before GDI+ API's or constructors are used.
|
||||
//
|
||||
// token - may not be NULL - accepts a token to be passed in the corresponding
|
||||
// GdiplusShutdown call.
|
||||
// input - may not be NULL
|
||||
// output - may be NULL only if input->SuppressBackgroundThread is FALSE.
|
||||
|
||||
extern "C" Status WINAPI GdiplusStartup(
|
||||
OUT ULONG_PTR *token,
|
||||
const GdiplusStartupInput *input,
|
||||
OUT GdiplusStartupOutput *output);
|
||||
|
||||
// GDI+ termination. Must be called before GDI+ is unloaded.
|
||||
// Must not be called from DllMain - can cause deadlock.
|
||||
//
|
||||
// GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
|
||||
// to GDI+ object destructors.
|
||||
|
||||
extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
|
||||
|
||||
#endif
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2001 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus initialization
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Startup and Shutdown APIs
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSINIT_H
|
||||
#define _GDIPLUSINIT_H
|
||||
|
||||
enum DebugEventLevel
|
||||
{
|
||||
DebugEventLevelFatal,
|
||||
DebugEventLevelWarning
|
||||
};
|
||||
|
||||
// Callback function that GDI+ can call, on debug builds, for assertions
|
||||
// and warnings.
|
||||
|
||||
typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message);
|
||||
|
||||
// Notification functions which the user must call appropriately if
|
||||
// "SuppressBackgroundThread" (below) is set.
|
||||
|
||||
typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token);
|
||||
typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token);
|
||||
|
||||
// Input structure for GdiplusStartup()
|
||||
|
||||
struct GdiplusStartupInput
|
||||
{
|
||||
UINT32 GdiplusVersion; // Must be 1
|
||||
DebugEventProc DebugEventCallback; // Ignored on free builds
|
||||
BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call
|
||||
// the hook/unhook functions properly
|
||||
BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use
|
||||
// its internal image codecs.
|
||||
|
||||
GdiplusStartupInput(
|
||||
DebugEventProc debugEventCallback = NULL,
|
||||
BOOL suppressBackgroundThread = FALSE,
|
||||
BOOL suppressExternalCodecs = FALSE)
|
||||
{
|
||||
GdiplusVersion = 1;
|
||||
DebugEventCallback = debugEventCallback;
|
||||
SuppressBackgroundThread = suppressBackgroundThread;
|
||||
SuppressExternalCodecs = suppressExternalCodecs;
|
||||
}
|
||||
};
|
||||
|
||||
// Output structure for GdiplusStartup()
|
||||
|
||||
struct GdiplusStartupOutput
|
||||
{
|
||||
// The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
|
||||
// Otherwise, they are functions which must be called appropriately to
|
||||
// replace the background thread.
|
||||
//
|
||||
// These should be called on the application's main message loop - i.e.
|
||||
// a message loop which is active for the lifetime of GDI+.
|
||||
// "NotificationHook" should be called before starting the loop,
|
||||
// and "NotificationUnhook" should be called after the loop ends.
|
||||
|
||||
NotificationHookProc NotificationHook;
|
||||
NotificationUnhookProc NotificationUnhook;
|
||||
};
|
||||
|
||||
// GDI+ initialization. Must not be called from DllMain - can cause deadlock.
|
||||
//
|
||||
// Must be called before GDI+ API's or constructors are used.
|
||||
//
|
||||
// token - may not be NULL - accepts a token to be passed in the corresponding
|
||||
// GdiplusShutdown call.
|
||||
// input - may not be NULL
|
||||
// output - may be NULL only if input->SuppressBackgroundThread is FALSE.
|
||||
|
||||
extern "C" Status WINAPI GdiplusStartup(
|
||||
OUT ULONG_PTR *token,
|
||||
const GdiplusStartupInput *input,
|
||||
OUT GdiplusStartupOutput *output);
|
||||
|
||||
// GDI+ termination. Must be called before GDI+ is unloaded.
|
||||
// Must not be called from DllMain - can cause deadlock.
|
||||
//
|
||||
// GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
|
||||
// to GDI+ object destructors.
|
||||
|
||||
extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,262 +1,262 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusLineCaps.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ CustomLineCap APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSLINECAPS_H
|
||||
#define _GDIPLUSLINECAPS_H
|
||||
|
||||
inline
|
||||
CustomLineCap::CustomLineCap(
|
||||
IN const GraphicsPath* fillPath,
|
||||
IN const GraphicsPath* strokePath,
|
||||
IN LineCap baseCap,
|
||||
IN REAL baseInset
|
||||
)
|
||||
{
|
||||
nativeCap = NULL;
|
||||
GpPath* nativeFillPath = NULL;
|
||||
GpPath* nativeStrokePath = NULL;
|
||||
|
||||
if(fillPath)
|
||||
nativeFillPath = fillPath->nativePath;
|
||||
if(strokePath)
|
||||
nativeStrokePath = strokePath->nativePath;
|
||||
|
||||
lastResult = DllExports::GdipCreateCustomLineCap(
|
||||
nativeFillPath, nativeStrokePath,
|
||||
baseCap, baseInset, &nativeCap);
|
||||
}
|
||||
|
||||
inline
|
||||
CustomLineCap::CustomLineCap()
|
||||
{
|
||||
nativeCap = NULL;
|
||||
lastResult = Ok;
|
||||
}
|
||||
|
||||
inline
|
||||
CustomLineCap::~CustomLineCap()
|
||||
{
|
||||
DllExports::GdipDeleteCustomLineCap(nativeCap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetStrokeCaps(
|
||||
IN LineCap startCap,
|
||||
IN LineCap endCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap,
|
||||
startCap, endCap));
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::GetStrokeCaps(
|
||||
OUT LineCap* startCap,
|
||||
OUT LineCap* endCap) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap,
|
||||
startCap, endCap));
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetStrokeJoin(
|
||||
IN LineJoin lineJoin)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap,
|
||||
lineJoin));
|
||||
}
|
||||
|
||||
inline LineJoin
|
||||
CustomLineCap::GetStrokeJoin() const
|
||||
{
|
||||
LineJoin lineJoin;
|
||||
|
||||
SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap,
|
||||
&lineJoin));
|
||||
|
||||
return lineJoin;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetBaseCap(IN LineCap baseCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap,
|
||||
baseCap));
|
||||
}
|
||||
|
||||
inline LineCap
|
||||
CustomLineCap::GetBaseCap() const
|
||||
{
|
||||
LineCap baseCap;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap));
|
||||
|
||||
return baseCap;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetBaseInset(IN REAL inset)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap,
|
||||
inset));
|
||||
}
|
||||
|
||||
inline REAL
|
||||
CustomLineCap::GetBaseInset() const
|
||||
{
|
||||
REAL inset;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset));
|
||||
|
||||
return inset;
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetWidthScale(IN REAL widthScale)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap,
|
||||
widthScale));
|
||||
}
|
||||
|
||||
inline REAL
|
||||
CustomLineCap::GetWidthScale() const
|
||||
{
|
||||
REAL widthScale;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap,
|
||||
&widthScale));
|
||||
|
||||
return widthScale;
|
||||
}
|
||||
|
||||
inline CustomLineCap*
|
||||
CustomLineCap::Clone() const
|
||||
{
|
||||
GpCustomLineCap *newNativeLineCap = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap,
|
||||
&newNativeLineCap));
|
||||
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap,
|
||||
lastResult);
|
||||
if (newLineCap == NULL)
|
||||
{
|
||||
SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap));
|
||||
}
|
||||
|
||||
return newLineCap;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
return (lastStatus);
|
||||
}
|
||||
|
||||
class AdjustableArrowCap : public CustomLineCap
|
||||
{
|
||||
public:
|
||||
|
||||
AdjustableArrowCap(
|
||||
IN REAL height,
|
||||
IN REAL width,
|
||||
IN BOOL isFilled = TRUE
|
||||
)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateAdjustableArrowCap(
|
||||
height, width, isFilled, &cap);
|
||||
SetNativeCap(cap);
|
||||
}
|
||||
|
||||
Status SetHeight(IN REAL height)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight(
|
||||
cap, height));
|
||||
}
|
||||
|
||||
REAL GetHeight() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapHeight(
|
||||
cap, &height));
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
Status SetWidth(IN REAL width)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth(
|
||||
cap, width));
|
||||
}
|
||||
|
||||
REAL GetWidth() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL width;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapWidth(
|
||||
cap, &width));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
Status SetMiddleInset(IN REAL middleInset)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
|
||||
cap, middleInset));
|
||||
}
|
||||
|
||||
REAL GetMiddleInset() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL middleInset;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
|
||||
cap, &middleInset));
|
||||
|
||||
return middleInset;
|
||||
}
|
||||
|
||||
Status SetFillState(IN BOOL isFilled)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState(
|
||||
cap, isFilled));
|
||||
}
|
||||
|
||||
BOOL IsFilled() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
BOOL isFilled;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapFillState(
|
||||
cap, &isFilled));
|
||||
|
||||
return isFilled;
|
||||
}
|
||||
|
||||
private:
|
||||
AdjustableArrowCap(const AdjustableArrowCap &);
|
||||
AdjustableArrowCap& operator=(const AdjustableArrowCap &);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusLineCaps.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ CustomLineCap APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSLINECAPS_H
|
||||
#define _GDIPLUSLINECAPS_H
|
||||
|
||||
inline
|
||||
CustomLineCap::CustomLineCap(
|
||||
IN const GraphicsPath* fillPath,
|
||||
IN const GraphicsPath* strokePath,
|
||||
IN LineCap baseCap,
|
||||
IN REAL baseInset
|
||||
)
|
||||
{
|
||||
nativeCap = NULL;
|
||||
GpPath* nativeFillPath = NULL;
|
||||
GpPath* nativeStrokePath = NULL;
|
||||
|
||||
if(fillPath)
|
||||
nativeFillPath = fillPath->nativePath;
|
||||
if(strokePath)
|
||||
nativeStrokePath = strokePath->nativePath;
|
||||
|
||||
lastResult = DllExports::GdipCreateCustomLineCap(
|
||||
nativeFillPath, nativeStrokePath,
|
||||
baseCap, baseInset, &nativeCap);
|
||||
}
|
||||
|
||||
inline
|
||||
CustomLineCap::CustomLineCap()
|
||||
{
|
||||
nativeCap = NULL;
|
||||
lastResult = Ok;
|
||||
}
|
||||
|
||||
inline
|
||||
CustomLineCap::~CustomLineCap()
|
||||
{
|
||||
DllExports::GdipDeleteCustomLineCap(nativeCap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetStrokeCaps(
|
||||
IN LineCap startCap,
|
||||
IN LineCap endCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap,
|
||||
startCap, endCap));
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::GetStrokeCaps(
|
||||
OUT LineCap* startCap,
|
||||
OUT LineCap* endCap) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap,
|
||||
startCap, endCap));
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetStrokeJoin(
|
||||
IN LineJoin lineJoin)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap,
|
||||
lineJoin));
|
||||
}
|
||||
|
||||
inline LineJoin
|
||||
CustomLineCap::GetStrokeJoin() const
|
||||
{
|
||||
LineJoin lineJoin;
|
||||
|
||||
SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap,
|
||||
&lineJoin));
|
||||
|
||||
return lineJoin;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetBaseCap(IN LineCap baseCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap,
|
||||
baseCap));
|
||||
}
|
||||
|
||||
inline LineCap
|
||||
CustomLineCap::GetBaseCap() const
|
||||
{
|
||||
LineCap baseCap;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap));
|
||||
|
||||
return baseCap;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetBaseInset(IN REAL inset)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap,
|
||||
inset));
|
||||
}
|
||||
|
||||
inline REAL
|
||||
CustomLineCap::GetBaseInset() const
|
||||
{
|
||||
REAL inset;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset));
|
||||
|
||||
return inset;
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetWidthScale(IN REAL widthScale)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap,
|
||||
widthScale));
|
||||
}
|
||||
|
||||
inline REAL
|
||||
CustomLineCap::GetWidthScale() const
|
||||
{
|
||||
REAL widthScale;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap,
|
||||
&widthScale));
|
||||
|
||||
return widthScale;
|
||||
}
|
||||
|
||||
inline CustomLineCap*
|
||||
CustomLineCap::Clone() const
|
||||
{
|
||||
GpCustomLineCap *newNativeLineCap = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap,
|
||||
&newNativeLineCap));
|
||||
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap,
|
||||
lastResult);
|
||||
if (newLineCap == NULL)
|
||||
{
|
||||
SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap));
|
||||
}
|
||||
|
||||
return newLineCap;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
return (lastStatus);
|
||||
}
|
||||
|
||||
class AdjustableArrowCap : public CustomLineCap
|
||||
{
|
||||
public:
|
||||
|
||||
AdjustableArrowCap(
|
||||
IN REAL height,
|
||||
IN REAL width,
|
||||
IN BOOL isFilled = TRUE
|
||||
)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateAdjustableArrowCap(
|
||||
height, width, isFilled, &cap);
|
||||
SetNativeCap(cap);
|
||||
}
|
||||
|
||||
Status SetHeight(IN REAL height)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight(
|
||||
cap, height));
|
||||
}
|
||||
|
||||
REAL GetHeight() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapHeight(
|
||||
cap, &height));
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
Status SetWidth(IN REAL width)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth(
|
||||
cap, width));
|
||||
}
|
||||
|
||||
REAL GetWidth() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL width;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapWidth(
|
||||
cap, &width));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
Status SetMiddleInset(IN REAL middleInset)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
|
||||
cap, middleInset));
|
||||
}
|
||||
|
||||
REAL GetMiddleInset() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL middleInset;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
|
||||
cap, &middleInset));
|
||||
|
||||
return middleInset;
|
||||
}
|
||||
|
||||
Status SetFillState(IN BOOL isFilled)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState(
|
||||
cap, isFilled));
|
||||
}
|
||||
|
||||
BOOL IsFilled() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
BOOL isFilled;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapFillState(
|
||||
cap, &isFilled));
|
||||
|
||||
return isFilled;
|
||||
}
|
||||
|
||||
private:
|
||||
AdjustableArrowCap(const AdjustableArrowCap &);
|
||||
AdjustableArrowCap& operator=(const AdjustableArrowCap &);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,307 +1,307 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMatrix.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Matrix class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
class Matrix : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Graphics;
|
||||
friend class GraphicsPath;
|
||||
friend class TextureBrush;
|
||||
friend class LinearGradientBrush;
|
||||
friend class PathGradientBrush;
|
||||
friend class Pen;
|
||||
friend class Region;
|
||||
|
||||
// Default constructor is set to identity matrix.
|
||||
|
||||
Matrix()
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix(&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN REAL m11,
|
||||
IN REAL m12,
|
||||
IN REAL m21,
|
||||
IN REAL m22,
|
||||
IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix2(m11, m12, m21, m22,
|
||||
dx, dy, &matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN const RectF& rect,
|
||||
IN const PointF* dstplg)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix3(&rect,
|
||||
dstplg,
|
||||
&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN const Rect& rect,
|
||||
IN const Point* dstplg)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix3I(&rect,
|
||||
dstplg,
|
||||
&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
~Matrix()
|
||||
{
|
||||
DllExports::GdipDeleteMatrix(nativeMatrix);
|
||||
}
|
||||
|
||||
Matrix *Clone() const
|
||||
{
|
||||
GpMatrix *cloneMatrix = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneMatrix(nativeMatrix,
|
||||
&cloneMatrix));
|
||||
|
||||
if (lastResult != Ok)
|
||||
return NULL;
|
||||
|
||||
return new Matrix(cloneMatrix);
|
||||
}
|
||||
|
||||
Status GetElements(OUT REAL *m) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m));
|
||||
}
|
||||
|
||||
Status SetElements(IN REAL m11,
|
||||
IN REAL m12,
|
||||
IN REAL m21,
|
||||
IN REAL m22,
|
||||
IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix,
|
||||
m11, m12, m21, m22, dx, dy));
|
||||
}
|
||||
|
||||
REAL OffsetX() const
|
||||
{
|
||||
REAL elements[6];
|
||||
|
||||
if (GetElements(&elements[0]) == Ok)
|
||||
return elements[4];
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
REAL OffsetY() const
|
||||
{
|
||||
REAL elements[6];
|
||||
|
||||
if (GetElements(&elements[0]) == Ok)
|
||||
return elements[5];
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Status Reset()
|
||||
{
|
||||
// set identity matrix elements
|
||||
return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix,
|
||||
1.0, 0.0, 0.0, 1.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
Status Multiply(IN const Matrix *matrix,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix,
|
||||
matrix->nativeMatrix,
|
||||
order));
|
||||
}
|
||||
|
||||
Status Translate(IN REAL offsetX,
|
||||
IN REAL offsetY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX,
|
||||
offsetY, order));
|
||||
}
|
||||
|
||||
Status Scale(IN REAL scaleX,
|
||||
IN REAL scaleY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX,
|
||||
scaleY, order));
|
||||
}
|
||||
|
||||
Status Rotate(IN REAL angle,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
}
|
||||
|
||||
Status RotateAt(IN REAL angle,
|
||||
IN const PointF& center,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
if(order == MatrixOrderPrepend)
|
||||
{
|
||||
SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X,
|
||||
center.Y, order));
|
||||
SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
-center.X,
|
||||
-center.Y,
|
||||
order));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
- center.X,
|
||||
- center.Y,
|
||||
order));
|
||||
SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
center.X,
|
||||
center.Y,
|
||||
order));
|
||||
}
|
||||
}
|
||||
|
||||
Status Shear(IN REAL shearX,
|
||||
IN REAL shearY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX,
|
||||
shearY, order));
|
||||
}
|
||||
|
||||
Status Invert()
|
||||
{
|
||||
return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix));
|
||||
}
|
||||
|
||||
// float version
|
||||
Status TransformPoints(IN OUT PointF* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix,
|
||||
pts, count));
|
||||
}
|
||||
|
||||
Status TransformPoints(IN OUT Point* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix,
|
||||
pts,
|
||||
count));
|
||||
}
|
||||
|
||||
Status TransformVectors(IN OUT PointF* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipVectorTransformMatrixPoints(
|
||||
nativeMatrix, pts, count));
|
||||
}
|
||||
|
||||
Status TransformVectors(IN OUT Point* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(
|
||||
nativeMatrix,
|
||||
pts,
|
||||
count));
|
||||
}
|
||||
|
||||
BOOL IsInvertible() const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL IsIdentity() const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL Equals(IN const Matrix *matrix) const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix,
|
||||
matrix->nativeMatrix,
|
||||
&result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix(const Matrix &);
|
||||
Matrix& operator=(const Matrix &);
|
||||
|
||||
protected:
|
||||
Matrix(GpMatrix *nativeMatrix)
|
||||
{
|
||||
lastResult = Ok;
|
||||
SetNativeMatrix(nativeMatrix);
|
||||
}
|
||||
|
||||
VOID SetNativeMatrix(GpMatrix *nativeMatrix)
|
||||
{
|
||||
this->nativeMatrix = nativeMatrix;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
GpMatrix *nativeMatrix;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMatrix.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Matrix class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
class Matrix : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Graphics;
|
||||
friend class GraphicsPath;
|
||||
friend class TextureBrush;
|
||||
friend class LinearGradientBrush;
|
||||
friend class PathGradientBrush;
|
||||
friend class Pen;
|
||||
friend class Region;
|
||||
|
||||
// Default constructor is set to identity matrix.
|
||||
|
||||
Matrix()
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix(&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN REAL m11,
|
||||
IN REAL m12,
|
||||
IN REAL m21,
|
||||
IN REAL m22,
|
||||
IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix2(m11, m12, m21, m22,
|
||||
dx, dy, &matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN const RectF& rect,
|
||||
IN const PointF* dstplg)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix3(&rect,
|
||||
dstplg,
|
||||
&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN const Rect& rect,
|
||||
IN const Point* dstplg)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix3I(&rect,
|
||||
dstplg,
|
||||
&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
~Matrix()
|
||||
{
|
||||
DllExports::GdipDeleteMatrix(nativeMatrix);
|
||||
}
|
||||
|
||||
Matrix *Clone() const
|
||||
{
|
||||
GpMatrix *cloneMatrix = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneMatrix(nativeMatrix,
|
||||
&cloneMatrix));
|
||||
|
||||
if (lastResult != Ok)
|
||||
return NULL;
|
||||
|
||||
return new Matrix(cloneMatrix);
|
||||
}
|
||||
|
||||
Status GetElements(OUT REAL *m) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m));
|
||||
}
|
||||
|
||||
Status SetElements(IN REAL m11,
|
||||
IN REAL m12,
|
||||
IN REAL m21,
|
||||
IN REAL m22,
|
||||
IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix,
|
||||
m11, m12, m21, m22, dx, dy));
|
||||
}
|
||||
|
||||
REAL OffsetX() const
|
||||
{
|
||||
REAL elements[6];
|
||||
|
||||
if (GetElements(&elements[0]) == Ok)
|
||||
return elements[4];
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
REAL OffsetY() const
|
||||
{
|
||||
REAL elements[6];
|
||||
|
||||
if (GetElements(&elements[0]) == Ok)
|
||||
return elements[5];
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Status Reset()
|
||||
{
|
||||
// set identity matrix elements
|
||||
return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix,
|
||||
1.0, 0.0, 0.0, 1.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
Status Multiply(IN const Matrix *matrix,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix,
|
||||
matrix->nativeMatrix,
|
||||
order));
|
||||
}
|
||||
|
||||
Status Translate(IN REAL offsetX,
|
||||
IN REAL offsetY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX,
|
||||
offsetY, order));
|
||||
}
|
||||
|
||||
Status Scale(IN REAL scaleX,
|
||||
IN REAL scaleY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX,
|
||||
scaleY, order));
|
||||
}
|
||||
|
||||
Status Rotate(IN REAL angle,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
}
|
||||
|
||||
Status RotateAt(IN REAL angle,
|
||||
IN const PointF& center,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
if(order == MatrixOrderPrepend)
|
||||
{
|
||||
SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X,
|
||||
center.Y, order));
|
||||
SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
-center.X,
|
||||
-center.Y,
|
||||
order));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
- center.X,
|
||||
- center.Y,
|
||||
order));
|
||||
SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
center.X,
|
||||
center.Y,
|
||||
order));
|
||||
}
|
||||
}
|
||||
|
||||
Status Shear(IN REAL shearX,
|
||||
IN REAL shearY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX,
|
||||
shearY, order));
|
||||
}
|
||||
|
||||
Status Invert()
|
||||
{
|
||||
return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix));
|
||||
}
|
||||
|
||||
// float version
|
||||
Status TransformPoints(IN OUT PointF* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix,
|
||||
pts, count));
|
||||
}
|
||||
|
||||
Status TransformPoints(IN OUT Point* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix,
|
||||
pts,
|
||||
count));
|
||||
}
|
||||
|
||||
Status TransformVectors(IN OUT PointF* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipVectorTransformMatrixPoints(
|
||||
nativeMatrix, pts, count));
|
||||
}
|
||||
|
||||
Status TransformVectors(IN OUT Point* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(
|
||||
nativeMatrix,
|
||||
pts,
|
||||
count));
|
||||
}
|
||||
|
||||
BOOL IsInvertible() const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL IsIdentity() const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL Equals(IN const Matrix *matrix) const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix,
|
||||
matrix->nativeMatrix,
|
||||
&result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix(const Matrix &);
|
||||
Matrix& operator=(const Matrix &);
|
||||
|
||||
protected:
|
||||
Matrix(GpMatrix *nativeMatrix)
|
||||
{
|
||||
lastResult = Ok;
|
||||
SetNativeMatrix(nativeMatrix);
|
||||
}
|
||||
|
||||
VOID SetNativeMatrix(GpMatrix *nativeMatrix)
|
||||
{
|
||||
this->nativeMatrix = nativeMatrix;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
GpMatrix *nativeMatrix;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMem.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Private Memory Management APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMEM_H
|
||||
#define _GDIPLUSMEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WINGDIPAPI __stdcall
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Memory Allocation APIs
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void* WINGDIPAPI
|
||||
GdipAlloc(size_t size);
|
||||
|
||||
void WINGDIPAPI
|
||||
GdipFree(void* ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !_GDIPLUSMEM_H
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMem.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Private Memory Management APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMEM_H
|
||||
#define _GDIPLUSMEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WINGDIPAPI __stdcall
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Memory Allocation APIs
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void* WINGDIPAPI
|
||||
GdipAlloc(size_t size);
|
||||
|
||||
void WINGDIPAPI
|
||||
GdipFree(void* ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !_GDIPLUSMEM_H
|
||||
|
|
|
@ -1,381 +1,381 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMetafile.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Metafile class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMETAFILE_H
|
||||
#define _GDIPLUSMETAFILE_H
|
||||
|
||||
class Metafile : public Image
|
||||
{
|
||||
public:
|
||||
friend class Image;
|
||||
|
||||
// Playback a metafile from a HMETAFILE
|
||||
// If deleteWmf is TRUE, then when the metafile is deleted,
|
||||
// the hWmf will also be deleted. Otherwise, it won't be.
|
||||
|
||||
Metafile(IN HMETAFILE hWmf,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader,
|
||||
IN BOOL deleteWmf = FALSE)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf,
|
||||
wmfPlaceableFileHeader,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Playback a metafile from a HENHMETAFILE
|
||||
// If deleteEmf is TRUE, then when the metafile is deleted,
|
||||
// the hEmf will also be deleted. Otherwise, it won't be.
|
||||
|
||||
Metafile(IN HENHMETAFILE hEmf,
|
||||
IN BOOL deleteEmf = FALSE)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(IN const WCHAR* filename)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromFile(filename,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Playback a WMF metafile from a file.
|
||||
|
||||
Metafile(IN const WCHAR* filename,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename,
|
||||
wmfPlaceableFileHeader,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(IN IStream* stream)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromStream(stream,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafile(
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafile(
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileI(
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileName(fileName,
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileName(fileName,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileNameI(fileName,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStream(stream,
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStream(stream,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStreamI(stream,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN HMETAFILE hWmf,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromWmf(hWmf,
|
||||
wmfPlaceableFileHeader,
|
||||
header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN HENHMETAFILE hEmf,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN const WCHAR* filename,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromFile(filename, header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN IStream * stream,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromStream(stream, header);
|
||||
}
|
||||
|
||||
Status GetMetafileHeader(
|
||||
OUT MetafileHeader * header
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile(
|
||||
(GpMetafile *)nativeImage,
|
||||
header));
|
||||
}
|
||||
|
||||
// Once this method is called, the Metafile object is in an invalid state
|
||||
// and can no longer be used. It is the responsiblity of the caller to
|
||||
// invoke DeleteEnhMetaFile to delete this hEmf.
|
||||
|
||||
HENHMETAFILE GetHENHMETAFILE()
|
||||
{
|
||||
HENHMETAFILE hEmf;
|
||||
|
||||
SetStatus(DllExports::GdipGetHemfFromMetafile(
|
||||
(GpMetafile *)nativeImage,
|
||||
&hEmf));
|
||||
|
||||
return hEmf;
|
||||
}
|
||||
|
||||
// Used in conjuction with Graphics::EnumerateMetafile to play an EMF+
|
||||
// The data must be DWORD aligned if it's an EMF or EMF+. It must be
|
||||
// WORD aligned if it's a WMF.
|
||||
|
||||
Status PlayRecord(
|
||||
IN EmfPlusRecordType recordType,
|
||||
IN UINT flags,
|
||||
IN UINT dataSize,
|
||||
IN const BYTE * data
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipPlayMetafileRecord(
|
||||
(GpMetafile *)nativeImage,
|
||||
recordType,
|
||||
flags,
|
||||
dataSize,
|
||||
data));
|
||||
}
|
||||
|
||||
// If you're using a printer HDC for the metafile, but you want the
|
||||
// metafile rasterized at screen resolution, then use this API to set
|
||||
// the rasterization dpi of the metafile to the screen resolution,
|
||||
// e.g. 96 dpi or 120 dpi.
|
||||
|
||||
Status SetDownLevelRasterizationLimit(
|
||||
IN UINT metafileRasterizationLimitDpi
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::
|
||||
GdipSetMetafileDownLevelRasterizationLimit(
|
||||
(GpMetafile *)nativeImage,
|
||||
metafileRasterizationLimitDpi));
|
||||
}
|
||||
|
||||
UINT GetDownLevelRasterizationLimit() const
|
||||
{
|
||||
UINT metafileRasterizationLimitDpi = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit(
|
||||
(GpMetafile *)nativeImage,
|
||||
&metafileRasterizationLimitDpi));
|
||||
|
||||
return metafileRasterizationLimitDpi;
|
||||
}
|
||||
|
||||
static UINT Metafile::EmfToWmfBits(
|
||||
IN HENHMETAFILE hemf,
|
||||
IN UINT cbData16,
|
||||
OUT LPBYTE pData16,
|
||||
IN INT iMapMode = MM_ANISOTROPIC,
|
||||
IN INT eFlags = EmfToWmfBitsFlagsDefault
|
||||
)
|
||||
{
|
||||
return DllExports::GdipEmfToWmfBits(
|
||||
hemf,
|
||||
cbData16,
|
||||
pData16,
|
||||
iMapMode,
|
||||
eFlags);
|
||||
}
|
||||
|
||||
protected:
|
||||
Metafile()
|
||||
{
|
||||
SetNativeImage(NULL);
|
||||
lastResult = Ok;
|
||||
}
|
||||
|
||||
private:
|
||||
Metafile(const Metafile &);
|
||||
Metafile& operator=(const Metafile &);
|
||||
};
|
||||
|
||||
#endif // !_METAFILE_H
|
||||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMetafile.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Metafile class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMETAFILE_H
|
||||
#define _GDIPLUSMETAFILE_H
|
||||
|
||||
class Metafile : public Image
|
||||
{
|
||||
public:
|
||||
friend class Image;
|
||||
|
||||
// Playback a metafile from a HMETAFILE
|
||||
// If deleteWmf is TRUE, then when the metafile is deleted,
|
||||
// the hWmf will also be deleted. Otherwise, it won't be.
|
||||
|
||||
Metafile(IN HMETAFILE hWmf,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader,
|
||||
IN BOOL deleteWmf = FALSE)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf,
|
||||
wmfPlaceableFileHeader,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Playback a metafile from a HENHMETAFILE
|
||||
// If deleteEmf is TRUE, then when the metafile is deleted,
|
||||
// the hEmf will also be deleted. Otherwise, it won't be.
|
||||
|
||||
Metafile(IN HENHMETAFILE hEmf,
|
||||
IN BOOL deleteEmf = FALSE)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(IN const WCHAR* filename)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromFile(filename,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Playback a WMF metafile from a file.
|
||||
|
||||
Metafile(IN const WCHAR* filename,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename,
|
||||
wmfPlaceableFileHeader,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(IN IStream* stream)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromStream(stream,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafile(
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafile(
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileI(
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileName(fileName,
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileName(fileName,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileNameI(fileName,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStream(stream,
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStream(stream,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStreamI(stream,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN HMETAFILE hWmf,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromWmf(hWmf,
|
||||
wmfPlaceableFileHeader,
|
||||
header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN HENHMETAFILE hEmf,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN const WCHAR* filename,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromFile(filename, header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN IStream * stream,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromStream(stream, header);
|
||||
}
|
||||
|
||||
Status GetMetafileHeader(
|
||||
OUT MetafileHeader * header
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile(
|
||||
(GpMetafile *)nativeImage,
|
||||
header));
|
||||
}
|
||||
|
||||
// Once this method is called, the Metafile object is in an invalid state
|
||||
// and can no longer be used. It is the responsiblity of the caller to
|
||||
// invoke DeleteEnhMetaFile to delete this hEmf.
|
||||
|
||||
HENHMETAFILE GetHENHMETAFILE()
|
||||
{
|
||||
HENHMETAFILE hEmf;
|
||||
|
||||
SetStatus(DllExports::GdipGetHemfFromMetafile(
|
||||
(GpMetafile *)nativeImage,
|
||||
&hEmf));
|
||||
|
||||
return hEmf;
|
||||
}
|
||||
|
||||
// Used in conjuction with Graphics::EnumerateMetafile to play an EMF+
|
||||
// The data must be DWORD aligned if it's an EMF or EMF+. It must be
|
||||
// WORD aligned if it's a WMF.
|
||||
|
||||
Status PlayRecord(
|
||||
IN EmfPlusRecordType recordType,
|
||||
IN UINT flags,
|
||||
IN UINT dataSize,
|
||||
IN const BYTE * data
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipPlayMetafileRecord(
|
||||
(GpMetafile *)nativeImage,
|
||||
recordType,
|
||||
flags,
|
||||
dataSize,
|
||||
data));
|
||||
}
|
||||
|
||||
// If you're using a printer HDC for the metafile, but you want the
|
||||
// metafile rasterized at screen resolution, then use this API to set
|
||||
// the rasterization dpi of the metafile to the screen resolution,
|
||||
// e.g. 96 dpi or 120 dpi.
|
||||
|
||||
Status SetDownLevelRasterizationLimit(
|
||||
IN UINT metafileRasterizationLimitDpi
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::
|
||||
GdipSetMetafileDownLevelRasterizationLimit(
|
||||
(GpMetafile *)nativeImage,
|
||||
metafileRasterizationLimitDpi));
|
||||
}
|
||||
|
||||
UINT GetDownLevelRasterizationLimit() const
|
||||
{
|
||||
UINT metafileRasterizationLimitDpi = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit(
|
||||
(GpMetafile *)nativeImage,
|
||||
&metafileRasterizationLimitDpi));
|
||||
|
||||
return metafileRasterizationLimitDpi;
|
||||
}
|
||||
|
||||
static UINT Metafile::EmfToWmfBits(
|
||||
IN HENHMETAFILE hemf,
|
||||
IN UINT cbData16,
|
||||
OUT LPBYTE pData16,
|
||||
IN INT iMapMode = MM_ANISOTROPIC,
|
||||
IN INT eFlags = EmfToWmfBitsFlagsDefault
|
||||
)
|
||||
{
|
||||
return DllExports::GdipEmfToWmfBits(
|
||||
hemf,
|
||||
cbData16,
|
||||
pData16,
|
||||
iMapMode,
|
||||
eFlags);
|
||||
}
|
||||
|
||||
protected:
|
||||
Metafile()
|
||||
{
|
||||
SetNativeImage(NULL);
|
||||
lastResult = Ok;
|
||||
}
|
||||
|
||||
private:
|
||||
Metafile(const Metafile &);
|
||||
Metafile& operator=(const Metafile &);
|
||||
};
|
||||
|
||||
#endif // !_METAFILE_H
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue