mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 21:14:21 +01:00
-rearrange libpng, add xml support
-update readme
This commit is contained in:
parent
aff0dc6d17
commit
d473270f30
@ -41,7 +41,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# any extra libraries we wish to link with the project
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBS := -lpng -lbba -ltinysmb -lfat -lz -logc -lm -lfreetype
|
LIBS := -lpng -lmxml -lbba -ltinysmb -lfat -lz -logc -lm -lfreetype
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
@ -19,9 +19,9 @@ include $(DEVKITPPC)/wii_rules
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := executables/snes9xgx-$(VERSION)-wii
|
TARGET := executables/snes9xgx-$(VERSION)-wii
|
||||||
BUILD := build_wii
|
BUILD := build_wii
|
||||||
SOURCES := source/snes9x source/ngc source/libpng source/libpng/pngu
|
SOURCES := source/snes9x source/ngc
|
||||||
DATA := data
|
DATA := data
|
||||||
INCLUDES := source source/snes9x source/ngc
|
INCLUDES := source/snes9x source/ngc
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
@ -41,7 +41,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# any extra libraries we wish to link with the project
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBS := -lpng -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype -ltinysmb
|
LIBS := -lpng -lmxml -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype -ltinysmb
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
78
README.txt
78
README.txt
@ -25,20 +25,21 @@ Tantric
|
|||||||
.CHT file name must match file name of ROM
|
.CHT file name must match file name of ROM
|
||||||
- added: load/save preference selector. ROM, SRAM, Freeze, and preferences
|
- added: load/save preference selector. ROM, SRAM, Freeze, and preferences
|
||||||
are saved/loaded according to these
|
are saved/loaded according to these
|
||||||
- added: preliminary Wii SMB support - completely working, but you must change
|
- added: preliminary network share loading/saving (SMB) support on Wii:
|
||||||
settings in s9xconfig.cpp
|
completely working, but for now you must change settings in
|
||||||
|
s9xconfig.cpp and compile from the source
|
||||||
- added: 'Auto' settings for save/load - attempts to automatically determine
|
- added: 'Auto' settings for save/load - attempts to automatically determine
|
||||||
your load/save device(s) - SD, USB, Memory Card, DVD, SMB
|
your load/save device(s) - SD, USB, Memory Card, DVD, SMB
|
||||||
- added: ROM Information page
|
- added: ROM Information page
|
||||||
- added: Game Menu - all game-specific options are here now:
|
- added: Game Menu - all game-specific options are here now:
|
||||||
SRAM save/load, Freeze save/load, game reload, etc
|
SRAM save/load, Snapshot save/load, game reload, etc
|
||||||
- added: Credits page
|
- added: Credits page
|
||||||
- fixed: sd gecko works now
|
- fixed: sd gecko works now
|
||||||
- fixed: full USB support
|
- fixed: full USB support
|
||||||
- changed: menu structure
|
- changed: menu structure
|
||||||
- changed: if Home button is pressed when a game is running, Game Menu pops up
|
- changed: if Home button is pressed when a game is running, Game Menu pops up
|
||||||
- changed: if preferences can't be loaded at the start and/or are reset,
|
- changed: if preferences can't be loaded at the start and/or are reset,
|
||||||
preferences menu pops up
|
preferences menu pops up - remove to save your preferences!
|
||||||
- changed: SRAM load - game reloaded automatically after loading SRAM
|
- changed: SRAM load - game reloaded automatically after loading SRAM
|
||||||
|
|
||||||
[What Was New 004]
|
[What Was New 004]
|
||||||
@ -64,7 +65,7 @@ Tantric
|
|||||||
- fixed: precompiled dols for autosaving to various locations (see readme)
|
- fixed: precompiled dols for autosaving to various locations (see readme)
|
||||||
- changed: GC default quickload slot (to sd) (thanks kerframil)
|
- changed: GC default quickload slot (to sd) (thanks kerframil)
|
||||||
- changed: default load/save dirs are now "/snes9x/roms" and
|
- changed: default load/save dirs are now "/snes9x/roms" and
|
||||||
"/snes/save/" (thanks kerframil)
|
"/snes9x/saves/" (thanks kerframil)
|
||||||
- changed: Classic X and Y defaults aren't switched
|
- changed: Classic X and Y defaults aren't switched
|
||||||
- changed: if autosave is enabled, it doesn't ask to save SRAM
|
- changed: if autosave is enabled, it doesn't ask to save SRAM
|
||||||
anymore. It is saved in the background.
|
anymore. It is saved in the background.
|
||||||
@ -95,9 +96,10 @@ Tantric
|
|||||||
|0O×øo· FEATURES ·oø×O0|
|
|0O×øo· FEATURES ·oø×O0|
|
||||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||||
- Based on Snes9x 1.5 - superior ROM compatibility
|
- Based on Snes9x 1.5 - superior ROM compatibility
|
||||||
- Auto Load/Save Freeze States and SRAM
|
- Auto Load/Save Game Snapshots and SRAM
|
||||||
- Custom controller configurations
|
- SNES Superscope, Mouse, Justifier support
|
||||||
- Wiimote, Nunchuk, Classic, and Gamecube controller support
|
- Wiimote, Nunchuk, Classic, and Gamecube controller support
|
||||||
|
- Custom controller configurations
|
||||||
- Autodetect PAL/NTSC
|
- Autodetect PAL/NTSC
|
||||||
- Zip Support
|
- Zip Support
|
||||||
- Open Source!
|
- Open Source!
|
||||||
@ -124,46 +126,52 @@ The last part of the filename (shown above as xxxx), denotes the wii and gamecub
|
|||||||
versions.
|
versions.
|
||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
ROMS, Preferences, and Saves:
|
Directory Structure Setup
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
By default, roms are loaded from "snes9x/roms/", saves and preferences are
|
||||||
|
stored in "snes9x/saves/", and cheats are loaded from "/snes9x/cheats/".
|
||||||
|
Therefore you should have the following folder structure at the root
|
||||||
|
of your load device (SD/USB/SMB):
|
||||||
|
|
||||||
|
snes9x/
|
||||||
|
roms/
|
||||||
|
saves/
|
||||||
|
cheats/
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
ROMS, Preferences, Saves, and Cheats:
|
||||||
----------------------------
|
----------------------------
|
||||||
Your SNES rom images must be in the Super Magicom (SMC) or FIG format. Generally,
|
Your SNES rom images must be in the Super Magicom (SMC) or FIG format. Generally,
|
||||||
all images you find will be in this format, but if you run across one that isn't
|
all images you find will be in this format, but if you run across one that isn't
|
||||||
please download RTOOL which will allow you to convert the image into SMC format.
|
please download RTOOL which will allow you to convert the image into SMC format.
|
||||||
|
|
||||||
|
|
||||||
Wii
|
Wii
|
||||||
----------
|
----------
|
||||||
On the Wii, you can load roms from any SD card (Front SD, SD Gecko, etc).
|
On the Wii, you can load roms from any SD card (Front SD, SD Gecko, etc). You
|
||||||
By default, ROMs are loaded from "snes9x/roms/" and saves and preferences are
|
can also load from USB. Note that if you are using the Homebrew Channel, you
|
||||||
stored in "snes9x/saves/". Therefore, on your SD card, you should have the following
|
will first have to load Snes9xGx from SD, and then load your roms from USB.
|
||||||
folders:
|
You can also load roms now from a Windows network share (SMB). However, you will
|
||||||
|
have to edit s9xconfig.cpp with your network settings and recompile the source.
|
||||||
snes9x/
|
|
||||||
roms/
|
|
||||||
saves/
|
|
||||||
|
|
||||||
|
|
||||||
Gamecube
|
Gamecube
|
||||||
------------
|
------------
|
||||||
You can load roms from DVD, SD card or SMB share. If you wish to use an SD card
|
You can load roms from DVD, SD card or SMB share. If you create a bootable
|
||||||
or SMB share, you must create the same folder tree as above. Put your roms in the
|
DVD of Snes9xGx you can put roms on the same DVD. You may save preferences and
|
||||||
"snes9x/roms" folder. On DVD you can either place your roms at the top level, or
|
game data to SD, Memory Card, or SMB.
|
||||||
optionally you may have an SNESROMS folder at the top level of the DVD, in which
|
|
||||||
case the game selectorwill default to showing that folder when first entered.
|
|
||||||
If you create a bootable DVD of Snes9xGx you can put roms on the same DVD.
|
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
Loading / Running the Emulator:
|
Loading / Running the Emulator:
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
Via Homebrew Channel:
|
Wii - Via Homebrew Channel:
|
||||||
--------------------
|
--------------------
|
||||||
The most popular method of running homebrew on the wii is through the Homebrew
|
The most popular method of running homebrew on the wii is through the Homebrew
|
||||||
Channel. If you already have the channel installed, just copy over the apps folder
|
Channel. If you already have the channel installed, just copy over the apps folder
|
||||||
included in the archive into the root of your SD card (the SD autosaving version
|
included in the archive into the root of your SD card (the SD autosaving version
|
||||||
for wii is included in the apps/Snes9xGX/ folder renamed to boot.dol).
|
for wii is included in the apps/Snes9xGX/ folder renamed to boot.dol).
|
||||||
|
|
||||||
Remember to also create the snes9x/roms and snes9x/saves directories. See above.
|
Remember to also create the directories required. See above.
|
||||||
|
|
||||||
If you wish to use a version that autosaves to other available saving locations,
|
If you wish to use a version that autosaves to other available saving locations,
|
||||||
just choose the appropriate dol, copy it into the apps/Snes9XGX/ folder, and
|
just choose the appropriate dol, copy it into the apps/Snes9XGX/ folder, and
|
||||||
@ -176,12 +184,11 @@ If you haven't installed the homebrew channel yet, read about how to here:
|
|||||||
|
|
||||||
Gamecube:
|
Gamecube:
|
||||||
---------
|
---------
|
||||||
You can load it via sdload and an SD card in slot A, or by streaming it to your
|
You can load Snes9xGX via sdload and an SD card in slot A, or by streaming
|
||||||
cube, or by booting a bootable DVD (gamecube only) with it on it. This document doesn't cover
|
it to your Gamecube, or by booting a bootable DVD (gamecube only) with it on it.
|
||||||
how to do any of that. A good source for information on these topics is the
|
This document doesn't cover how to do any of that. A good source for information
|
||||||
tehskeen forums:
|
on these topics is the tehskeen forums: http://www.tehskeen.com/forums/
|
||||||
|
|
||||||
http://www.tehskeen.com/forums/
|
|
||||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||||
|0O×øo· ABOUT SNES9X ·oø×O0|
|
|0O×øo· ABOUT SNES9X ·oø×O0|
|
||||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||||
@ -263,14 +270,13 @@ To use 7-Zip compression on either linux or windows, use the following command:
|
|||||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||||
|
|
||||||
Once the DOL file is loaded you will be presented with main menu where you can
|
Once the DOL file is loaded you will be presented with main menu where you can
|
||||||
load a ROM, set options for the emulator, set the joypad configuration, save or
|
load a ROM, set options for the emulator, set the joypad configuration, etc.
|
||||||
load freezes, manage SRAM, etc.
|
|
||||||
After loading a game the game will start running immediately. If you have the
|
After loading a game the game will start running immediately. If you have the
|
||||||
auto-load SRAM option enabled it will automatically load SRAM (if it exists)
|
auto-load SRAM option enabled it will automatically load SRAM (if it exists)
|
||||||
before starting play.
|
before starting play.
|
||||||
|
|
||||||
You can return to the main menu at any time by pressing
|
You can return to the menu at any time by pressing the c-stick (the yellow
|
||||||
the c-stick (the yellow control stick) to the left, or by pressing L+R+X+Y.
|
control stick) to the left, or by pressing L+R+X+Y.
|
||||||
Return to the game by selecting "Resume Game" or by pressing the B button until
|
Return to the game by selecting "Resume Game" or by pressing the B button until
|
||||||
play resumes.
|
play resumes.
|
||||||
|
|
||||||
@ -287,7 +293,7 @@ want normal playback speed to resume.
|
|||||||
|0O×øo· IMPORTING AND EXPORTING SRAM ·oø×O0|
|
|0O×øo· IMPORTING AND EXPORTING SRAM ·oø×O0|
|
||||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||||
|
|
||||||
Snes9xGx 2.0.1 now includes the ability to load SRAM from Snes9x on other
|
Snes9xGx now includes the ability to load SRAM from Snes9x on other
|
||||||
platforms (Mac/PC/Linux/Etc) and to save back to those platforms. To use this
|
platforms (Mac/PC/Linux/Etc) and to save back to those platforms. To use this
|
||||||
feature simply save or load SRAM to/from SD card or an SMB share.
|
feature simply save or load SRAM to/from SD card or an SMB share.
|
||||||
|
|
||||||
|
305
include/mxml.h
Normal file
305
include/mxml.h
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
/*
|
||||||
|
* "$Id: mxml.h 307 2007-09-15 20:03:15Z mike $"
|
||||||
|
*
|
||||||
|
* Header file for Mini-XML, a small XML-like file parsing library.
|
||||||
|
*
|
||||||
|
* Copyright 2003-2007 by Michael Sweet.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prevent multiple inclusion...
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _mxml_h_
|
||||||
|
# define _mxml_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include necessary headers...
|
||||||
|
*/
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <ctype.h>
|
||||||
|
# include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constants...
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define MXML_TAB 8 /* Tabs every N columns */
|
||||||
|
|
||||||
|
# define MXML_NO_CALLBACK 0 /* Don't use a type callback */
|
||||||
|
# define MXML_INTEGER_CALLBACK mxml_integer_cb
|
||||||
|
/* Treat all data as integers */
|
||||||
|
# define MXML_OPAQUE_CALLBACK mxml_opaque_cb
|
||||||
|
/* Treat all data as opaque */
|
||||||
|
# define MXML_REAL_CALLBACK mxml_real_cb
|
||||||
|
/* Treat all data as real numbers */
|
||||||
|
# define MXML_TEXT_CALLBACK 0 /* Treat all data as text */
|
||||||
|
# define MXML_IGNORE_CALLBACK mxml_ignore_cb
|
||||||
|
/* Ignore all non-element content */
|
||||||
|
|
||||||
|
# define MXML_NO_PARENT 0 /* No parent for the node */
|
||||||
|
|
||||||
|
# define MXML_DESCEND 1 /* Descend when finding/walking */
|
||||||
|
# define MXML_NO_DESCEND 0 /* Don't descend when finding/walking */
|
||||||
|
# define MXML_DESCEND_FIRST -1 /* Descend for first find */
|
||||||
|
|
||||||
|
# define MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */
|
||||||
|
# define MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */
|
||||||
|
# define MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */
|
||||||
|
# define MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */
|
||||||
|
|
||||||
|
# define MXML_ADD_BEFORE 0 /* Add node before specified node */
|
||||||
|
# define MXML_ADD_AFTER 1 /* Add node after specified node */
|
||||||
|
# define MXML_ADD_TO_PARENT NULL /* Add node relative to parent */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Data types...
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum mxml_sax_event_e /**** SAX event type. ****/
|
||||||
|
{
|
||||||
|
MXML_SAX_CDATA, /* CDATA node */
|
||||||
|
MXML_SAX_COMMENT, /* Comment node */
|
||||||
|
MXML_SAX_DATA, /* Data node */
|
||||||
|
MXML_SAX_DIRECTIVE, /* Processing directive node */
|
||||||
|
MXML_SAX_ELEMENT_CLOSE, /* Element closed */
|
||||||
|
MXML_SAX_ELEMENT_OPEN /* Element opened */
|
||||||
|
} mxml_sax_event_t;
|
||||||
|
|
||||||
|
typedef enum mxml_type_e /**** The XML node type. ****/
|
||||||
|
{
|
||||||
|
MXML_IGNORE = -1, /* Ignore/throw away node @since Mini-XML 2.3@ */
|
||||||
|
MXML_ELEMENT, /* XML element with attributes */
|
||||||
|
MXML_INTEGER, /* Integer value */
|
||||||
|
MXML_OPAQUE, /* Opaque string */
|
||||||
|
MXML_REAL, /* Real value */
|
||||||
|
MXML_TEXT, /* Text fragment */
|
||||||
|
MXML_CUSTOM /* Custom data @since Mini-XML 2.1@ */
|
||||||
|
} mxml_type_t;
|
||||||
|
|
||||||
|
typedef void (*mxml_custom_destroy_cb_t)(void *);
|
||||||
|
/**** Custom data destructor ****/
|
||||||
|
|
||||||
|
typedef void (*mxml_error_cb_t)(const char *);
|
||||||
|
/**** Error callback function ****/
|
||||||
|
|
||||||
|
typedef struct mxml_attr_s /**** An XML element attribute value. ****/
|
||||||
|
{
|
||||||
|
char *name; /* Attribute name */
|
||||||
|
char *value; /* Attribute value */
|
||||||
|
} mxml_attr_t;
|
||||||
|
|
||||||
|
typedef struct mxml_element_s /**** An XML element value. ****/
|
||||||
|
{
|
||||||
|
char *name; /* Name of element */
|
||||||
|
int num_attrs; /* Number of attributes */
|
||||||
|
mxml_attr_t *attrs; /* Attributes */
|
||||||
|
} mxml_element_t;
|
||||||
|
|
||||||
|
typedef struct mxml_text_s /**** An XML text value. ****/
|
||||||
|
{
|
||||||
|
int whitespace; /* Leading whitespace? */
|
||||||
|
char *string; /* Fragment string */
|
||||||
|
} mxml_text_t;
|
||||||
|
|
||||||
|
typedef struct mxml_custom_s /**** An XML custom value. @since Mini-XML 2.1@ ****/
|
||||||
|
{
|
||||||
|
void *data; /* Pointer to (allocated) custom data */
|
||||||
|
mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */
|
||||||
|
} mxml_custom_t;
|
||||||
|
|
||||||
|
typedef union mxml_value_u /**** An XML node value. ****/
|
||||||
|
{
|
||||||
|
mxml_element_t element; /* Element */
|
||||||
|
int integer; /* Integer number */
|
||||||
|
char *opaque; /* Opaque string */
|
||||||
|
double real; /* Real number */
|
||||||
|
mxml_text_t text; /* Text fragment */
|
||||||
|
mxml_custom_t custom; /* Custom data @since Mini-XML 2.1@ */
|
||||||
|
} mxml_value_t;
|
||||||
|
|
||||||
|
typedef struct mxml_node_s /**** An XML node. ****/
|
||||||
|
{
|
||||||
|
mxml_type_t type; /* Node type */
|
||||||
|
struct mxml_node_s *next; /* Next node under same parent */
|
||||||
|
struct mxml_node_s *prev; /* Previous node under same parent */
|
||||||
|
struct mxml_node_s *parent; /* Parent node */
|
||||||
|
struct mxml_node_s *child; /* First child node */
|
||||||
|
struct mxml_node_s *last_child; /* Last child node */
|
||||||
|
mxml_value_t value; /* Node value */
|
||||||
|
int ref_count; /* Use count */
|
||||||
|
void *user_data; /* User data */
|
||||||
|
} mxml_node_t;
|
||||||
|
|
||||||
|
typedef struct mxml_index_s /**** An XML node index. ****/
|
||||||
|
{
|
||||||
|
char *attr; /* Attribute used for indexing or NULL */
|
||||||
|
int num_nodes; /* Number of nodes in index */
|
||||||
|
int alloc_nodes; /* Allocated nodes in index */
|
||||||
|
int cur_node; /* Current node */
|
||||||
|
mxml_node_t **nodes; /* Node array */
|
||||||
|
} mxml_index_t;
|
||||||
|
|
||||||
|
typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);
|
||||||
|
/**** Custom data load callback function ****/
|
||||||
|
|
||||||
|
typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *);
|
||||||
|
/**** Custom data save callback function ****/
|
||||||
|
|
||||||
|
typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);
|
||||||
|
/**** Load callback function ****/
|
||||||
|
|
||||||
|
typedef const char *(*mxml_save_cb_t)(mxml_node_t *, int);
|
||||||
|
/**** Save callback function ****/
|
||||||
|
|
||||||
|
typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *);
|
||||||
|
/**** SAX callback function ****/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* C++ support...
|
||||||
|
*/
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prototypes...
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern void mxmlAdd(mxml_node_t *parent, int where,
|
||||||
|
mxml_node_t *child, mxml_node_t *node);
|
||||||
|
extern void mxmlDelete(mxml_node_t *node);
|
||||||
|
extern void mxmlElementDeleteAttr(mxml_node_t *node,
|
||||||
|
const char *name);
|
||||||
|
extern const char *mxmlElementGetAttr(mxml_node_t *node, const char *name);
|
||||||
|
extern void mxmlElementSetAttr(mxml_node_t *node, const char *name,
|
||||||
|
const char *value);
|
||||||
|
extern void mxmlElementSetAttrf(mxml_node_t *node, const char *name,
|
||||||
|
const char *format, ...)
|
||||||
|
# ifdef __GNUC__
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
;
|
||||||
|
extern int mxmlEntityAddCallback(int (*cb)(const char *name));
|
||||||
|
extern const char *mxmlEntityGetName(int val);
|
||||||
|
extern int mxmlEntityGetValue(const char *name);
|
||||||
|
extern void mxmlEntityRemoveCallback(int (*cb)(const char *name));
|
||||||
|
extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top,
|
||||||
|
const char *name, const char *attr,
|
||||||
|
const char *value, int descend);
|
||||||
|
extern void mxmlIndexDelete(mxml_index_t *ind);
|
||||||
|
extern mxml_node_t *mxmlIndexEnum(mxml_index_t *ind);
|
||||||
|
extern mxml_node_t *mxmlIndexFind(mxml_index_t *ind,
|
||||||
|
const char *element,
|
||||||
|
const char *value);
|
||||||
|
extern mxml_index_t *mxmlIndexNew(mxml_node_t *node, const char *element,
|
||||||
|
const char *attr);
|
||||||
|
extern mxml_node_t *mxmlIndexReset(mxml_index_t *ind);
|
||||||
|
extern mxml_node_t *mxmlLoadFd(mxml_node_t *top, int fd,
|
||||||
|
mxml_type_t (*cb)(mxml_node_t *));
|
||||||
|
extern mxml_node_t *mxmlLoadFile(mxml_node_t *top, FILE *fp,
|
||||||
|
mxml_type_t (*cb)(mxml_node_t *));
|
||||||
|
extern mxml_node_t *mxmlLoadString(mxml_node_t *top, const char *s,
|
||||||
|
mxml_type_t (*cb)(mxml_node_t *));
|
||||||
|
extern mxml_node_t *mxmlNewCDATA(mxml_node_t *parent, const char *string);
|
||||||
|
extern mxml_node_t *mxmlNewCustom(mxml_node_t *parent, void *data,
|
||||||
|
mxml_custom_destroy_cb_t destroy);
|
||||||
|
extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name);
|
||||||
|
extern mxml_node_t *mxmlNewInteger(mxml_node_t *parent, int integer);
|
||||||
|
extern mxml_node_t *mxmlNewOpaque(mxml_node_t *parent, const char *opaque);
|
||||||
|
extern mxml_node_t *mxmlNewReal(mxml_node_t *parent, double real);
|
||||||
|
extern mxml_node_t *mxmlNewText(mxml_node_t *parent, int whitespace,
|
||||||
|
const char *string);
|
||||||
|
extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace,
|
||||||
|
const char *format, ...)
|
||||||
|
# ifdef __GNUC__
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
;
|
||||||
|
extern mxml_node_t *mxmlNewXML(const char *version);
|
||||||
|
extern int mxmlRelease(mxml_node_t *node);
|
||||||
|
extern void mxmlRemove(mxml_node_t *node);
|
||||||
|
extern int mxmlRetain(mxml_node_t *node);
|
||||||
|
extern char *mxmlSaveAllocString(mxml_node_t *node,
|
||||||
|
mxml_save_cb_t cb);
|
||||||
|
extern int mxmlSaveFd(mxml_node_t *node, int fd,
|
||||||
|
mxml_save_cb_t cb);
|
||||||
|
extern int mxmlSaveFile(mxml_node_t *node, FILE *fp,
|
||||||
|
mxml_save_cb_t cb);
|
||||||
|
extern int mxmlSaveString(mxml_node_t *node, char *buffer,
|
||||||
|
int bufsize, mxml_save_cb_t cb);
|
||||||
|
extern mxml_node_t *mxmlSAXLoadFd(mxml_node_t *top, int fd,
|
||||||
|
mxml_type_t (*cb)(mxml_node_t *),
|
||||||
|
mxml_sax_cb_t sax, void *sax_data);
|
||||||
|
extern mxml_node_t *mxmlSAXLoadFile(mxml_node_t *top, FILE *fp,
|
||||||
|
mxml_type_t (*cb)(mxml_node_t *),
|
||||||
|
mxml_sax_cb_t sax, void *sax_data);
|
||||||
|
extern mxml_node_t *mxmlSAXLoadString(mxml_node_t *top, const char *s,
|
||||||
|
mxml_type_t (*cb)(mxml_node_t *),
|
||||||
|
mxml_sax_cb_t sax, void *sax_data);
|
||||||
|
extern int mxmlSetCDATA(mxml_node_t *node, const char *data);
|
||||||
|
extern int mxmlSetCustom(mxml_node_t *node, void *data,
|
||||||
|
mxml_custom_destroy_cb_t destroy);
|
||||||
|
extern void mxmlSetCustomHandlers(mxml_custom_load_cb_t load,
|
||||||
|
mxml_custom_save_cb_t save);
|
||||||
|
extern int mxmlSetElement(mxml_node_t *node, const char *name);
|
||||||
|
extern void mxmlSetErrorCallback(mxml_error_cb_t cb);
|
||||||
|
extern int mxmlSetInteger(mxml_node_t *node, int integer);
|
||||||
|
extern int mxmlSetOpaque(mxml_node_t *node, const char *opaque);
|
||||||
|
extern int mxmlSetReal(mxml_node_t *node, double real);
|
||||||
|
extern int mxmlSetText(mxml_node_t *node, int whitespace,
|
||||||
|
const char *string);
|
||||||
|
extern int mxmlSetTextf(mxml_node_t *node, int whitespace,
|
||||||
|
const char *format, ...)
|
||||||
|
# ifdef __GNUC__
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
;
|
||||||
|
extern void mxmlSetWrapMargin(int column);
|
||||||
|
extern mxml_node_t *mxmlWalkNext(mxml_node_t *node, mxml_node_t *top,
|
||||||
|
int descend);
|
||||||
|
extern mxml_node_t *mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top,
|
||||||
|
int descend);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Semi-private functions...
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern void mxml_error(const char *format, ...);
|
||||||
|
extern mxml_type_t mxml_ignore_cb(mxml_node_t *node);
|
||||||
|
extern mxml_type_t mxml_integer_cb(mxml_node_t *node);
|
||||||
|
extern mxml_type_t mxml_opaque_cb(mxml_node_t *node);
|
||||||
|
extern mxml_type_t mxml_real_cb(mxml_node_t *node);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* C++ support...
|
||||||
|
*/
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif /* __cplusplus */
|
||||||
|
#endif /* !_mxml_h_ */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* End of "$Id: mxml.h 307 2007-09-15 20:03:15Z mike $".
|
||||||
|
*/
|
3569
include/png.h
Normal file
3569
include/png.h
Normal file
File diff suppressed because it is too large
Load Diff
1481
include/pngconf.h
Normal file
1481
include/pngconf.h
Normal file
File diff suppressed because it is too large
Load Diff
1132
include/pngu/pngu.c
Normal file
1132
include/pngu/pngu.c
Normal file
File diff suppressed because it is too large
Load Diff
171
include/pngu/pngu.h
Normal file
171
include/pngu/pngu.h
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/********************************************************************************************
|
||||||
|
|
||||||
|
PNGU Version : 0.2a
|
||||||
|
|
||||||
|
Coder : frontier
|
||||||
|
|
||||||
|
More info : http://frontier-dev.net
|
||||||
|
|
||||||
|
********************************************************************************************/
|
||||||
|
#ifndef __PNGU__
|
||||||
|
#define __PNGU__
|
||||||
|
|
||||||
|
// Return codes
|
||||||
|
#define PNGU_OK 0
|
||||||
|
#define PNGU_ODD_WIDTH 1
|
||||||
|
#define PNGU_ODD_STRIDE 2
|
||||||
|
#define PNGU_INVALID_WIDTH_OR_HEIGHT 3
|
||||||
|
#define PNGU_FILE_IS_NOT_PNG 4
|
||||||
|
#define PNGU_UNSUPPORTED_COLOR_TYPE 5
|
||||||
|
#define PNGU_NO_FILE_SELECTED 6
|
||||||
|
#define PNGU_CANT_OPEN_FILE 7
|
||||||
|
#define PNGU_CANT_READ_FILE 8
|
||||||
|
#define PNGU_LIB_ERROR 9
|
||||||
|
|
||||||
|
// Color types
|
||||||
|
#define PNGU_COLOR_TYPE_GRAY 1
|
||||||
|
#define PNGU_COLOR_TYPE_GRAY_ALPHA 2
|
||||||
|
#define PNGU_COLOR_TYPE_PALETTE 3
|
||||||
|
#define PNGU_COLOR_TYPE_RGB 4
|
||||||
|
#define PNGU_COLOR_TYPE_RGB_ALPHA 5
|
||||||
|
#define PNGU_COLOR_TYPE_UNKNOWN 6
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Types
|
||||||
|
typedef unsigned char PNGU_u8;
|
||||||
|
typedef unsigned short PNGU_u16;
|
||||||
|
typedef unsigned int PNGU_u32;
|
||||||
|
typedef unsigned long long PNGU_u64;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PNGU_u8 r;
|
||||||
|
PNGU_u8 g;
|
||||||
|
PNGU_u8 b;
|
||||||
|
} PNGUCOLOR;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PNGU_u32 imgWidth; // In pixels
|
||||||
|
PNGU_u32 imgHeight; // In pixels
|
||||||
|
PNGU_u32 imgBitDepth; // In bitx
|
||||||
|
PNGU_u32 imgColorType; // PNGU_COLOR_TYPE_*
|
||||||
|
PNGU_u32 validBckgrnd; // Non zero if there is a background color
|
||||||
|
PNGUCOLOR bckgrnd; // Backgroun color
|
||||||
|
PNGU_u32 numTrans; // Number of transparent colors
|
||||||
|
PNGUCOLOR *trans; // Transparent colors
|
||||||
|
} PNGUPROP;
|
||||||
|
|
||||||
|
// Image context, always initialize with SelectImageFrom* and free with ReleaseImageContext
|
||||||
|
struct _IMGCTX;
|
||||||
|
typedef struct _IMGCTX *IMGCTX;
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pixel conversion *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Macro to convert RGB8 values to RGB565
|
||||||
|
#define PNGU_RGB8_TO_RGB565(r,g,b) ( ((((PNGU_u16) r) & 0xF8U) << 8) | ((((PNGU_u16) g) & 0xFCU) << 3) | (((PNGU_u16) b) >> 3) )
|
||||||
|
|
||||||
|
// Macro to convert RGBA8 values to RGB5A3
|
||||||
|
#define PNGU_RGB8_TO_RGB5A3(r,g,b,a) (PNGU_u16) (((a & 0xE0U) == 0xE0U) ? \
|
||||||
|
(0x8000U | ((((PNGU_u16) r) & 0xF8U) << 7) | ((((PNGU_u16) g) & 0xF8U) << 2) | (((PNGU_u16) b) >> 3)) : \
|
||||||
|
(((((PNGU_u16) a) & 0xE0U) << 7) | ((((PNGU_u16) r) & 0xF0U) << 4) | (((PNGU_u16) g) & 0xF0U) | ((((PNGU_u16) b) & 0xF0U) >> 4)))
|
||||||
|
|
||||||
|
// Function to convert two RGB8 values to YCbYCr
|
||||||
|
PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2);
|
||||||
|
|
||||||
|
// Function to convert an YCbYCr to two RGB8 values.
|
||||||
|
void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Image context handling *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Selects a PNG file, previosly loaded into a buffer, and creates an image context for subsequent procesing.
|
||||||
|
IMGCTX PNGU_SelectImageFromBuffer (const void *buffer);
|
||||||
|
|
||||||
|
// Selects a PNG file, from any devoptab device, and creates an image context for subsequent procesing.
|
||||||
|
IMGCTX PNGU_SelectImageFromDevice (const char *filename);
|
||||||
|
|
||||||
|
// Frees resources associated with an image context. Always call this function when you no longer need the IMGCTX.
|
||||||
|
void PNGU_ReleaseImageContext (IMGCTX ctx);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Miscelaneous *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Retrieves info from selected PNG file, including image dimensions, color format, background and transparency colors.
|
||||||
|
int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Image conversion *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Expands selected image into an YCbYCr buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and stride in pixels (stride = buffer width - image width).
|
||||||
|
int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||||
|
|
||||||
|
// Macro for decoding an image inside a buffer at given coordinates.
|
||||||
|
#define PNGU_DECODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_DecodeToYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||||
|
|
||||||
|
// Expands selected image into a linear RGB565 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and stride in pixels (stride = buffer width - image width).
|
||||||
|
int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||||
|
|
||||||
|
// Macro for decoding an image inside a buffer at given coordinates.
|
||||||
|
#define PNGU_DECODE_TO_COORDS_RGB565(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_DecodeToRGB565 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||||
|
|
||||||
|
// Expands selected image into a linear RGBA8 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address, stride in pixels and default alpha value, which is used if the source image
|
||||||
|
// doesn't have an alpha channel.
|
||||||
|
int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha);
|
||||||
|
|
||||||
|
// Macro for decoding an image inside a buffer at given coordinates.
|
||||||
|
#define PNGU_DECODE_TO_COORDS_RGBA8(ctx,coordX,coordY,imgWidth,imgHeight,default_alpha,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_DecodeToRGBA8 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth), default_alpha)
|
||||||
|
|
||||||
|
// Expands selected image into a 4x4 tiled RGB565 buffer. You need to specify context, image dimensions
|
||||||
|
// and destination address.
|
||||||
|
int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer);
|
||||||
|
|
||||||
|
// Expands selected image into a 4x4 tiled RGB5A3 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
|
||||||
|
int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
|
||||||
|
|
||||||
|
// Expands selected image into a 4x4 tiled RGBA8 buffer. You need to specify context, image dimensions,
|
||||||
|
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
|
||||||
|
int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
|
||||||
|
|
||||||
|
// Encodes an YCbYCr image in PNG format and stores it in the selected device or memory buffer. You need to
|
||||||
|
// specify context, image dimensions, destination address and stride in pixels (stride = buffer width - image width).
|
||||||
|
int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||||
|
|
||||||
|
// Macro for encoding an image stored into an YCbYCr buffer at given coordinates.
|
||||||
|
#define PNGU_ENCODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||||
|
\
|
||||||
|
PNGU_EncodeFromYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||||
|
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
BIN
lib/libmxml.a
Normal file
BIN
lib/libmxml.a
Normal file
Binary file not shown.
BIN
lib/libpng.a
Normal file
BIN
lib/libpng.a
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user