Jump to content


Photo

Patch For Openxdk


  • Please log in to reply
3 replies to this topic

#1 zagon

zagon

    X-S Enthusiast

  • Members
  • 6 posts

Posted 08 September 2007 - 06:14 PM

Hi people,

I've been toying a bit with openxdk (from cvs) and found and corrected some minor issues in this very impressive piece of software.

Comments and feedback are welcome. I think that the modes and constants are correct but I can't guarantee anything since I have no way of testing all AV Packs and TV-system combinations.

Perhaps this is not the correct forum for posting patches but I've found no official contact information for openxdk.

Issue: It won't compile using mingw32
CODE

diff -r 573e6246b067 configure.in
--- a/configure.in    Sun Sep 02 18:21:14 2007 +0200
+++ b/configure.in    Sat Sep 08 19:19:24 2007 +0200
@@ -14,7 +14,7 @@ fi
fi

case $build in
-  *-*-cygwin*)
+  *-*-cygwin* | *-*-mingw32*)
     #
     # As we are not cross compiling we keep the AC_PROG_PATH that is currently defined for all utils
     #
diff -r 573e6246b067 src/libpng-1.2.7/Makefile.xbox
--- a/src/libpng-1.2.7/Makefile.xbox    Sun Sep 02 18:21:14 2007 +0200
+++ b/src/libpng-1.2.7/Makefile.xbox    Sat Sep 08 19:19:24 2007 +0200
@@ -25,7 +25,7 @@ TARGET = libpng.a
TARGET = libpng.a



OPTFLAGS=-O2 -fomit-frame-pointer -std=gnu99 -ffreestanding -nostdlib -fno-builtin -fno-exceptions -mno-cygwin -march=i386

-CFLAGS=-DPNG_SETJMP_NOT_SUPPORTED -DENABLE_XBOX -I. -I$(PREFIX)/i386-pc-xbox/include -I$(PREFIX)/include $(OPTFLAGS) -I../../zlib/zlib-1.2.1/

+CFLAGS=-DPNG_SETJMP_NOT_SUPPORTED -DENABLE_XBOX -I. -I$(PREFIX)/i386-pc-xbox/include -I$(PREFIX)/include $(OPTFLAGS) -I../../zlib/zlib-1.2.1



SRCS = $(ALL)





Issue: There are no video modes at all for the Advanced AV Pack. I've redefined some adapter constants to make them match the different AV Packs. I've also added some settings constants.
CODE

diff -r 573e6246b067 include/hal/video.h
--- a/include/hal/video.h    Sun Sep 02 18:21:14 2007 +0200
+++ b/include/hal/video.h    Sat Sep 08 19:19:24 2007 +0200
@@ -33,17 +33,25 @@
#define VIDEO_REGION_NTSCJ            0x00000200
#define VIDEO_REGION_PAL            0x00000300

+// Defines for video settings
+#define VIDEO_SETTINGS_WIDE        0x00010000
+#define VIDEO_SETTINGS_720P        0x00020000
+#define VIDEO_SETTINGS_1080I        0x00040000
+#define VIDEO_SETTINGS_480P        0x00080000
+#define VIDEO_SETTINGS_60HZ        0x00400000 // All NTSC and PAL60
+#define VIDEO_SETTINGS_50HZ        0x00800000 // All PAL
+
// Defines for pixel formats
#define VIDEO_BPP_16                0x00000011
#define VIDEO_BPP_32                0x00000012

// Defines for video adapter packs
-#define VIDEO_ADAPTER_COMPOSITE            0x00000000
-#define VIDEO_ADAPTER_RCA            0x00000001
-#define VIDEO_ADAPTER_SVIDEO            0x00000002
-#define VIDEO_ADAPTER_RGBSCART        0x00000003
-#define VIDEO_ADAPTER_HDTV                 0x00000004
-#define VIDEO_ADAPTER_VGA_SOG                 0x00000005
+#define VIDEO_ADAPTER_COMPOSITE        0x00000001 //Standard AV Pack
+#define VIDEO_ADAPTER_RCA        0x00000002 //RF Adapter
+#define VIDEO_ADAPTER_RGBSCART        0x00000003 //Advanced SCART AV Pack
+#define VIDEO_ADAPTER_HDTV            0x00000004 //High Definition AV Pack
+#define VIDEO_ADAPTER_VGA_SOG             0x00000005
+#define VIDEO_ADAPTER_SVIDEO        0x00000006 //Advanced AV Pack

// Defines for video encoder options
#define VIDEO_ENC_GET_SETTINGS        6


There are no 480i video modes for the High Definition AV Pack. In order to still list only one mode per resolution the code now also checks the MS-dashboard hdtv-settings. I also reimplemented XVideoSetMode to use XVideoListModes in order to avoid code duplication.
CODE

diff -r 573e6246b067 src/hal/video.c
--- a/src/hal/video.c    Sun Sep 02 18:21:14 2007 +0200
+++ b/src/hal/video.c    Sat Sep 08 19:19:24 2007 +0200
@@ -66,10 +66,18 @@ VIDEO_MODE_SETTING vidModes[] =
  {0x20010103,640,480,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_RGBSCART}, //640x480 NTSCJ 60Hz RGB
  {0x20020204,720,480,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_RGBSCART}, //720x480 NTSCJ 60Hz RGB

+ {0x48030314,640,480,50,VIDEO_REGION_PAL,VIDEO_ADAPTER_HDTV}, //640x480i PAL 50Hz
+ {0x48040415,720,480,50,VIDEO_REGION_PAL,VIDEO_ADAPTER_HDTV}, //720x480i PAL 50Hz
+ {0x08010119,640,480,60,VIDEO_REGION_PAL,VIDEO_ADAPTER_HDTV}, //640x480i PAL 60Hz
+ {0x0802021a,720,480,60,VIDEO_REGION_PAL,VIDEO_ADAPTER_HDTV}, //720x480i PAL 60Hz
+ {0x0801010d,640,480,60,VIDEO_REGION_NTSCM,VIDEO_ADAPTER_HDTV}, //640x480i NTSCM 60Hz
+ {0x0802020e,720,480,60,VIDEO_REGION_NTSCM,VIDEO_ADAPTER_HDTV}, //720x480i NTSCM 60Hz
  {0x88070701,640,480,60,VIDEO_REGION_NTSCM,VIDEO_ADAPTER_HDTV}, //640x480p NTSCM 60Hz
  {0x88080801,720,480,60,VIDEO_REGION_NTSCM,VIDEO_ADAPTER_HDTV}, //720x480p NTSCM 60Hz
  {0x880B0A02,1280,720,60,VIDEO_REGION_NTSCM,VIDEO_ADAPTER_HDTV}, //1280x720p NTSCM 60Hz
  {0x880E0C03,1920,1080,60,VIDEO_REGION_NTSCM,VIDEO_ADAPTER_HDTV}, //1920x1080i NTSCM 60Hz
+ {0x0801010d,640,480,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_HDTV}, //640x480i NTSCJ 60Hz
+ {0x0802020e,720,480,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_HDTV}, //720x480i NTSCJ 60Hz
  {0x88070701,640,480,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_HDTV}, //640x480p NTSCJ 60Hz
  {0x88080801,720,480,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_HDTV}, //720x480p NTSCJ 60Hz
  {0x880B0A02,1280,720,60,VIDEO_REGION_NTSCJ,VIDEO_ADAPTER_HDTV}, //1280x720p NTSCJ 60Hz
@@ -179,7 +187,7 @@ BOOLEAN XVideoListModes(VIDEO_MODE *vm,
    }
    if (refresh == 0)
    {
-        if(dwEnc & 0x00400000)
+        if(dwEnc & VIDEO_SETTINGS_60HZ)
        {
            refresh = 60;
        } else
@@ -200,6 +208,21 @@ BOOLEAN XVideoListModes(VIDEO_MODE *vm,
        if(pVidMode->refresh != refresh)
            continue;

+        if(dwAdapter == VIDEO_ADAPTER_HDTV)
+        {
+            if(!(pVidMode->dwMode & 0x80000000) ^
+                       !(dwEnc & VIDEO_SETTINGS_480P) &&
+                       pVidMode->height == 480)
+            continue;
+
+            if(!(dwEnc & VIDEO_SETTINGS_720P) &&
+                       pVidMode->height == 720)
+            continue;
+
+            if(!(dwEnc & VIDEO_SETTINGS_1080I) &&
+                       pVidMode->height == 1080)
+            continue;
+        }
        break;
    }
    
@@ -255,67 +278,25 @@ void XVideoInit(DWORD dwMode, int width,

BOOL XVideoSetMode(int width, int height, int bpp, int refresh)
{
-    VIDEO_MODE_SETTING *pVidMode = NULL;
-    int vidRefresh = 0;
-    int i = 0;
-
-    DWORD dwEnc = XVideoGetEncoderSettings();
-    
-    DWORD dwAdapter        = dwEnc & 0x000000FF;
-    DWORD dwStandard    = dwEnc & 0x0000FF00;
-
-    if(bpp != 16 && bpp != 32)
-        bpp = 32;
-
-    if(refresh > 0)
-        vidRefresh = refresh;
-    else
-    {
-        if(dwEnc & 0x00400000) //60Hz refresh rate
-            vidRefresh = 60;
-        else
-            vidRefresh = 50;
-    }
-
-    for(i=0; i<iVidModes; i++)
-    {
-        pVidMode = &vidModes[i];
-
-        if((pVidMode->dwFlags & 0x000000FF) != dwAdapter)
-            continue;
-
-        if(pVidMode->dwStandard != dwStandard)
-            continue;
-
-        if(pVidMode->width != width || pVidMode->height != height)
-            continue;
-
-        if(pVidMode->refresh != vidRefresh)
-            continue;
-
-        break;
-    }
-
-    if(i >= iVidModes) // No compatible mode found
-    {
-        memset(&vmCurrent, 0x00, sizeof(VIDEO_MODE));
-        return FALSE;
-    }
-
-    XVideoInit(pVidMode->dwMode, pVidMode->width, pVidMode->height, bpp);
-
-//Will be registered at first XVideoWaitForVBlank() call anyway. No need to lock IRQ3 here.
-//    if (! IsrRegistered) {
-//        if (InstallVBLInterrupt())
-//            IsrRegistered = TRUE;
-//    }
-
-    vmCurrent.width = pVidMode->width;
-    vmCurrent.height = pVidMode->height;
-    vmCurrent.bpp = bpp;
-    vmCurrent.refresh = vidRefresh;
-
-    return TRUE;
+    VIDEO_MODE vm;
+    void *p = NULL;
+
+    while(XVideoListModes(&vm, bpp, refresh, &p))
+    {
+        if(vm.width == width && vm.height == height)
+        {
+            DWORD dwMode = vidModes[(int)p-1].dwMode;
+            XVideoInit(dwMode, vm.width, vm.height, vm.bpp);
+
+            vmCurrent.width = vm.width;
+            vmCurrent.height = vm.height;
+            vmCurrent.bpp = vm.bpp;
+            vmCurrent.refresh = vm.refresh;
+            return TRUE;
+        }
+    }
+    memset(&vmCurrent, 0x00, sizeof(VIDEO_MODE));
+    return FALSE;
}





#2 Sirmatto

Sirmatto

    X-S X-perience

  • Members
  • PipPip
  • 413 posts
  • Location:Puyallup, WA
  • Xbox Version:v1.0
  • 360 version:v3.0 (falcon)

Posted 08 September 2007 - 08:24 PM

I think what needs to be done with OpenXDK is to create a new Sourceforge project, maybe called OpenXDK-ng or something lame like that, import the current CVS of the OpenXDK and merge in all these lovely patches that people, including you and openxdkman, have submitted. With some active admins, who could grant CVS/SVN access, maybe we could get some real advancements going on OpenXDK.

#3 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 09 September 2007 - 06:40 AM

You posted at the right place. I did like you and my patches finally got merged.
Keep posting your patches. People in charge are busy, so need to be patient, that's all.

#4 zagon

zagon

    X-S Enthusiast

  • Members
  • 6 posts

Posted 09 September 2007 - 05:21 PM

Ok, thats good to know.
Just to clarify, I don't build OpenXDK with plain mingw32. I use msys and msys-DTK too.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users