From cfffc5927a6ff26c90250695f8aca74f80c3a6a7 Mon Sep 17 00:00:00 2001 From: gecko_reverse Date: Tue, 16 Sep 2008 03:20:08 +0000 Subject: [PATCH] cocoa port compile fixes --- desmume/src/GPU_osd.cpp | 235 +++++++++--------- desmume/src/cocoa/DeSmuME.cbp | 4 +- .../cocoa/DeSmuME.xcodeproj/project.pbxproj | 12 +- .../dialogs/speed_limit_selection_window.h | 2 +- desmume/src/cocoa/main_window.m | 2 +- desmume/src/cocoa/nds_control.mm | 1 - desmume/src/types.h | 2 +- 7 files changed, 135 insertions(+), 123 deletions(-) diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index c2a43d98b..bea045fad 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -1,122 +1,129 @@ -/* 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 "mem.h" - -extern u8 GPU_screen[4*256*192]; - -#include "font_eng.inc" - -OSDCLASS::OSDCLASS(int core) -{ - int i; - - memset(screen, 0, sizeof(screen)); - memset(name,0,7); - - mode=core; - offset=0; - - if (core==0) - memcpy(name,"Core A",6); - else - if (core==1) - memcpy(name,"Core B",6); - else - { - memcpy(name,"Main",6); - mode=255; - } - - - printlog("OSD_Init (%s)\n",name); -} - -OSDCLASS::~OSDCLASS() -{ - printlog("OSD_Deinit (%s)\n",name); -} - -void OSDCLASS::setOffset(int ofs) -{ - offset=ofs; -} - -void INLINE OSDCLASS::printChar(int x, int y, char c) -{ - int i, j; - int ofs=c*OSD_FONT_HEIGHT; - unsigned char bits[9]={256, 128, 64, 32, 16, 8, 4, 2, 1}; - u8 *dst=screen; - dst+=(y*256)+x; - - for (i = 0; i < OSD_FONT_HEIGHT; i++) - { - for (j = 0; j < OSD_FONT_WIDTH; j++) - if (font_eng[ofs] & bits[j]) dst[j]=1; - else dst[j]=0; - dst+=256; - ofs++; - } -} - -void OSDCLASS::update() // don't optimized -{ - u8 *dst=GPU_screen; - if (mode!=255) - dst+=offset*512; - - for (int i=0; i<256*192; i++) - { - if (screen[i]) - { - T2WriteWord(dst,(i << 1),0x8F); - } - } -} - -void OSDCLASS::addLines(const char *fmt, ...) -{ - -} - -void OSDCLASS::addFixed(int x, int y, const char *fmt, ...) -{ +/* 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 "mem.h" +#include //mem funcs +#include //va_start, etc + +extern u8 GPU_screen[4*256*192]; + +#include "font_eng.inc" + +OSDCLASS::OSDCLASS(int core) +{ + int i; + + memset(screen, 0, sizeof(screen)); + memset(name,0,7); + + mode=core; + offset=0; + + if (core==0) + memcpy(name,"Core A",6); + else + if (core==1) + memcpy(name,"Core B",6); + else + { + memcpy(name,"Main",6); + mode=255; + } + + + printlog("OSD_Init (%s)\n",name); +} + +OSDCLASS::~OSDCLASS() +{ + printlog("OSD_Deinit (%s)\n",name); +} + +void OSDCLASS::setOffset(int ofs) +{ + offset=ofs; +} + +void INLINE OSDCLASS::printChar(int x, int y, char c) +{ + int i, j; + int ofs=c*OSD_FONT_HEIGHT; + unsigned char bits[9]={256, 128, 64, 32, 16, 8, 4, 2, 1}; + u8 *dst=screen; + dst+=(y*256)+x; + + for (i = 0; i < OSD_FONT_HEIGHT; i++) + { + for (j = 0; j < OSD_FONT_WIDTH; j++) + if (font_eng[ofs] & bits[j]) dst[j]=1; + else dst[j]=0; + dst+=256; + ofs++; + } +} + +void OSDCLASS::update() // don't optimized +{ + u8 *dst=GPU_screen; + if (mode!=255) + dst+=offset*512; + + for (int i=0; i<256*192; i++) + { + if (screen[i]) + { + T2WriteWord(dst,(i << 1),0x8F); + } + } +} + +void OSDCLASS::addLines(const char *fmt, ...) +{ + +} + +void OSDCLASS::addFixed(int x, int y, const char *fmt, ...) +{ va_list list; char msg[512]; - DWORD tmp; + //DWORD tmp; memset(msg,0,512); va_start(list,fmt); +#ifdef _MSC_VER _vsnprintf(msg,511,fmt,list); - va_end(list); - - int len=strlen(msg); - for (int i=0; i - - @@ -94,6 +92,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]> + + diff --git a/desmume/src/cocoa/DeSmuME.xcodeproj/project.pbxproj b/desmume/src/cocoa/DeSmuME.xcodeproj/project.pbxproj index 940c82b91..b3f41dbc2 100644 --- a/desmume/src/cocoa/DeSmuME.xcodeproj/project.pbxproj +++ b/desmume/src/cocoa/DeSmuME.xcodeproj/project.pbxproj @@ -39,6 +39,7 @@ 7277B6E50D9E045700D283BD /* Japanese.nib in Resources */ = {isa = PBXBuildFile; fileRef = 7277B6E10D9E045700D283BD /* Japanese.nib */; }; 7277B6E60D9E045700D283BD /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7277B6E20D9E045700D283BD /* Japanese.strings */; }; 7277B8EB0D9F25F700D283BD /* about.m in Sources */ = {isa = PBXBuildFile; fileRef = 7277B8EA0D9F25F700D283BD /* about.m */; }; + 728E5E210E7F54CC00608344 /* GPU_osd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 728E5E1F0E7F54CC00608344 /* GPU_osd.cpp */; }; 729BEC6F0D9D55DB00ED561B /* cocoa_util.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC5A0D9D55DB00ED561B /* cocoa_util.m */; }; 729BEC710D9D55DB00ED561B /* input.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC5E0D9D55DB00ED561B /* input.m */; }; 729BEC730D9D55DB00ED561B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC600D9D55DB00ED561B /* main.m */; }; @@ -94,6 +95,8 @@ 7277B6E10D9E045700D283BD /* Japanese.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = Japanese.nib; sourceTree = ""; }; 7277B6E20D9E045700D283BD /* Japanese.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; path = Japanese.strings; sourceTree = ""; }; 7277B8EA0D9F25F700D283BD /* about.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = about.m; sourceTree = ""; }; + 728E5E1F0E7F54CC00608344 /* GPU_osd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GPU_osd.cpp; path = ../GPU_osd.cpp; sourceTree = SOURCE_ROOT; }; + 728E5E200E7F54CC00608344 /* GPU_osd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPU_osd.h; path = ../GPU_osd.h; sourceTree = SOURCE_ROOT; }; 729BEC5A0D9D55DB00ED561B /* cocoa_util.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cocoa_util.m; sourceTree = SOURCE_ROOT; }; 729BEC5C0D9D55DB00ED561B /* globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = globals.h; sourceTree = SOURCE_ROOT; }; 729BEC5D0D9D55DB00ED561B /* input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = input.h; sourceTree = SOURCE_ROOT; }; @@ -177,9 +180,6 @@ 729BEC620D9D55DB00ED561B /* main_window.m */, 729BEC630D9D55DB00ED561B /* nds_control.h */, 729BEC640D9D55DB00ED561B /* nds_control.mm */, - 7248E45E0E7E0B0E004DCFFE /* gfx3d.cpp */, - 7248E45F0E7E0B0E004DCFFE /* gfx3d.h */, - 7248E4600E7E0B0E004DCFFE /* OGLRender.cpp */, 729BEC650D9D55DB00ED561B /* preferences.h */, 729BEC660D9D55DB00ED561B /* preferences.m */, 729BEC670D9D55DB00ED561B /* rom_info.h */, @@ -236,6 +236,11 @@ 29B97315FDCFA39411CA2CEA /* Core */ = { isa = PBXGroup; children = ( + 728E5E200E7F54CC00608344 /* GPU_osd.h */, + 7248E45E0E7E0B0E004DCFFE /* gfx3d.cpp */, + 7248E45F0E7E0B0E004DCFFE /* gfx3d.h */, + 7248E4600E7E0B0E004DCFFE /* OGLRender.cpp */, + 728E5E1F0E7F54CC00608344 /* GPU_osd.cpp */, 7248E4610E7E0B0E004DCFFE /* OGLRender.h */, 7227644A0E78E18100AEDC8B /* arm_instructions.cpp */, 7227644B0E78E18100AEDC8B /* armcpu.cpp */, @@ -445,6 +450,7 @@ 722764780E78E18100AEDC8B /* wifi.cpp in Sources */, 7248E4620E7E0B0E004DCFFE /* gfx3d.cpp in Sources */, 7248E4630E7E0B0E004DCFFE /* OGLRender.cpp in Sources */, + 728E5E210E7F54CC00608344 /* GPU_osd.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/desmume/src/cocoa/dialogs/speed_limit_selection_window.h b/desmume/src/cocoa/dialogs/speed_limit_selection_window.h index 70ba6736c..b41415551 100644 --- a/desmume/src/cocoa/dialogs/speed_limit_selection_window.h +++ b/desmume/src/cocoa/dialogs/speed_limit_selection_window.h @@ -18,7 +18,7 @@ */ #import -#import "nds_control.h" +#import "../nds_control.h" @interface SpeedLimitSelectionWindow : NSWindow { diff --git a/desmume/src/cocoa/main_window.m b/desmume/src/cocoa/main_window.m index b5d313edd..c52c0bf18 100644 --- a/desmume/src/cocoa/main_window.m +++ b/desmume/src/cocoa/main_window.m @@ -27,7 +27,7 @@ #import "input.h" #import "rom_info.h" #import "preferences.h" -#import "speed_limit_selection_window.h" +#import "dialogs/speed_limit_selection_window.h" //How much padding to put around the video output #define WINDOW_BORDER_PADDING 5 diff --git a/desmume/src/cocoa/nds_control.mm b/desmume/src/cocoa/nds_control.mm index 1076ea821..0252afb66 100644 --- a/desmume/src/cocoa/nds_control.mm +++ b/desmume/src/cocoa/nds_control.mm @@ -65,7 +65,6 @@ struct NDS_fw_config_data firmware; bool opengl_init() { - NSLog(@"OPENGL INIT"); return true; } diff --git a/desmume/src/types.h b/desmume/src/types.h index 2eb31ffd9..0ae3bbdd3 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -58,7 +58,7 @@ #ifdef DESMUME_OBJ_C #define __declspec(ignore) -#define printlog(ignore) +inline void printlog(char *s, ...) {} #ifdef __BIG_ENDIAN__ #define WORDS_BIGENDIAN #endif