gsKit_init_global_custom doesn't use a mode parameter anymore, instead defining a default one using gsKit_detect_signal. To use a custom mode, you should read the part about gsKit_init_screen. There's also a gsKit_deinit_global now to free up the memory used by the gsGlobal. I ran init/deinit through a loop 100,000 times to make sure it worked.
For, gsKit_init_screen, it now can reset the GS so that modes can be switched. The magnification for modes is now done automatically based on the dimensions of the draw buffer and the mode selected. Now you can define a small buffer like 640x540 which will stretch out to 1920x1080i, if the mode is 1080i, in field interlaced mode, enabling you to use a small enough draw buffer to use double buffering, zbuffering, etc. as well as free up some vram. The draw buffer's width and height dimensions need to be a factor of the mode's width and height least common multiples (DW and DH). E.g. NTSCs least common multiple for width is 2560, so 256,320,384,512,640 can all be supported while for height it's 448, so 224/448 will work. In order to use a custom mode, the gsGlobal's Width/Height/Mode/Field/Interlacing items need to be defined to custom values prior to calling gsKit_init_screen.
For the primitives, I removed the auto handling of height halving and the framed interlacing scanline fix. That's better suited for the app to handle via a macro and vsync interrupt handler or something than for gsKit to do natively.
I also added some functions for adding/removing a vsync interrupt handler. I created some functions to separate context switching and display buffer switching as well. I added a LockBuffer parameter to the gsGlobal structure to be used to lock the display buffer while it's displayed in single buffer mode to prevent the GS from switching buffers before it's ready. I made an example called vsync to show off some of the stuff that's been added.
I didn't post this under the patch submissions forum because some of the modifications break compatibility with things that have been ported with gsKit. I added svn repository information for all the new files and directories so using svn diff will show all the changes. Looking at the Makefile.global, I could tell that it was never intended to be included in an external project's makefile structure, so I added a warning to the Makefile. It's much simpler to just add the paths to gsKit's include and lib directory to EE_INCS and EE_LDFLAGS, respectively.
Here's the changelog:
Code: Select all
-> 12/29/08 - ragnarok2040
* Fixed a bug in the vsync example. The display buffer doesn't need
to check if it's locked to display.
* Moved some FontM code to their respective gsFontM files.
* Reset the FirstFrame attribute when resetting the GS.
* Clear the screen as part of initializing to remove
FirstFrame quirkyness. As a result, the vsync example
started working with ps2link.
* Removed gsKit_hsync_nowait since there doesn't seem to be a way
to catch a hsync interrupt.
-> 12/28/08 - ragnarok2040
* Added LockBuffer to gsGlobal
* Added gsKit_lock_buffer to lock the current working buffer
* Added gsKit_unlock_buffer to unlock the current working buffer
* Added gsKit_lock_status which returns GS_SETTING_ON if the
working buffer is locked. All this allows you to lock the buffer
as it's being displayed and block until there's an active buffer
to use.
* Added vsync example based on basic example to show the usage
of a vsync interrupt handler with display buffer locking
-> 12/27/08 - ragnarok2040
* Added gsKit_add_vsync_handler to add a vsync handler
* Added gsKit_remove_vsync_handler to remove a vsync handler
* Added gsKit_switch_dispfb() to switch buffers for display
* Added gsKit_switch_context() to switch the working buffers
-> 12/25/08 - ragnarok2040
* Merry Christmas
* Removed gslib tga2fnt font support since the support was broken
except for certain converted types
* Fixed png/bmp with .dat variable font widths rendering
* Fonts need to be left-aligned when created
* Added ability to scale png/bmp with .dat with variable font widths
* Converted font example to use bmp/png .dat variable width fonts
-> 12/24/08 - ragnarok2040
* Changed build structure to use separate Makefile.global files
depending on what's being built
* Finished work on the font code
* Started work on building the examples
* Discovered bitmap.raw is bad in textures example
* Discovered testorig.jpg is bad in linuz-texture example
* Fixed a bug in gsKit_texture_bmp() as fread() returns the
number of elements read, not the number of bytes
-> 12/23/08 - ragnarok2040
* Changed gsFont.c and gsFont.h to gsFontM.c and gsFontM.h
* Finished migration of non-FontM code
* Started separation of non-FontM code from FontM code in gskit
* Started separation of FontM code from non-FontM code in gskit_toolkit
-> 12/22/08 - ragnarok2040
* Continued separation of FontM and non-FontM codes
* Finished changing fio* file routines to stdio file routines
* Started work on fixing .fnt support for tga2fnt fonts
from gslib
-> 12/21/08 - ragnarok2040
* Modified gsKit_init_font to allocate memory for the ".dat" path
* Modified gsKit_font_upload to properly load a ".dat" file
* Changed gsFont->Additional to a s16 type since a ".dat" file is 256 short ints
* More separation of FontM and non-FontM code
-> 12/20/08 - ragnarok2040
* Added the ability to clear the vram by resetting the
vram pointer back to the beginning of useable texture
buffer space.
* Continued migration of image lib texture functions
to gsKit_toolkit.
* Added a fix to Z Buffering support for mismatched depths.
* Started modifying non-fontm loading routines to use stdio file functions
-> 12/19/08 - ragnarok2040
* Fixed draw buffer code to allow for smaller draw buffers
for the mode selected. This is useful as it allows you to
use a 640x540 draw buffer that can be used for 1080i or
640x720 or 640x360 draw buffer for 720p, etc.
* Added dithering support for 16-bit modes.
* Added the ability to set the dithering matrix.
* Started migration of integrated image lib texture
support into an external library called gsKit_toolkit.
* Started separation of fontm and non-fontm code for the migration.
-> 12/18/08 - ragnarok2040
* Added gsKit_deinit_global() which frees all the memory
gsGlobal allocates
* Modified gsKit_init_global() to enable DoubleBuffering and
ZBuffering as default - might not work with large resolutions
* Fixed a bug with 1920x1080i using GS_FRAME mode
-> 12/17/08 - ragnarok2040
* Changed gsKit_vsync() to gsKit_vsync_wait()
* Added gsKit_hsync_wait()
* Added gsKit_vsync_nowait()
* Added gsKit_hsync_nowait()
* Added ability to set which fields to render with gsKit_set_drawfield()
based on libgraph's code
* Added gsKit_get_field() which sets gsGlobal->EvenOrOdd from the CSR->Field
register: 0 is for Even and 1 is for Odd
* Removed all the half buffer offset (HBOFFSET) fixes which users should do
using their own vsync interrupt handler
* Removed all the FRAME height adjustments which users should do depending
on the interlace mode they choose
* Added the ability to set low-resolution modes
* Modified the gsKit_init_global_custom() to remove mode parameter
* gsGlobal->Width, gsGlobal->Height, gsGlobal->Mode, gsGlobal->Interlace, and
gsGlobal->Field should all be set prior to calling gsKit_init_screen()
* Modified gsKit_init_screen() to reset the GS any time it is called
* Defined a gsKit_reset_screen() symbol for resetting the screen
* Added aspect ratio detection within gsKit_init_global()
* Modified gsKit_detect_signal() to use RomGetName() method
of detecting a PS2's region
You might need to go to http://homebrew.thewaffleiron.net/ragnarok2040 and click on it, if the anti-hotlinking script is still running.