Wei Mingzhi 10 年之前
父节点
当前提交
5bea0e92e0
共有 4 个文件被更改,包括 31 次插入11 次删除
  1. 2 10
      Pal.xcodeproj/project.pbxproj
  2. 12 0
      main.c
  3. 4 0
      sound.c
  4. 13 1
      video.c

+ 2 - 10
Pal.xcodeproj/project.pbxproj

@@ -114,7 +114,7 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		002F3A3E09D088BA00EBEB88 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = SOURCE_ROOT; };
+		002F3A3E09D088BA00EBEB88 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = SOURCE_ROOT; };
 		089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
 		29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
@@ -165,7 +165,7 @@
 		7104FD630D772F6300A97E53 /* uigame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uigame.h; sourceTree = "<group>"; };
 		7104FD640D772F6300A97E53 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = "<group>"; };
 		7104FD650D772F6300A97E53 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
-		7104FD660D772F6300A97E53 /* video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = video.c; sourceTree = "<group>"; };
+		7104FD660D772F6300A97E53 /* video.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.c; path = video.c; sourceTree = "<group>"; };
 		7104FD670D772F6300A97E53 /* video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video.h; sourceTree = "<group>"; };
 		7104FD680D772F6300A97E53 /* yj1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yj1.c; sourceTree = "<group>"; };
 		7104FD9A0D772FBC00A97E53 /* binfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = binfile.cpp; path = adplug/binfile.cpp; sourceTree = SOURCE_ROOT; };
@@ -245,13 +245,6 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		080E96DDFE201D6D7F000001 /* Classes */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			name = Classes;
-			sourceTree = "<group>";
-		};
 		1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
 			isa = PBXGroup;
 			children = (
@@ -283,7 +276,6 @@
 			children = (
 				71E23E7013F6D188001287B6 /* libmad */,
 				7104FD990D772FAA00A97E53 /* adplug */,
-				080E96DDFE201D6D7F000001 /* Classes */,
 				29B97315FDCFA39411CA2CEA /* Other Sources */,
 				29B97317FDCFA39411CA2CEA /* Resources */,
 				29B97323FDCFA39411CA2CEA /* Frameworks */,

+ 12 - 0
main.c

@@ -478,6 +478,18 @@ main(
    int           c;
    BOOL          fFullScreen = FALSE;
 
+#ifdef __APPLE__
+   char *p = strstr(argv[0], "/Pal.app/");
+
+   if (p != NULL)
+   {
+      char buf[4096];
+      strcpy(buf, argv[0]);
+      buf[p - argv[0]] = '\0';
+      chdir(buf);
+   }
+#endif
+
    UTIL_OpenLog();
 
 #ifdef _WIN32

+ 4 - 0
sound.c

@@ -207,6 +207,10 @@ SOUND_FillAudio(
 {
    int        i;
 
+#if SDL_VERSION_ATLEAST(2,0,0)
+   memset(stream, 0, len);
+#endif
+
    //
    // Play music
    //

+ 13 - 1
video.c

@@ -86,7 +86,7 @@ VIDEO_Init(
    //
    // Before we can render anything, we need a window and a renderer.
    //
-   gpWindow = SDL_CreateWindow("SDL_RenderCopy Example",
+   gpWindow = SDL_CreateWindow("Pal",
       SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400,
       SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
 
@@ -297,6 +297,10 @@ VIDEO_UpdateScreen(
 {
 #if SDL_VERSION_ATLEAST(2,0,0)
    // TODO
+   SDL_Texture *pTexture = SDL_CreateTextureFromSurface(gpRenderer, gpScreen);
+   SDL_RenderClear(gpRenderer);
+   SDL_RenderCopy(gpRenderer, pTexture, NULL/*srcrect*/, NULL/*dstrect*/);
+   SDL_RenderPresent(gpRenderer);
 #else
    SDL_Rect        srcrect, dstrect;
    short           offset = 240 - 200;
@@ -796,6 +800,9 @@ VIDEO_SwitchScreen(
 
 --*/
 {
+#if SDL_VERSION_ATLEAST(2,0,0)
+   // TODO
+#else
    int               i, j;
    const int         rgIndex[6] = {0, 3, 1, 5, 2, 4};
    SDL_Rect          dstrect;
@@ -833,6 +840,7 @@ VIDEO_SwitchScreen(
 
       UTIL_Delay(wSpeed);
    }
+#endif
 }
 
 VOID
@@ -855,6 +863,9 @@ VIDEO_FadeScreen(
 
 --*/
 {
+#if SDL_VERSION_ATLEAST(2,0,0)
+   // TODO
+#else
    int               i, j, k;
    DWORD             time;
    BYTE              a, b;
@@ -988,6 +999,7 @@ VIDEO_FadeScreen(
    // Draw the result buffer to the screen as the final step
    //
    VIDEO_UpdateScreen(NULL);
+#endif
 }
 
 #if SDL_VERSION_ATLEAST(2,0,0)