Dr_oldschool's VGA patch for nkpatcher.
Code:
diff -r -u nkpatcher10/readme.txt nkpatcher10-vga6/readme.txt
--- nkpatcher10/readme.txt 2004-12-23 00:00:00.000000000 +0200
+++ nkpatcher10-vga6/readme.txt 2005-09-01 00:19:01.000000000 +0300
@@ -1,4 +1,4 @@
-Nkpatcher version 10
+Nkpatcher version 10-vga6
--------------------
Installation
@@ -59,6 +59,24 @@
Changes
-------
+From version 10 to version 10-vga6:
+ * Added force RGB video feature. This will patch kernel system call
+ AvSetDisplayMode to configure GPU for RGsB signal if HDTV AV pack
+ is detected. Intended for connecting the Xbox to VGA monitor.
+ Connect AV pack Y output to monitor green input, Cr to monitor red
+ input and Cb to monitor blue input. The monitor must support sync
+ on green. If your monitor does not support sync on green, special
+ sync separator circuit is required.
+
+ * Added feature to convert 480i video modes to 480p. This will patch
+ kernel system call AvSetDisplayMode to convert 480i video modes to
+ 480p if HDTV AV pack is detected. Enhances graphics quality for
+ applications that run in 480i video mode only. Note that when using
+ HDTV AV pack, progressive scan video output will be forced even if
+ 480p video support is disabled in msdash.
+
+ Author: Krists Krilovs <[email hidden]>
+
From version 9 to version 10:
* Added virtual EEPROM feature. This will patch kernel system calls
HalReadSMBusValue and HalWriteSMBusValue such that EEPROM reads and writes
diff -r -u nkpatcher10/src/config.inc nkpatcher10-vga6/src/config.inc
--- nkpatcher10/src/config.inc 2004-12-23 00:00:00.000000000 +0200
+++ nkpatcher10-vga6/src/config.inc 2005-09-01 00:19:02.000000000 +0300
@@ -194,6 +194,25 @@
; %define NORMAL_BOOT_ALWAYS
+;;; VIDEO patches:
+;;;
+;;; VIDEO_FORCE_RGB = Patches kernel to output RGsB video signal (RGB with
+;;; sync on green) if HDTV AV pack is detected. Intended for
+;;; connecting the Xbox to VGA monitor. Connect AV pack Y output
+;;; to monitor green input, Cr to monitor red input and Cb to
+;;; monitor blue input. The monitor must support sync on green.
+;;;
+;;; VIDEO_FORCE_PROGRESSIVE = Patches kernel to convert 480i video modes to
+;;; 480p if HDTV AV pack is detected. Note that when using HDTV AV
+;;; pack, progressive scan video output will be forced even if 480p
+;;; video support is disabled in msdash.
+;;;
+;;; Not enabled by default.
+
+; %define VIDEO_FORCE_RGB
+; %define VIDEO_FORCE_PROGRESSIVE
+
+
;;; Patches inside INIT section (boot unlocked HDs etc.)
;;;
;;; INIT_SEC_PATCHES = enable
diff -r -u nkpatcher10/src/nkpatcher.asm nkpatcher10-vga6/src/nkpatcher.asm
--- nkpatcher10/src/nkpatcher.asm 2004-12-23 00:00:00.000000000 +0200
+++ nkpatcher10-vga6/src/nkpatcher.asm 2005-09-01 00:09:02.000000000 +0300
@@ -1066,6 +1066,157 @@
;;; --------------------------------------------------------------------------
+;;; VIDEO patching
+;;;
+;;; Author: Krists Krilovs <[email hidden]>
+;;; --------------------------------------------------------------------------
+
+%macro videorgb 1
+%ifdef VIDEO_FORCE_RGB
+ mov eax,%1
+ call installvideorgb
+%endif
+%endmacro
+
+
+%ifdef VIDEO_FORCE_RGB
+
+%define VIDEO_FORCE_RGB_SIZE (patchvideorgb.end-patchvideorgb)
+
+
+ CODE_SECTION
+
+installvideorgb:
+ mov edi,[mvis_space]
+ mov edx,[memdiff]
+ mov ebx,[kexports]
+
+ mov ebx,[ebx+edx+KERNEL_EXPORTS.HalBootSMCVideoMode]
+ cmp byte [ebx+edx+80010000h],01h
+ jnz .done ; not using hdtv cable
+
+ mov byte [eax+edx],0E9h
+ push edi
+ setcalljmptarget edi, eax, edx
+ pop edi
+
+ mov esi,patchvideorgb
+ mov ecx,VIDEO_FORCE_RGB_SIZE
+ add edi,edx
+ rep movsb
+ sub edi,edx
+
+ mov [mvis_space],edi
+.done: ret
+
+
+
+ DATA_SECTION
+
+patchvideorgb:
+ xor eax,eax
+ mov [esi+680630h],eax ; change to rgb
+ mov [esi+6808C4h],eax
+ mov [esi+68084Ch],eax
+ pop esi
+ pop ebx
+ leave
+ retn 18h
+.end:
+
+
+%else ; !VIDEO_FORCE_RGB
+
+%define VIDEO_FORCE_RGB_SIZE 0
+
+%endif ; !VIDEO_FORCE_RGB
+
+
+
+%macro videoprogr 0
+%ifdef VIDEO_FORCE_PROGRESSIVE
+ call installvideoprogr
+%endif
+%endmacro
+
+
+%ifdef VIDEO_FORCE_PROGRESSIVE
+
+%define VIDEO_FORCE_PROGRESSIVE_SIZE (patchvideoprogr.end-patchvideoprogr)
+
+
+ CODE_SECTION
+
+installvideoprogr:
+ mov edi,[mvis_space]
+ mov edx,[memdiff]
+ mov ebx,[kexports]
+
+ mov eax,[ebx+edx+KERNEL_EXPORTS.HalBootSMCVideoMode]
+ cmp byte [eax+edx+80010000h],01h
+ jnz .done ; not using hdtv cable
+
+ mov eax,[ebx+edx+KERNEL_EXPORTS.AvSetDisplayMode]
+ add eax,80010000h
+
+ mov byte [eax+edx],0E9h
+ push edi
+ setcalljmptarget edi, eax, edx
+ pop edi
+
+ add eax,5
+ mov cl,[eax+edx] ; frame size
+ mov [patchvideoprogr.frame+2],cl
+ mov byte [eax+edx],90h ; nop
+ setcalljmptarget eax, patchvideoprogr, patchvideoprogr.var_jback, edi
+
+ mov esi,patchvideoprogr
+ mov ecx,VIDEO_FORCE_PROGRESSIVE_SIZE
+ add edi,edx
+ rep movsb
+ sub edi,edx
+
+ mov [mvis_space],edi
+.done: ret
+
+
+
+ DATA_SECTION
+
+patchvideoprogr:
+ push ebp
+ mov ebp,esp
+ push eax
+ mov eax,[ebp+16]
+ or eax,eax
+ js .cont ; hdtv mode
+ jz .640 ; default mode (?)
+ test ah,01h
+ mov eax,88080801h ; 720x480p
+ jz .chng
+.640: mov eax,88070701h ; 640x480p
+.chng: mov [ebp+16],eax
+.cont: pop eax
+.frame: sub esp,1Ch
+ VJMP jback
+.end:
+
+
+%else ; !VIDEO_FORCE_PROGRESSIVE
+
+%define VIDEO_FORCE_PROGRESSIVE_SIZE 0
+
+%endif ; !VIDEO_FORCE_PROGRESSIVE
+
+
+;;; --------------------------------------------------------------------------
+;;; VIDEO end
+;;; --------------------------------------------------------------------------
+
+
+
+
+;;; --------------------------------------------------------------------------
;;; EvoX M7 leftover patches
;;; --------------------------------------------------------------------------
@@ -1240,7 +1391,7 @@
%define USEDSPACE_SIGN_5713 USEDSPACE_SIGN_USUAL
%define USEDSPACE_SIGN_5838 USEDSPACE_SIGN_5713
-%define USEDSPACE_MVIS_USUAL (XBL_BLOCK_SIZE)
+%define USEDSPACE_MVIS_USUAL (XBL_BLOCK_SIZE + VIDEO_FORCE_RGB_SIZE + VIDEO_FORCE_PROGRESSIVE_SIZE)
%define USEDSPACE_MVIS_3944 USEDSPACE_MVIS_USUAL
%define USEDSPACE_MVIS_4034 USEDSPACE_MVIS_USUAL
%define USEDSPACE_MVIS_4817 USEDSPACE_MVIS_USUAL
@@ -1518,6 +1669,8 @@
lba48 80025985h,80025A5Bh,800259D1h,8003BFF8h, \
80025605h,8002564Eh,8002547Bh,800254AFh,80025837h,80025892h
virteeprom 8003BC00h,80016B91h
+ videorgb 8003118Ah
+ videoprogr
patcherfinish
@@ -1536,6 +1689,8 @@
lba48 800259A5h,80025A7Bh,800259F1h,8003C0B8h, \
80025625h,8002566Eh,8002549Bh,800254CFh,80025857h,800258B2h
virteeprom 8003BCC0h,80016B82h
+ videorgb 800317A1h
+ videoprogr
patcherfinish
@@ -1554,6 +1709,8 @@
lba48 800246D5h,800247ABh,80024721h,8003B338h, \
80024355h,8002439Eh,800241CBh,800241FFh,80024587h,800245E2h
virteeprom 8003AF40h,80015842h
+ videorgb 80030996h
+ videoprogr
patcherfinish
@@ -1572,6 +1729,8 @@
lba48 800246E5h,800247BBh,80024731h,8003B438h, \
80024365h,800243AEh,800241DBh,8002420Fh,80024597h,800245F2h
virteeprom 8003B040h,80015852h
+ videorgb 80030A95h
+ videoprogr
patcherfinish
@@ -1590,6 +1749,8 @@
lba48 800248B1h,80024987h,800248FDh,8003C2D0h, \
80024534h,8002457Dh,800243AAh,800243DEh,80024766h,800247C1h
virteeprom 8003BEC0h,800159D2h
+ videorgb 800315B2h
+ videoprogr
patcherfinish
@@ -1610,4 +1771,6 @@
lba48 800248B1h,80024987h,800248FDh,8003C2F0h, \
80024534h,8002457Dh,800243AAh,800243DEh,80024766h,800247C1h
virteeprom 8003BEE0h,800159D2h
+ videorgb 800315CCh
+ videoprogr
patcherfinish