diff options
Diffstat (limited to 'source')
50 files changed, 0 insertions, 20213 deletions
diff --git a/source/doc/porting.txt b/source/doc/porting.txt deleted file mode 100644 index 3d28eec..0000000 --- a/source/doc/porting.txt +++ /dev/null @@ -1,725 +0,0 @@ - How to Port Snes9x to a New Platform - ==================================== - -Version: 1.01 -Date: 23-December-1998 - -(c) Copyright 1998 Gary Henderson (gary@daniver.demon.co.uk) - -Introduction -============ - -This is brief description of the steps involved in porting Snes9x, the Super -Nintendo Entertainment System emulator, to new hardware which is at least -similar to Workstation or PC. It describes what code you have to write and -what functions exist that you can make use of. It also gives some insights as -to how Snes9x actually works, although that will be subject of another -document yet to be written. - -Host System Requirements -======================== - -A C++ compiler, so you can compile the emulator! Snes9x really isn't written -in C++, it just uses the C++ compiler as a 'better C' compiler to get inline -functions and so on. With some modification, it could be converted to be -compiled with an ordinary C compiler. Snes9x isn't very C type safe and -will probably not work on a system who's integers are less than 32-bits wide -without lots of editing. - -If the host system uses a CPU that implements the i386 instruction set then -you will also want to use the three assembler CPU cores, although I recently -scrapped the SPC700 assembler code (too many bugs) and replaced it with -compiler generated assembler code that I haven't got around to optimising -yet. The 65c816 and SPC700 code needs to be assembled using the GNU -assembler that comes with gcc and the Super FX code assembled with NASM -v0.97 or higher. gcc is available from lots of sites. NASM is available from -http://www.cryogen.com/Nasm - -A fast CPU. SNES emulation is very compute intensive: two, or sometimes three -CPUs to emulate, an 8-channel 16-bit stereo sound digital signal processor -with real-time sample decompression, filter and echo effects, two custom -graphics processor chips that can produce transparency, scaling, rotation -and window effects in 32768 colors, and finally hardware DMA all take their -toll on the host CPU. - -Lots of RAM. The SNES itself has 128k work RAM, 64k V-RAM and 64k sound CPU -RAM. If a Super FX game is being emulated, that usually comes with another -64k inside the game pack. Snes9x itself needs 4Mb to load SNES ROM images -into (or 6Mb if I ever figure out the SNES memory map of the 48Mbit ROM -images out there), 256k to cache decompressed sound samples in, 512k to -cache converted SNES tiles in, and another 64k for S-RAM emulation. And -that's not counting a few large lookup tables that the graphics code needs -for speeding up transparency effects plus few other tables used by the ZSNES -Super FX code. It all adds up to 7Mb (ish). Add to that RAM needed to -store the actual emulator code and RAM required by the host operating system -and any other process that is running; that's lots of RAM. Well, it is if -your host system only has a few mega-bytes of RAM available. - -An 8-bit, 256 color (one byte per pixel) or deeper display, at least 256x239 -pixels in resolution, or 512x478 if you're going to support the SNES' -hi-res. background screen modes. Ideally, a 16-bit, 65536 color screen mode -is required if you want to support transparency at speed, as that is what the -code renders internally. Any other format screen, with transparency enabled, -will require picture format conversion before you can place the rendered -SNES image on to the screen. - -Sound output requires spooling 8-bit or 16-bit, mono or stereo digital sound -data to the host computer's sound hardware. The DOS port uses interrupts -from the sound card to know when more sound data is required, most other -ports have to periodically poll the host sound hardware to see if more data -is required; if it is then the SNES sound mixing code provided by Snes9x is -called to fill an area of system memory with ready mixed SNES sound data, -which then can be passed on to the host sound hardware. Sound data is -generated as an array of bytes (uint8) for 8-bit sound or shorts (int16) for -16-bit data. Stereo sound data generates twice as many samples, with each -channel's samples interleaved, first left's then right's. - -For the user to be able to control and play SNES games, some form of input -device is required, a joystick or keyboard, for example. The real SNES can -have 2 eight-button digital joy-pads connected to it or 5 joy-pads when an -optional multi-player adaptor was purchased, although most games only require -a single joy-pad. Access to all eight buttons and the direction pad, of -course, are usually required by most games. Snes9x does emulate the -multi-player adaptor hardware, if you were wondering, but its still up to -you to provide the emulation of the individual joy-pads. - -The SNES also had a mouse and light gun available as optional extras, -Snes9x can emulate both of these using some form of pointing device, -usually the host system's mouse. - -If an accurate, constant SNES play rate is required, then a real-time timer -will be needed that can time intervals of 16.7ms (NTSC frame time) or 20ms -(PAL frame time). - -Some SNES game packs contained a small amount of extra RAM and a battery so -ROMs could save a player's progress through a game for games that takes many -hours to play from start to finish. Snes9x simulates this S-RAM by saving -the contents of the area of memory normally occupied by the S-RAM into file -then automatically restoring it again the next time the user plays the same -game. If the hardware you're porting to doesn't have a hard disk available -then you could be in trouble. - -Snes9x also implements freeze-game files which can record the state of the -SNES hardware and RAM at a particular point in time and can restore it to -that exact state at a later date - the result is that users can save a game -at any point, not just at save-game or password points provided by the -original game coders. Each freeze file is over 400k in size. To help save -disk space, Snes9x can be compiled with zlib, which is used to compress the -freeze files, reducing the size to typically below 100k. Download zlib from -its homepage at http://www.cdrom.com/pub/infozip/zlib/, compile Snes9x with -ZLIB defined and link with zlib. zlib is also used to load any compressed -ROM images Snes9x my encounter, compressed with gzip or compress. - -Porting -======= - -In theory you will only need to edit port.h, then in a separate file write -all the initialisation code and interface routines that Snes9x expects the -you to implement. You, no doubt, will discover otherwise.... - -There are several compile-time only options available: - -DEBUGGER --------- - -Enables extra code to assist me in debugging SNES ROMs. The debugger has only -ever been a quick-hack by me and user-interface to debugger facilities is -virtually non-existent. Most of the debugger information is output via -stdout and enabling the compile-time options slows the whole emulator down -slightly. However, the debugger options available are very powerful; you -could use it to help get your port working. You probably still want to ship -the finished version with the debugger disabled, it will only confuse -non-technical users. - -VAR_CYCLES ----------- - -I recommend you define this. The main CPU in the SNES actually varies in -speed depending on what area of memory its accessing and the ROM access -speed of the game pack; defining VAR_CYCLES causes Snes9x to emulate this, -using a good approximation, rather than fixed cycle length as ZSNES does. The -resultant code is slightly slower. Leaving it undefined results in many more -emulation timing errors appearing while playing games. - -CPU_SHUTDOWN and SPC700_SHUTDOWN --------------------------------- - -Again I recommend defining both of these. They are both speed up hacks. -When defined, Snes9x starts watching for when either the main or sound CPUs -are in simply loops waiting for a known event to happen - like the end of -the current scan-line, and interrupt or a sound timer to reach a particular -value. If Snes9x spots either CPU in such a loop it uses its insider -knowledge to simply skip the emulation of that CPU's instructions until the -event happens. It can be a big win with lots of SNES games. - -I'm constantly amazed at the ingenuity of some programmers who are able to -produce complex code to do simple things: some ROM's wait loops are so -complex Snes9x fails to spot the CPU is in such a loop and the shutdown -speed up hacks don't work. - -You might be wondering why VAR_CYCLES, and the two SHUTDOWN options have to -be enabled with defines, well, in the past they sometimes introduced -problems with some ROMs, so I kept them as options. I think I've fixed all -the problems now, but you never know... - -SPC700_C --------- - -Define this if you are using the C/C++ version of the SPC700 CPU core. It -enables a ROM compatibility feature that executes SPC700 instructions during -SNES DMA, it allows several games to start that would otherwise lock up and -fixes music pauses when ROMs do lots of DMA, usually when switching between -game screens. - -ZLIB ----- - -Define this if you have the zlib library available and you want it to -compress freeze-game files to save disk space. The library is also used to -support compressed ROM images. - -NO_INLINE_SET_GET ------------------ - -Define this to stop several of the memory access routines from being -defined in-line. Whether the C++ compiler actually in-lines when this symbol -is not defined is up to the compiler itself. In-lines functions can speed up -the C++ CPU emulations on some architectures at the cost of increased code -size. Try fiddling with this option once you've got port working to see if -it helps the speed of your port. - -EXECUTE_SUPERFX_PER_LINE and ZSNES_FX -------------------------------------- - -Define these if you're going to be using the ZSNES Super FX i386 assembler -code, otherwise leave them both undefined. In theory, -EXECUTE_SUPERFX_PER_LINE can also be defined when using the C++ Super FX -emulation code, but the code is still buggy and enabling the option -introduces more problems than it fixes. Any takers for fixing the C++ code? - -JOYSTICK_SUPPORT, SIDEWINDER_SUPPORT and GRIP_SUPPORT ------------------------------------------------------ - -These options enable support for various input devices in the UNIX and MS-DOS -port code. They're only of interest if you're able to use the existing UNIX -or MS-DOS port specific code. - -port.h -====== - -If the byte ordering of the target system is least significant byte first, -make sure LSB_FIRST is defined in this header, otherwise, make sure its not -defined. - -If you're going to support 16-bit screen rendering (required if you want -transparency effects) and your system doesn't use RGB 565 - 5 bits for red, -6 bits for green and 5 bits for blue - then you'll need make sure RGB555, -BGR565 or BGR555 is defined instead. You might want to take a look at the -*_LOW_BIT_MASKs, *_HI_BIT_MASKs and BUILD_PIXEL macros to make sure they're -correct, because I've only every tested the RGB565 version, though the Mac -port uses the RGB555 option. If your system is 24 or 32-bit only, then -don't define anything; instead write a conversion routine that will take a -complete rendered 16-bit SNES screen in RGB565 format and convert to the -format required to be displayed on your hardware. - -port.h also typedefs some types, uint8 for an unsigned, 8-bit quantity, -uint16 for an unsigned, 16-bit quantity, uint32 for a 32-bit, unsigned -quantity and bool8 for a true/false type. Signed versions are also -typedef'ed. - -The CHECK_SOUND macro can be defined to invoke some code that polls the -host system's sound hardware to see if it can accept any more sound data. -Snes9x makes calls to this macro several times when it is rendering the SNES -screen, during large SNES DMAs and after every emulated CPU instruction. - -Since this CHECK_SOUND macro is invoked often, the code should only take a -very small amount of time to execute or it will slow down the emulator's -performance. The Linux and UNIX ports use a system timer and set a variable -when it has expired; the CHECK_SOUND only has to check to see if the -variable is set. On the MS-DOS and Mac ports, the sound hardware is not -polled at all, instead it is driven by interrupts or callbacks and the -CHECK_SOUND macro is defined to be empty. - -Initialisation Code -------------------- - -This is what the Linux, UNIX and MS-DOS ports do, I suspect your code -might be similar: - -- The Settings structure is initialised to some sensible default values - - check the main function in unix.cpp for the values it uses. - -- The command line is parsed, options specified override default values in - the Settings structure and specify a ROM image filename that the user - wants loaded. Your port could load user preferences from a file or some - other source at this point. Most values, with a little care, can be changed - via a GUI once the emulator is running. - -- Some Settings structure value validation takes place, for example if - transparency effects are requested the code also makes sure 16-bit - screen rendering is turned on as well. - -- Memory.Init() and S9xInitAPU() are called, checking neither failed. The - only reason they would fail is if memory allocation failed. - -- Memory.LoadROM (filename) is called to load the specified ROM image into - memory. If that worked Memory.LoadSRAM (sram_filename) is called to load - the ROM's S-RAM file, if one exists. The all current ports base the - sram_filename on the filename of the ROM image, changing the file's - extension (the .smc or whatever bit) and changing the directory where its - located - you won't be able to save S-RAM files onto a CD if that's where - the ROM image is located! - - If your port has a GUI, you can delay this step until the user picks an - image to load. - - SNES roms images come in all shapes and sizes, some with headers, some - without, some have been mangled by the copier device in one of two ways, and - some split into several pieces; plus the SNES itself has several different - memory map models. The code tries to auto-detect all these various types, - but sometimes the SNES ROM header information has been manually edited by - someone at some stage and the code guesses wrong. To help it out it these - situations, the Settings structure contains several options to force a - particular ROM image format; these values must be initialised prior to each - call to Memory.LoadROM(filename). - -- The Linux and UNIX ports now do some more operating system initialisation - ready for a system timer to be started. - -- The host display hardware is now initialised. The actual screen depth and - resolution should be picked based on the user preferences if possible. - The X Window System port can't control the screen depth or resolution, if - the user requests transparency effects but the display hardware is only - set to 8-bit, it has to invoke an extra step of converting the 16-bit SNES - rendered screen to a fixed palette 8-bit display just before the SNES - screen is copied to the display hardware. - - The GFX.Screen pointer needs to be initialised to point to an array of - uint8 for 8-bit screen rendering or uint16 for 16-bit rendering, cast to - an array of uint8. The array needs to be at least 256x239 bytes or shorts - in size for lo-res only support (Settings.SupportHiRes = FALSE) or - 512x478 for lo-res and hi-res support. If transparency effects are - required, the GFX.SubScreen array also needs to be initialised to another - identically sized array of the same type, otherwise it can be just - initialised to NULL. - - The GFX.Pitch variable needs to be set to the number of bytes on each line - of the arrays, e.g. 256 for lo-res only support, up to 1024 for 16-bit - hi-res support. If GFX.Screen is pointing into an existing array, one - created by the library function rather than just calling malloc or new, - then set GFX.Pitch to the number of bytes per line of that array, - including any padding the library function may have added. - - If the target hardware supports fast access to video RAM, the screen is in - 16-bit format supported by the SNES rendering code and you can double - buffer the display, you might want to point GFX.Screen directly at the - video buffer RAM. You will need to recompute the GFX.Delta value every - time you change the GFX.Screen value to double-buffer the rendering and - display. - -- A call to S9xGraphicsInit() is made; make sure all your graphics rendering - options are setup correctly by now. If later, you want to change some - settings, for example 16-bit to 8-bit rendering, call S9xGraphicsDeinit() - first, change your settings, GFX.Screen and GFX.SubScreen arrays, etc., - then call S9xGraphicsInit() again. - -- S9xInitSound(int playbackrate, bool8 stereo, int sound_buffer_size) - is now called, which in turn will call your S9xOpenSoundDevice function - - see below. - -- The display is switched to graphics mode using a call to S9xGraphicsMode(). - -- The system timer is started; its used for keeping the emulator speed - relatively constant on the MS-DOS port and noting when the sound hardware - sound should be able to accept more sound data on the Linux and UNIX ports. - -- A main loop is entered which is just a loop constantly calling - S9xMainLoop() then polling the operating system for any pending events - such as key presses and releases, joystick updates, mouse position - updates, GUI user interaction, etc. - - Pause functionality can be implemented by skipping the call to S9xMainLoop - and muting the sound output by calling S9xSetSoundMute (TRUE). - - Don't enter the main loop until a SNES ROM image has been loaded, or at - least skip calling S9xMainLoop inside the loop until one is and make sure - S9xReset is called instead before entering the main loop. The Mac port - implements this technique by starting in pause mode and refusing to unpause - until a ROM image is loaded. - - S9xMainLoop processes SNES CPU emulation, SNES screen rendering, DMA and - H-DMA emulation, until emulated scan-line 0 is reached, then it returns. - Now is your chance to process any system events pending, scan the - keyboard, read joystick values, etc. - - If DEBUGGER compile-time support is enabled and the CPU emulation has hit - a break point or single-stepping is switched on, or the DEBUG_MODE_FLAG is - set in the CPU.Flags variable, then the S9xMainLoop routine returns early, - allowing you to act on the event in some way. The Linux, DOS and UNIX ports - respond to the DEBUG_MODE_FLAG being set by calling S9xDoDebug(), which in - turn outputs the current instruction and loops reading commands from stdin - and outputting debug information, currently via stdout. The debugger - desperately needs rewriting to support a GUI interface, more descriptive - commands and better error handling; maybe one day... - -Existing Interface Routines ---------------------------- - -These are routines already written that you will either need to call or -might find useful. - --> bool8 Memory.Init () - -Allocates and initialises several major lumps of memory, for example -the SNES ROM and RAM arrays, tile cache arrays, etc. Returns FALSE if -memory allocation fails. - --> void Memory.Deinit () - -Undoes the memory allocations made by Memory.Init. - --> bool8 S9xGraphicsInit () - -Allocated and initialises several lookup tables used to speed up SNES -graphics rendering. Call after you have initialised the GFX.Screen, -GFX.SubScreen and GFX.Pitch values. If Settings.Transparency is false it -does not allocate tables used to speed up transparency effects. If you -want to provide the user with option to turn the effects on and off during -game play, make sure Settings.Transparency is true when this function is -called, it can later be set to FALSE. - -Returns FALSE if memory allocation fails. - --> void S9xGraphicsDeinit () - -Undoes the memory allocations made by S9xGraphicsInit. - --> bool8 S9xInitAPU () - -Allocates and initialises several arrays used by the sound CPU and sound -generation code. - --> void S9xDeinitAPU () - -Undoes the allocations made by S9xInitAPU. - --> bool8 S9xInitSound (int mode, bool8 stereo, int buffer_size) - -Does more sound code initialisation and opens the host system's sound hardware -by calling the S9xOpenSoundDevice function provided by you. - --> void S9xReset () - -Resets the SNES emulated hardware back to the state it was in at 'switch-on' -except the S-RAM area is presevered. The effect is it resets the current game -back to the start. This function is automatically called by Memory.LoROM. - --> bool8 Memory.LoadROM (const char *filename) - -Attempts to load the specified ROM image filename into the emulated ROM area. -There are many different SNES ROM image formats and the code attempts to -auto-detect as many different types as it can and in a vast majority of the -cases gets it right. However, some ROM images have been edited by someone at -some stage or have been mangled by the ROM copier that produced them and -LoadROM needs help. Inparticular, it can't auto-detect the odd way in which -some Super FX games have been mangled and needs to be told, via -Settings.Interleaved2, that the ROM image is in that format, or that -odd-sized ROM images have a 512 byte copier header. - -There are several other ROM image options in the Settings structure; -allow the user to set them before calling LoadROM, or make sure they all -reset to default values before each call to LoadROM. - --> bool8 Memory.LoadSRAM (const char *filename) - -Call this routine to load the associated S-RAM save file (if any). The -filename should be based on the ROM image name to allow easy linkage. -The current ports change the directory and the filename extension of the ROM -filename to derive the S-RAM filename. - --> bool8 Memory.SaveSRAM (const char *filename) - -Call this routine to save the emulated S-RAM area into a file so it can -be restored again the next time the user wants to play the game. Remember -to call this when just before the emulator exits or when the user has been -playing a game and is about to load another one. - --> void S9xMainLoop() - -The emulator main loop. Call this from your own main loop that calls this -function (if a ROM image is loaded and the game is not paused), processes -any pending host system events, then goes back around the loop again until -the emulator exits. - -S9xMainLoop normally returns control to your main loop once every emulated -frame, when it reaches the start of scan-line zero. However, the routine -can return more often if the DEBUGGER compile-time flag is defined and the -CPU has hit a break point, or the DEBUG_MODE_FLAG bit is set in CPU.Flags -or instruction single-stepping is enabled. - --> void S9xMixSamples (uint8 *buffer, int sample_count) - -Call this routine from your host sound hardware handling code to fill the -specified buffer with ready mixed SNES sound data. If 16-bit sound mode is -choosen, then the buffer will be filled with an array of sample_count int16, -otherwise an array of sample_count uint8. If stereo sound generation is -selected the buffer is filled with the same number of samples, but in pairs, -first a left channel sample followed by the right channel sample. - -There is a limit on how much data S9xMixSamples can deal with in one go and -hence a limit on the sample_count value; the limit is the value of the -MAX_BUFFER_SIZE symbol, normally 4096 bytes. - --> bool8 S9xSetSoundMute (bool8 mute) - -Call with a TRUE parmeter to prevent S9xMixSamples from processing SNES -sample data and instead just filling the return buffer with silent sound -data. Useful if your sound system is interrupt or callback driven and the -game has been paused either directly or indirectly because the user -interacting with the emulator's user interface in some way. - --> bool8 S9xFreezeGame (const char *filename) - -Call this routine to record the current SNES hardware state into a file, -the file can be loaded back using S9xUnfreezeGame at a later date effectively -restoring the current game to exact same spot. Call this routine while -you're processing any pending system events when S9xMainLoop has returned -control to you in your main loop. - --> bool8 S9xUnfreezeGame (const char *filename) - -Restore the SNES hardware back to the exactly the state it was in when -S9xFreezeGame was used to generate the file specified. You have to arrange -the correct ROM is already loaded using Memory.LoadROM, an easy way to -arrange this is to base freeze-game filenames on the ROM image name. The -Linux, UNIX and DOS ports load freeze-game files when the user presses a -function key, with the names romfilename.000 for F1, romfilename.001 for F2, -etc. Games are frozen in the first place when the user presses Shift-function -key. You could choose some other scheme. - --> void S9xNextController () - -The real SNES allows several different types of devices to be plugged into -the game controller ports. The devices Snes9x emulates are a joy-pad, -multi-player adaptor (allowing a further 4 joy-pads to be plugged in), -a 2-button mouse and a light gun known as the SuperScope. - -Each call to S9xNextController will step the current emulated device on to -the next device in the sequence multi-player, joy-pad, mouse on port 1, -mouse on port 2, light gun then back to multi-player again. Defines -allocating a number of each device type are in snes9x.h. The currently -selected device is stored in IPPU.Controller if you want to give some -feedback to the user. The initial value of IPPU.Controller (set when -S9xReset is called) is obtained from Settings.ControllerOption based on -currently enabled options. - -Some ROMs object to certain non-joy-pad devices being plugged into the real -SNES while they are running, all Super FX games should only allow joy-pads to -be plugged in because the Super FX chip and any other device would overload -the SNES power supply. Tetris and Dr. Mario also objects for reasons best -known to itself. For this reason there are switches in the Settings -structure to enable and display the emulation of the various devices. - -const char *S9xGameGenieToRaw (const char *code, uint32 &address, uint8 &byte) - -const char *S9xProActionReplayToRaw (const char *code, uint32 &address, - uint8 &byte) - -const char *S9xGoldFingerToRaw (const char *code, uint32 &address, bool8 &sram, - uint8 &num_bytes, uint8 bytes[3]) - -void S9xApplyCheats (bool8 apply) - -void S9xRemoveCheats () - -void S9xAddCheat (uint32 address, bool8 cpu_address, bool8 sram, uint8 num_bytes, - uint8 byte1, uint8 byte2, uint8 byte3) - -void S9xDeleteCheats () - -void S9xDoDebug () - -Interface Routines You Need to Implement ----------------------------------------- - -bool8 S9xOpenSnapshotFile (const char *base, bool8 read_only, STREAM *file) -*************************************************************************** -void S9xCloseSnapshotFile (STREAM file) -*************************************** - -Routines to open and close freeze-game files. STREAM is defined as a -gzFile if ZLIB is defined else its defined as FILE *. The read_only parameter -is set to TRUE when reading a freeze-game file and FALSE when writing a -freeze-game file. - -void S9xExit () -*************** - -Called when some fatal error situation arises or when the 'q' debugger -command is used. The Mac port just beeps and drops back to the GUI when -S9xExit is called, the MS-DOS, Linux and Solaris ports all call exit () to -terminate the emulator process. - -void S9xParseArg (char **argv, int &index, int argc) -**************************************************** - -void S9xExtraUsage () -********************* - -If you're going to be using the simple command line parser, when it -encounters an unknown option it calls S9xUsage which is supposed to report -all options the generic parse knows about (I haven't been keeping it up to -date of late). S9xUsage then, in turn calls S9xExtraUsage which you -implement to report any port-specific options available. - -void S9xGraphicsMode () -*********************** -void S9xTextMode () -******************* - -The SNES debugger calls these routines to switch from a graphics screen -mode used to display the SNES game to a debugger screen used to display -debugger output. If the SNES screen can be displayed at the same time as -a text display, as would be the case when the host system implements a -graphical window system, or you're not going to support the SNES debugger, -then these routines should do nothing. - -On the X Window System UNIX/Linux port, these routines do nothing where as -on the MS-DOS port they switch between a graphics screen mode and a text-only -screen mode. - -bool8 S9xInitUpdate () -********************** - -Called just before Snes9x starts to render a SNES screen. The Windows port -uses this call to lock Direct X screen area to allow exclusive access; on -other existing ports its implemented as an empty function. - -bool8 S9xDeinitDisplay (int width, int height, bool8 sixteen_bit) -***************************************************************** - -Called once a complete SNES screen has been rendered into the GFX.Screen -memory buffer, now is your chance to copy the SNES rendered screen to the -host computer's screen memory. The problem is that you have to cope with -different sized SNES rendered screens. Width is always 256, unless you're -supporting SNES hi-res. screen modes (Settings.SupportHiRes is TRUE), in -which case it can be 256 or 512. The height parameter can be either 224 or -239 if you're only supporting SNES lo-res. screen modes, or 224, 239, 448 or -478 if hi-res. SNES screen modes are being supported. - -All current ports support scaling the SNES screen to fill the host system's -screen, the many ports even supports interpolation - blending the colours of -adjacent pixels to help hide the fact they've been scaled - and scan-line -simulation - slightly darkening every other horizontal line. - -Don't forget that if you're just placing the SNES image centerally in the -screen then you might need to clear areas of the screen if the SNES image -changes size between calls to S9xDeinitDisplay. The MS-DOS and UNIX ports -currently don't do this which results in junk being left on the screen if -the ROM changes SNES screen modes. - -The sixteen_bit is just a copy of the Settings.SixteenBit setting and if -TRUE indicates a 16-bit SNES screen image has been rendered, 8-bit otherwise. - -void S9xMessage (int type, int number, const char *message) -*********************************************************** - -I've started work on converting all the old printfs into calls to this -routine. When Snes9x wants to display an error, information or warning -message, it calls this routine. Check in messages.h for the types and -individual message numbers that Snes9x currently passes as parameters. - -The idea is display the message string so the user can see it, but you -choose not to display anything at all, or change the message based on the -message number or message type. - -Eventually all debug output will also go via this function, trace information -already does. - -bool8 S9xOpenSoundDevice(int mode, bool8 stereo, int buffer_size) -***************************************************************** - -S9xInitSound calls this function to actually open the host operating system's -sound device, or initialise the sound card in MS-DOS port. - -The mode parameter is the value passed in on the command line with the -r -command line flag, assuming you're using the Snes9x parser. Its meant to -indicate what playback the sound hardware should be set to, value 1 to 7. -I think the real SNES sound chip playback rate is 30kHz, but such high -playback rates take a lot of native CPU power to emulate. The default -playback rate is 22kHz for the MS-DOS and UNIX ports. - -The stereo flag indicates if the user wants stereo sound. Again, stereo -sound takes more CPU to power to emulate compared to mono sound. - -The buffer_size value indicates what sample buffer size the user wants, -usually zero, meaning you should pick the value best suited to the current -playback rate. Sound data is normally passed to the sound hardware in -blocks, the smaller the block the less latency between the SNES game playing -a sound and it being heard by the user. But if you pick a too smaller value, -and you're having to periodically poll the operating system to see if it can -accept more sound data, then the sound output will break up because other -actions such as rendering the SNES screen can prevent you from polling the -hardware often enough and the operating system runs out of sound data to -play. - -The MS-DOS port uses a buffer size of 128 samples since the sound card -sends an interrupt when more data is required which is acted upon promptly, -where as the Linux and Solaris ports use a buffer size of 512 samples or -more depending on the playback rate. Stereo and 16-bit sound both double the -actual size of the buffer in bytes. - -uint32 S9xReadJoypad (int which1_0_to_4) -**************************************** - -This function is called to return a bit-wise mask of the state of one of the -five emulated SNES controllers. Return 0 if you're not supporting controllers -past a certain number or return the mask representing the current state of -the controller number passed as a parameter or'ed with 0x80000000. - -Symbolic constants are defined in snes9x.h indicating the bit positions of -the various SNES buttons and direction indicators; they're all in the form -SNES_X_MASK where X is the SNES controller button name. - -The MS-DOS and X Window System ports record what keys are currently pressed -and use that to build up a mask, the Windows port polls the operating system -when S9xReadJoypad is called to find out what keys are pressed. All ports -also implement host joysticks and joy-pads via this interface. - -bool8 S9xReadMousePosition (int which1_0_to_1, int &x, int &y, uint32 &buttons) -******************************************************************************* - -Used by Snes9x to get the current position of the host pointing device, -usually a mouse, used to emulated the SNES mouse. Snes9x converts the x and -y values to delta values required by the SNES mouse, so the actual x and y -values are unimportant, only the change in value since the last call to -this function is used. - -Graphical windowing systems normally restrict the movement of the pointer on -the screen, if you're porting to such an environment you might want to make -a note of the change in position in the mouse since the last time you asked -the operating system the mouse position, add this change in value to some -saved x and y value, the reposition the pointer back to the centre of the -SNES display window. The saved x and y values will be the values returned -by this function. - -The buttons return value is a bit-wise mask of the two SNES mouse buttons, -bit 0 for button 1 (left) and bit 1 for button 2 (right). - -bool8 S9xReadSuperScopePosition (int &x, int &y, uint32 &buttons) -***************************************************************** - -void S9xSetPalette () -********************* - -void S9xSyncSpeed () -S9xUnixProcessSound -void _makepath(char *, char const *, char const *, char const *, char const *) -void _splitpath(char const *, char *, char *, char *, char *) - - -Sound Generation ----------------- - -Settings --------- diff --git a/source/font/Pictochat-16.bdf b/source/font/Pictochat-16.bdf deleted file mode 100644 index a512814..0000000 --- a/source/font/Pictochat-16.bdf +++ /dev/null @@ -1,2802 +0,0 @@ -STARTFONT 2.1 -FONT -FontForge-Pictochat-Book-R-Normal--16-150-75-75-P-53-ISO10646-1 -SIZE 15 75 75 -FONTBOUNDINGBOX 12 13 0 -1 -COMMENT "Generated by fontforge, http://fontforge.sourceforge.net" -STARTPROPERTIES 37 -FAMILY_NAME "Pictochat" -WEIGHT_NAME "Book" -SLANT "R" -SETWIDTH_NAME "Normal" -ADD_STYLE_NAME "" -PIXEL_SIZE 16 -POINT_SIZE 150 -RESOLUTION_X 75 -RESOLUTION_Y 75 -SPACING "P" -AVERAGE_WIDTH 53 -CHARSET_REGISTRY "ISO10646" -CHARSET_ENCODING "1" -FONTNAME_REGISTRY "" -CHARSET_COLLECTIONS "ISO10646-1" -FONT_NAME "Pictochat" -FACE_NAME "Pictochat Regular" -FONT_VERSION "1.0" -FONT_ASCENT 13 -FONT_DESCENT 3 -UNDERLINE_POSITION 2 -UNDERLINE_THICKNESS 1 -X_HEIGHT 5 -CAP_HEIGHT 8 -RAW_ASCENT 799 -RAW_DESCENT 200 -NORM_SPACE 2 -RELATIVE_WEIGHT 40 -RELATIVE_SETWIDTH 50 -SUPERSCRIPT_X 0 -SUPERSCRIPT_Y 8 -SUPERSCRIPT_SIZE 8 -SUBSCRIPT_X 0 -SUBSCRIPT_Y 0 -SUBSCRIPT_SIZE 8 -AVG_LOWERCASE_WIDTH 55 -AVG_UPPERCASE_WIDTH 56 -ENDPROPERTIES -CHARS 184 -STARTCHAR space -ENCODING 32 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 1 1 0 0 -BITMAP -00 -ENDCHAR -STARTCHAR exclam -ENCODING 33 -SWIDTH 125 0 -DWIDTH 2 0 -BBX 1 9 0 0 -BITMAP -80 -80 -80 -80 -80 -80 -00 -80 -80 -ENDCHAR -STARTCHAR quotedbl -ENCODING 34 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 3 0 6 -BITMAP -28 -50 -A0 -ENDCHAR -STARTCHAR numbersign -ENCODING 35 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 9 0 0 -BITMAP -14 -14 -7E -28 -28 -28 -FC -50 -50 -ENDCHAR -STARTCHAR dollar -ENCODING 36 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -70 -A8 -A0 -70 -28 -A8 -70 -20 -ENDCHAR -STARTCHAR percent -ENCODING 37 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 9 0 0 -BITMAP -44 -A4 -A8 -48 -10 -24 -2A -4A -44 -ENDCHAR -STARTCHAR ampersand -ENCODING 38 -SWIDTH 437 0 -DWIDTH 7 0 -BBX 6 9 0 0 -BITMAP -20 -50 -50 -50 -20 -54 -88 -88 -74 -ENDCHAR -STARTCHAR quotesingle -ENCODING 39 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 1 2 1 7 -BITMAP -80 -80 -ENDCHAR -STARTCHAR parenleft -ENCODING 40 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -20 -40 -40 -80 -80 -80 -40 -40 -20 -ENDCHAR -STARTCHAR parenright -ENCODING 41 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -80 -40 -40 -20 -20 -20 -40 -40 -80 -ENDCHAR -STARTCHAR asterisk -ENCODING 42 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 7 0 1 -BITMAP -10 -92 -54 -38 -54 -92 -10 -ENDCHAR -STARTCHAR plus -ENCODING 43 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 5 0 2 -BITMAP -20 -20 -F8 -20 -20 -ENDCHAR -STARTCHAR comma -ENCODING 44 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 2 2 0 -1 -BITMAP -40 -80 -ENDCHAR -STARTCHAR hyphen -ENCODING 45 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 1 0 4 -BITMAP -F8 -ENDCHAR -STARTCHAR period -ENCODING 46 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 1 1 0 0 -BITMAP -80 -ENDCHAR -STARTCHAR slash -ENCODING 47 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -20 -20 -20 -40 -40 -40 -80 -80 -80 -ENDCHAR -STARTCHAR zero -ENCODING 48 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -70 -88 -98 -98 -A8 -C8 -C8 -88 -70 -ENDCHAR -STARTCHAR one -ENCODING 49 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 2 9 0 0 -BITMAP -C0 -40 -40 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR two -ENCODING 50 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F0 -08 -08 -08 -70 -80 -80 -80 -F8 -ENDCHAR -STARTCHAR three -ENCODING 51 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F0 -08 -08 -08 -70 -08 -08 -08 -F0 -ENDCHAR -STARTCHAR four -ENCODING 52 -SWIDTH 437 0 -DWIDTH 7 0 -BBX 6 9 0 0 -BITMAP -88 -88 -88 -88 -88 -7C -08 -08 -08 -ENDCHAR -STARTCHAR five -ENCODING 53 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F8 -80 -80 -80 -F0 -08 -08 -08 -F0 -ENDCHAR -STARTCHAR six -ENCODING 54 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -70 -80 -80 -80 -F0 -88 -88 -88 -70 -ENDCHAR -STARTCHAR seven -ENCODING 55 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F8 -08 -08 -10 -20 -20 -20 -20 -20 -ENDCHAR -STARTCHAR eight -ENCODING 56 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -70 -88 -88 -88 -70 -88 -88 -88 -70 -ENDCHAR -STARTCHAR nine -ENCODING 57 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -70 -88 -88 -88 -78 -08 -08 -08 -70 -ENDCHAR -STARTCHAR colon -ENCODING 58 -SWIDTH 125 0 -DWIDTH 2 0 -BBX 1 5 0 2 -BITMAP -80 -00 -00 -00 -80 -ENDCHAR -STARTCHAR semicolon -ENCODING 59 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 2 6 0 1 -BITMAP -40 -00 -00 -00 -40 -80 -ENDCHAR -STARTCHAR less -ENCODING 60 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 5 0 2 -BITMAP -20 -40 -80 -40 -20 -ENDCHAR -STARTCHAR equal -ENCODING 61 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 3 0 3 -BITMAP -F8 -00 -F8 -ENDCHAR -STARTCHAR greater -ENCODING 62 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 5 0 2 -BITMAP -80 -40 -20 -40 -80 -ENDCHAR -STARTCHAR question -ENCODING 63 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -E0 -10 -10 -20 -40 -40 -00 -40 -40 -ENDCHAR -STARTCHAR at -ENCODING 64 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 9 0 0 -BITMAP -38 -44 -9A -AA -AA -AA -9C -40 -3C -ENDCHAR -STARTCHAR A -ENCODING 65 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR B -ENCODING 66 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F0 -88 -88 -88 -F0 -88 -88 -88 -F0 -ENDCHAR -STARTCHAR C -ENCODING 67 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -78 -80 -80 -80 -80 -80 -80 -80 -78 -ENDCHAR -STARTCHAR D -ENCODING 68 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F0 -88 -88 -88 -88 -88 -88 -88 -F0 -ENDCHAR -STARTCHAR E -ENCODING 69 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -F0 -80 -80 -80 -F0 -80 -80 -80 -F0 -ENDCHAR -STARTCHAR F -ENCODING 70 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -F0 -80 -80 -80 -F0 -80 -80 -80 -80 -ENDCHAR -STARTCHAR G -ENCODING 71 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -78 -80 -80 -80 -B8 -88 -88 -88 -70 -ENDCHAR -STARTCHAR H -ENCODING 72 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -88 -88 -F8 -88 -88 -88 -88 -ENDCHAR -STARTCHAR I -ENCODING 73 -SWIDTH 125 0 -DWIDTH 2 0 -BBX 1 9 0 0 -BITMAP -80 -80 -80 -80 -80 -80 -80 -80 -80 -ENDCHAR -STARTCHAR J -ENCODING 74 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -10 -10 -10 -10 -10 -10 -10 -10 -E0 -ENDCHAR -STARTCHAR K -ENCODING 75 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -90 -90 -A0 -C0 -A0 -90 -90 -88 -ENDCHAR -STARTCHAR L -ENCODING 76 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -80 -80 -80 -80 -80 -80 -80 -80 -F0 -ENDCHAR -STARTCHAR M -ENCODING 77 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -D8 -D8 -A8 -A8 -88 -88 -88 -ENDCHAR -STARTCHAR N -ENCODING 78 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -C8 -C8 -A8 -A8 -98 -98 -88 -88 -ENDCHAR -STARTCHAR O -ENCODING 79 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -70 -88 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR P -ENCODING 80 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F0 -88 -88 -88 -F0 -80 -80 -80 -80 -ENDCHAR -STARTCHAR Q -ENCODING 81 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 10 0 -1 -BITMAP -70 -88 -88 -88 -88 -88 -88 -A8 -70 -18 -ENDCHAR -STARTCHAR R -ENCODING 82 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F0 -88 -88 -88 -F0 -90 -90 -88 -88 -ENDCHAR -STARTCHAR S -ENCODING 83 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -70 -80 -80 -80 -60 -10 -10 -10 -E0 -ENDCHAR -STARTCHAR T -ENCODING 84 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -F8 -20 -20 -20 -20 -20 -20 -20 -20 -ENDCHAR -STARTCHAR U -ENCODING 85 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR V -ENCODING 86 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -88 -50 -50 -50 -50 -20 -20 -ENDCHAR -STARTCHAR W -ENCODING 87 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -A8 -A8 -A8 -A8 -50 -50 -50 -ENDCHAR -STARTCHAR X -ENCODING 88 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -50 -50 -20 -50 -50 -88 -88 -ENDCHAR -STARTCHAR Y -ENCODING 89 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -50 -50 -20 -20 -20 -20 -20 -ENDCHAR -STARTCHAR Z -ENCODING 90 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -F0 -10 -20 -20 -60 -40 -40 -80 -F0 -ENDCHAR -STARTCHAR bracketleft -ENCODING 91 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -E0 -80 -80 -80 -80 -80 -80 -80 -E0 -ENDCHAR -STARTCHAR backslash -ENCODING 92 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -80 -80 -80 -40 -40 -40 -20 -20 -20 -ENDCHAR -STARTCHAR bracketright -ENCODING 93 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -E0 -20 -20 -20 -20 -20 -20 -20 -E0 -ENDCHAR -STARTCHAR asciicircum -ENCODING 94 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 2 0 7 -BITMAP -40 -A0 -ENDCHAR -STARTCHAR underscore -ENCODING 95 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 1 0 0 -BITMAP -F8 -ENDCHAR -STARTCHAR grave -ENCODING 96 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 2 2 0 7 -BITMAP -80 -40 -ENDCHAR -STARTCHAR a -ENCODING 97 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR b -ENCODING 98 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -80 -80 -80 -F0 -88 -88 -88 -88 -F0 -ENDCHAR -STARTCHAR c -ENCODING 99 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -78 -80 -80 -80 -80 -78 -ENDCHAR -STARTCHAR d -ENCODING 100 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -08 -08 -08 -78 -88 -88 -88 -88 -78 -ENDCHAR -STARTCHAR e -ENCODING 101 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -70 -88 -F8 -80 -80 -78 -ENDCHAR -STARTCHAR f -ENCODING 102 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -30 -40 -40 -F0 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR g -ENCODING 103 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 7 0 -1 -BITMAP -78 -88 -88 -88 -78 -08 -F0 -ENDCHAR -STARTCHAR h -ENCODING 104 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -80 -80 -80 -F0 -88 -88 -88 -88 -88 -ENDCHAR -STARTCHAR i -ENCODING 105 -SWIDTH 125 0 -DWIDTH 2 0 -BBX 1 8 0 0 -BITMAP -80 -00 -80 -80 -80 -80 -80 -80 -ENDCHAR -STARTCHAR j -ENCODING 106 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 -1 -BITMAP -20 -00 -20 -20 -20 -20 -20 -20 -C0 -ENDCHAR -STARTCHAR k -ENCODING 107 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -80 -80 -80 -90 -A0 -C0 -A0 -90 -90 -ENDCHAR -STARTCHAR l -ENCODING 108 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 2 9 0 0 -BITMAP -80 -80 -80 -80 -80 -80 -80 -80 -40 -ENDCHAR -STARTCHAR m -ENCODING 109 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 6 0 0 -BITMAP -FC -92 -92 -92 -92 -92 -ENDCHAR -STARTCHAR n -ENCODING 110 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -F0 -88 -88 -88 -88 -88 -ENDCHAR -STARTCHAR o -ENCODING 111 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -70 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR p -ENCODING 112 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 7 0 -1 -BITMAP -F0 -88 -88 -88 -F0 -80 -80 -ENDCHAR -STARTCHAR q -ENCODING 113 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 7 0 -1 -BITMAP -78 -88 -88 -88 -78 -08 -08 -ENDCHAR -STARTCHAR r -ENCODING 114 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 6 0 0 -BITMAP -B0 -C0 -80 -80 -80 -80 -ENDCHAR -STARTCHAR s -ENCODING 115 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 6 0 0 -BITMAP -70 -80 -60 -10 -10 -E0 -ENDCHAR -STARTCHAR t -ENCODING 116 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 8 0 0 -BITMAP -40 -40 -F0 -40 -40 -40 -40 -30 -ENDCHAR -STARTCHAR u -ENCODING 117 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -88 -88 -88 -88 -88 -78 -ENDCHAR -STARTCHAR v -ENCODING 118 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -88 -88 -50 -50 -20 -20 -ENDCHAR -STARTCHAR w -ENCODING 119 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -88 -A8 -A8 -A8 -50 -50 -ENDCHAR -STARTCHAR x -ENCODING 120 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -88 -50 -20 -20 -50 -88 -ENDCHAR -STARTCHAR y -ENCODING 121 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 7 0 -1 -BITMAP -88 -88 -50 -50 -20 -20 -C0 -ENDCHAR -STARTCHAR z -ENCODING 122 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 6 0 0 -BITMAP -F8 -10 -20 -40 -80 -F8 -ENDCHAR -STARTCHAR braceleft -ENCODING 123 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -30 -40 -40 -40 -80 -40 -40 -40 -30 -ENDCHAR -STARTCHAR bar -ENCODING 124 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 1 9 1 0 -BITMAP -80 -80 -80 -80 -80 -80 -80 -80 -80 -ENDCHAR -STARTCHAR braceright -ENCODING 125 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -C0 -20 -20 -20 -10 -20 -20 -20 -C0 -ENDCHAR -STARTCHAR asciitilde -ENCODING 126 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 2 0 4 -BITMAP -7880 -8700 -ENDCHAR -STARTCHAR exclamdown -ENCODING 161 -SWIDTH 125 0 -DWIDTH 2 0 -BBX 1 9 0 0 -BITMAP -80 -80 -00 -80 -80 -80 -80 -80 -80 -ENDCHAR -STARTCHAR cent -ENCODING 162 -SWIDTH 437 0 -DWIDTH 7 0 -BBX 6 9 0 0 -BITMAP -10 -78 -94 -A0 -A0 -A0 -C4 -78 -40 -ENDCHAR -STARTCHAR sterling -ENCODING 163 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -30 -48 -40 -20 -F8 -20 -40 -80 -F8 -ENDCHAR -STARTCHAR yen -ENCODING 165 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -88 -88 -50 -50 -F8 -20 -F8 -20 -20 -ENDCHAR -STARTCHAR brokenbar -ENCODING 166 -SWIDTH 125 0 -DWIDTH 2 0 -BBX 1 9 0 0 -BITMAP -80 -80 -80 -80 -00 -80 -80 -80 -80 -ENDCHAR -STARTCHAR copyright -ENCODING 169 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -3E00 -4100 -9C80 -A280 -A080 -A280 -9C80 -4100 -3E00 -ENDCHAR -STARTCHAR registered -ENCODING 174 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -3E00 -4100 -BC80 -A280 -BC80 -A480 -A280 -4100 -3E00 -ENDCHAR -STARTCHAR degree -ENCODING 176 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 3 0 6 -BITMAP -40 -A0 -40 -ENDCHAR -STARTCHAR plusminus -ENCODING 177 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 7 0 1 -BITMAP -20 -20 -F8 -20 -20 -00 -F8 -ENDCHAR -STARTCHAR acute -ENCODING 180 -SWIDTH 187 0 -DWIDTH 3 0 -BBX 2 2 0 7 -BITMAP -40 -80 -ENDCHAR -STARTCHAR periodcentered -ENCODING 183 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 2 2 1 3 -BITMAP -C0 -C0 -ENDCHAR -STARTCHAR questiondown -ENCODING 191 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 9 0 0 -BITMAP -20 -20 -00 -20 -20 -40 -80 -80 -70 -ENDCHAR -STARTCHAR Agrave -ENCODING 192 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -20 -10 -00 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR Aacute -ENCODING 193 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -20 -40 -00 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR Acircumflex -ENCODING 194 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 12 0 0 -BITMAP -20 -50 -00 -20 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR Atilde -ENCODING 195 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -28 -50 -00 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR Adieresis -ENCODING 196 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -50 -00 -20 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR Aring -ENCODING 197 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 12 0 0 -BITMAP -20 -50 -20 -00 -20 -50 -50 -50 -F8 -88 -88 -88 -ENDCHAR -STARTCHAR Ccedilla -ENCODING 199 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 10 0 -1 -BITMAP -70 -80 -80 -80 -80 -80 -80 -70 -20 -40 -ENDCHAR -STARTCHAR Egrave -ENCODING 200 -SWIDTH 1000 0 -DWIDTH 5 0 -BBX 4 11 0 0 -BITMAP -40 -20 -00 -F0 -80 -80 -F0 -80 -80 -80 -F0 -ENDCHAR -STARTCHAR Eacute -ENCODING 201 -SWIDTH 1000 0 -DWIDTH 5 0 -BBX 4 11 0 0 -BITMAP -20 -40 -00 -F0 -80 -80 -F0 -80 -80 -80 -F0 -ENDCHAR -STARTCHAR Ecircumflex -ENCODING 202 -SWIDTH 1000 0 -DWIDTH 5 0 -BBX 4 11 0 0 -BITMAP -20 -50 -00 -F0 -80 -80 -F0 -80 -80 -80 -F0 -ENDCHAR -STARTCHAR Edieresis -ENCODING 203 -SWIDTH 1000 0 -DWIDTH 5 0 -BBX 4 10 0 0 -BITMAP -50 -00 -F0 -80 -80 -F0 -80 -80 -80 -F0 -ENDCHAR -STARTCHAR Igrave -ENCODING 204 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 2 11 0 0 -BITMAP -80 -40 -00 -40 -40 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR Iacute -ENCODING 205 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 2 11 1 0 -BITMAP -40 -80 -00 -80 -80 -80 -80 -80 -80 -80 -80 -ENDCHAR -STARTCHAR Icircumflex -ENCODING 206 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 11 0 0 -BITMAP -40 -A0 -00 -40 -40 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR Idieresis -ENCODING 207 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 10 0 0 -BITMAP -A0 -00 -40 -40 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR Ntilde -ENCODING 209 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -28 -50 -00 -88 -C8 -C8 -A8 -A8 -98 -98 -88 -ENDCHAR -STARTCHAR Ograve -ENCODING 210 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -40 -20 -00 -70 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Oacute -ENCODING 211 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -10 -20 -00 -70 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Ocircumflex -ENCODING 212 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -20 -50 -00 -70 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Otilde -ENCODING 213 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -28 -50 -00 -70 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Odieresis -ENCODING 214 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -50 -00 -00 -70 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR multiply -ENCODING 215 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 5 0 2 -BITMAP -88 -50 -20 -50 -88 -ENDCHAR -STARTCHAR Ugrave -ENCODING 217 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -40 -20 -00 -88 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Uacute -ENCODING 218 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -10 -20 -00 -88 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Ucircumflex -ENCODING 219 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 11 0 0 -BITMAP -20 -50 -00 -88 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Udieresis -ENCODING 220 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 10 0 0 -BITMAP -50 -00 -88 -88 -88 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR Thorn -ENCODING 222 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -80 -80 -F0 -88 -88 -88 -F0 -80 -80 -ENDCHAR -STARTCHAR germandbls -ENCODING 223 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -70 -88 -88 -B0 -88 -88 -88 -B0 -80 -ENDCHAR -STARTCHAR agrave -ENCODING 224 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -10 -00 -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR aacute -ENCODING 225 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -10 -20 -00 -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR acircumflex -ENCODING 226 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -50 -00 -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR atilde -ENCODING 227 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -28 -50 -00 -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR adieresis -ENCODING 228 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 8 0 0 -BITMAP -50 -00 -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR aring -ENCODING 229 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 10 0 0 -BITMAP -20 -50 -20 -00 -F0 -08 -78 -88 -88 -78 -ENDCHAR -STARTCHAR ccedilla -ENCODING 231 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 7 0 -1 -BITMAP -70 -80 -80 -80 -70 -20 -40 -ENDCHAR -STARTCHAR egrave -ENCODING 232 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -40 -20 -00 -70 -88 -F8 -80 -80 -78 -ENDCHAR -STARTCHAR eacute -ENCODING 233 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -10 -20 -00 -70 -88 -F8 -80 -80 -78 -ENDCHAR -STARTCHAR ecircumflex -ENCODING 234 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -50 -00 -70 -88 -F8 -80 -80 -78 -ENDCHAR -STARTCHAR edieresis -ENCODING 235 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 8 0 0 -BITMAP -50 -00 -70 -88 -F8 -80 -80 -78 -ENDCHAR -STARTCHAR igrave -ENCODING 236 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 2 9 0 0 -BITMAP -80 -40 -00 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR iacute -ENCODING 237 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 2 9 1 0 -BITMAP -40 -80 -00 -80 -80 -80 -80 -80 -80 -ENDCHAR -STARTCHAR icircumflex -ENCODING 238 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 9 0 0 -BITMAP -40 -A0 -00 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR idieresis -ENCODING 239 -SWIDTH 250 0 -DWIDTH 4 0 -BBX 3 8 0 0 -BITMAP -A0 -00 -40 -40 -40 -40 -40 -40 -ENDCHAR -STARTCHAR ntilde -ENCODING 241 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -28 -50 -00 -F0 -88 -88 -88 -88 -88 -ENDCHAR -STARTCHAR ograve -ENCODING 242 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -40 -20 -00 -70 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR oacute -ENCODING 243 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -10 -20 -00 -70 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR ocircumflex -ENCODING 244 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -50 -00 -70 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR otilde -ENCODING 245 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -28 -50 -00 -70 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR odieresis -ENCODING 246 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 8 0 0 -BITMAP -50 -00 -70 -88 -88 -88 -88 -70 -ENDCHAR -STARTCHAR divide -ENCODING 247 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 5 0 2 -BITMAP -20 -00 -F8 -00 -20 -ENDCHAR -STARTCHAR ugrave -ENCODING 249 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 8 0 0 -BITMAP -40 -20 -88 -88 -88 -88 -88 -78 -ENDCHAR -STARTCHAR uacute -ENCODING 250 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 8 0 0 -BITMAP -10 -20 -88 -88 -88 -88 -88 -78 -ENDCHAR -STARTCHAR ucircumflex -ENCODING 251 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -50 -00 -88 -88 -88 -88 -88 -78 -ENDCHAR -STARTCHAR udieresis -ENCODING 252 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 8 0 0 -BITMAP -50 -00 -88 -88 -88 -88 -88 -78 -ENDCHAR -STARTCHAR yacute -ENCODING 253 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 10 0 -1 -BITMAP -10 -20 -00 -88 -88 -50 -50 -20 -20 -C0 -ENDCHAR -STARTCHAR thorn -ENCODING 254 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 -1 -BITMAP -80 -80 -F0 -88 -88 -88 -F0 -80 -80 -ENDCHAR -STARTCHAR ydieresis -ENCODING 255 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 -1 -BITMAP -50 -00 -88 -88 -50 -50 -20 -20 -C0 -ENDCHAR -STARTCHAR OE -ENCODING 338 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 9 0 0 -BITMAP -6E -90 -90 -90 -9E -90 -90 -90 -6E -ENDCHAR -STARTCHAR oe -ENCODING 339 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 7 6 0 0 -BITMAP -6C -92 -9E -90 -90 -6E -ENDCHAR -STARTCHAR uni05C8 -ENCODING 1480 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -3E00 -7F00 -F780 -EB80 -EB80 -C180 -DD80 -7F00 -3E00 -ENDCHAR -STARTCHAR uni05C9 -ENCODING 1481 -SWIDTH 1000 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -3E00 -7F00 -C380 -DD80 -C380 -DD80 -C380 -7F00 -3E00 -ENDCHAR -STARTCHAR uni05CA -ENCODING 1482 -SWIDTH 1000 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -3E00 -7F00 -DD80 -EB80 -F780 -EB80 -DD80 -7F00 -3E00 -ENDCHAR -STARTCHAR uni05CB -ENCODING 1483 -SWIDTH 1000 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -3E00 -7F00 -DD80 -EB80 -F780 -F780 -F780 -7F00 -3E00 -ENDCHAR -STARTCHAR uni05CC -ENCODING 1484 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -1F80 -3F80 -6F80 -EF80 -EF80 -EF80 -E180 -FF80 -FF80 -ENDCHAR -STARTCHAR uni05CD -ENCODING 1485 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 9 0 0 -BITMAP -FC00 -FE00 -C300 -DD80 -C380 -DB80 -DD80 -FF80 -FF80 -ENDCHAR -STARTCHAR uni05CE -ENCODING 1486 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 7 5 1 2 -BITMAP -6E -84 -44 -24 -C4 -ENDCHAR -STARTCHAR uni05CF -ENCODING 1487 -SWIDTH 875 0 -DWIDTH 14 0 -BBX 11 5 1 2 -BITMAP -6E80 -8880 -4C80 -2880 -CEE0 -ENDCHAR -STARTCHAR quotedblleft -ENCODING 8220 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 2 0 7 -BITMAP -50 -A0 -ENDCHAR -STARTCHAR quotedblright -ENCODING 8221 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 2 0 7 -BITMAP -50 -A0 -ENDCHAR -STARTCHAR bullet -ENCODING 8226 -SWIDTH 312 0 -DWIDTH 5 0 -BBX 4 4 0 2 -BITMAP -60 -F0 -F0 -60 -ENDCHAR -STARTCHAR ellipsis -ENCODING 8230 -SWIDTH 500 0 -DWIDTH 8 0 -BBX 5 1 0 0 -BITMAP -A8 -ENDCHAR -STARTCHAR Euro -ENCODING 8364 -SWIDTH 437 0 -DWIDTH 7 0 -BBX 6 9 0 0 -BITMAP -18 -24 -40 -F0 -40 -F0 -40 -24 -18 -ENDCHAR -STARTCHAR trademark -ENCODING 8482 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 4 0 5 -BITMAP -E880 -4D80 -4A80 -4880 -ENDCHAR -STARTCHAR arrowleft -ENCODING 8592 -SWIDTH 625 0 -DWIDTH 10 0 -BBX 9 5 0 2 -BITMAP -2000 -4000 -FF80 -4000 -2000 -ENDCHAR -STARTCHAR arrowup -ENCODING 8593 -SWIDTH 375 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -70 -A8 -20 -20 -20 -20 -20 -20 -ENDCHAR -STARTCHAR arrowright -ENCODING 8594 -SWIDTH 1000 0 -DWIDTH 10 0 -BBX 9 5 0 2 -BITMAP -0200 -0100 -FF80 -0100 -0200 -ENDCHAR -STARTCHAR arrowdown -ENCODING 8595 -SWIDTH 1000 0 -DWIDTH 6 0 -BBX 5 9 0 0 -BITMAP -20 -20 -20 -20 -20 -20 -A8 -70 -20 -ENDCHAR -ENDFONT diff --git a/source/font/README.txt b/source/font/README.txt deleted file mode 100644 index c417cb8..0000000 --- a/source/font/README.txt +++ /dev/null @@ -1,40 +0,0 @@ -In this directory, you will find the source file for the main font used by -CATSFC. It's an Adobe BDF file, which is fed into the emulator when running -in "font dump" mode to produce a more efficient representation in an "ODF" -format. The font is based on the one used by Pictochat, with a few more -characters that Pictochat does not have (but no Japanese characters). - -You can edit the font in an application that reads BDF bitmap fonts, such as -FontForge. Open the font in the application then export it again as BDF. -One case where you would want to do this is to add new glyphs to support a -new language. - -To include the more efficient representation (ODF) in CATSFC/system after -editing the BDF file: - - 1. If your font added characters beyond U+2193 DOWNWARDS ARROW, adjust the - maximum codepoint in source/nds/bdf_font.c, after the first instance of - > #ifndef HAVE_ODF - 2. In source/nds/bdf_font.c, - > #define DUMP_ODF - and - > // #define HAVE_ODF - This will make the plugin read the BDF source and write an ODF file. - 3. make - 4. Copy the new plugin to your card, under /_dstwoplug. - 5. Copy the .bdf file to your card, under /CATSFC/system, as Pictochat-16.bdf. - 6. Run the plugin on the Supercard DSTWO. It will briefly load, then display - "Font library initialisation error -1, press any key to exit". This is - because it tries to load the Chinese font's source, Song.bdf, which you - don't have. Regardless, it does dump an ODF file for Pictochat-16.bdf. - 7. Copy the .odf font somewhere on your hard drive if you want to keep a copy - of it. Delete the .bdf file from your card. - 8. Reverse the changes made in step 2. - 9. make -10. Copy the new plugin to your card, under /_dstwoplug. - -And you can use your new font! - -Finally, you may want to send your .bdf source file to a CATSFC developer -or commit it to a fork on Github, for inclusion in the plugin. You may also -want to send your changes to CATSFC/system/language.msg for the same reason.
\ No newline at end of file diff --git a/source/images/applications-system.svg b/source/images/applications-system.svg deleted file mode 100644 index 9d76774..0000000 --- a/source/images/applications-system.svg +++ /dev/null @@ -1,247 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="48.000000px" - height="48.000000px" - id="svg53383" - sodipodi:version="0.32" - inkscape:version="0.46" - sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/categories" - sodipodi:docname="applications-system.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape"> - <defs - id="defs3"> - <inkscape:perspective - sodipodi:type="inkscape:persp3d" - inkscape:vp_x="0 : 24 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_z="48 : 24 : 1" - inkscape:persp3d-origin="24 : 16 : 1" - id="perspective31" /> - <linearGradient - id="linearGradient3264"> - <stop - style="stop-color:#c9c9c9;stop-opacity:1;" - offset="0" - id="stop3266" /> - <stop - id="stop3276" - offset="0.25" - style="stop-color:#f8f8f8;stop-opacity:1;" /> - <stop - id="stop3272" - offset="0.5" - style="stop-color:#e2e2e2;stop-opacity:1;" /> - <stop - style="stop-color:#b0b0b0;stop-opacity:1;" - offset="0.75" - id="stop3274" /> - <stop - style="stop-color:#c9c9c9;stop-opacity:1;" - offset="1" - id="stop3268" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient3264" - id="linearGradient3281" - gradientUnits="userSpaceOnUse" - x1="14.462892" - y1="12.284524" - x2="34.534348" - y2="39.684914" - gradientTransform="matrix(1.241935,0,0,1.241935,-5.027508,-7.208988)" /> - <linearGradient - id="linearGradient2300"> - <stop - id="stop2302" - offset="0.0000000" - style="stop-color:#000000;stop-opacity:0.32673267;" /> - <stop - id="stop2304" - offset="1" - style="stop-color:#000000;stop-opacity:0;" /> - </linearGradient> - <linearGradient - id="aigrd1" - gradientUnits="userSpaceOnUse" - x1="99.7773" - y1="15.4238" - x2="153.0005" - y2="248.6311"> - <stop - offset="0" - style="stop-color:#184375" - id="stop53300" /> - <stop - offset="1" - style="stop-color:#C8BDDC" - id="stop53302" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - xlink:href="#aigrd1" - id="linearGradient53551" - gradientUnits="userSpaceOnUse" - x1="99.7773" - y1="15.4238" - x2="153.0005" - y2="248.6311" - gradientTransform="matrix(0.200685,0.000000,0.000000,0.200685,-0.585758,-1.050787)" /> - <radialGradient - gradientUnits="userSpaceOnUse" - r="11.689870" - fy="72.568001" - fx="14.287618" - cy="68.872971" - cx="14.287618" - gradientTransform="matrix(1.399258,-2.234445e-7,8.196178e-8,0.513264,4.365074,4.839285)" - id="radialGradient2308" - xlink:href="#linearGradient2300" - inkscape:collect="always" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient3264" - id="linearGradient3760" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1.241935,0,0,1.241935,-5.027508,-7.208988)" - x1="14.462892" - y1="12.284524" - x2="34.534348" - y2="39.684914" /> - <linearGradient - inkscape:collect="always" - xlink:href="#aigrd1" - id="linearGradient3773" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(0.200685,0,0,0.200685,-54.33576,-1.050787)" - x1="99.7773" - y1="15.4238" - x2="153.0005" - y2="248.6311" /> - </defs> - <sodipodi:namedview - inkscape:showpageshadow="false" - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="0.11764706" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="5.6568542" - inkscape:cx="43.652227" - inkscape:cy="21.164787" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:window-width="872" - inkscape:window-height="697" - inkscape:window-x="562" - inkscape:window-y="151" /> - <metadata - id="metadata4"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title>System Applications</dc:title> - <dc:creator> - <cc:Agent> - <dc:title>Jakub Steiner</dc:title> - </cc:Agent> - </dc:creator> - <dc:source>http://jimmac.musichall.cz/</dc:source> - <dc:subject> - <rdf:Bag> - <rdf:li>system</rdf:li> - <rdf:li>applications</rdf:li> - <rdf:li>group</rdf:li> - <rdf:li>category</rdf:li> - <rdf:li>admin</rdf:li> - <rdf:li>root</rdf:li> - </rdf:Bag> - </dc:subject> - <cc:license - rdf:resource="http://creativecommons.org/licenses/publicdomain/" /> - </cc:Work> - <cc:License - rdf:about="http://creativecommons.org/licenses/publicdomain/"> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Reproduction" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Distribution" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> - </cc:License> - </rdf:RDF> - </metadata> - <g - inkscape:label="shadow" - id="layer2" - inkscape:groupmode="layer"> - <path - transform="matrix(1.186380,0.000000,0.000000,1.186380,-4.539687,-7.794678)" - d="M 44.285715 38.714287 A 19.928572 9.8372450 0 1 1 4.4285717,38.714287 A 19.928572 9.8372450 0 1 1 44.285715 38.714287 z" - sodipodi:ry="9.8372450" - sodipodi:rx="19.928572" - sodipodi:cy="38.714287" - sodipodi:cx="24.357143" - id="path1538" - style="color:#000000;fill:url(#radialGradient2308);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:0.50000042;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" - sodipodi:type="arc" /> - </g> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <path - inkscape:r_cy="true" - inkscape:r_cx="true" - style="opacity:1;color:#000000;fill:url(#linearGradient3773);fill-opacity:1;fill-rule:nonzero;stroke:#3f4561;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 22.699525,0.94746963 C 22.22635,0.97984519 21.766437,1.0531317 21.301673,1.1063165 L 21.269903,1.1063165 L 20.157975,7.1742671 C 18.345621,7.5870046 16.640562,8.2874574 15.106644,9.2392765 L 10.118853,5.6493371 C 8.770521,6.6961412 7.543552,7.9170049 6.465374,9.2392765 L 9.928236,14.290607 C 8.876814,15.89739 8.086153,17.732094 7.640841,19.659632 C 7.640765,19.668743 7.640779,19.689813 7.640841,19.691401 L 1.60466,20.644482 C 1.494303,21.545851 1.445813,22.477386 1.445813,23.408418 C 1.445813,24.170171 1.466846,24.921747 1.541121,25.664043 L 7.577303,26.744202 C 8.0066,28.840363 8.822112,30.797987 9.960006,32.526228 L 6.370066,37.450482 C 7.398201,38.726866 8.585171,39.888962 9.864698,40.913343 L 14.947798,37.418712 C 16.724273,38.551956 18.707343,39.346604 20.856901,39.737877 L 21.809983,45.742288 C 22.487237,45.803935 23.181758,45.805827 23.874992,45.805827 C 24.853677,45.805826 25.788512,45.768738 26.734236,45.64698 L 27.877933,39.515491 C 29.91886,39.007587 31.836112,38.126493 33.501113,36.942172 L 38.393596,40.500342 C 39.662366,39.420897 40.822583,38.180154 41.824689,36.846863 L 38.266519,31.700225 C 39.230125,30.036028 39.897817,28.199859 40.23622,26.235892 L 46.240632,25.282811 C 46.29329,24.656221 46.30417,24.048546 46.30417,23.408418 C 46.30417,22.296018 46.174875,21.205317 46.018246,20.136172 L 39.918526,19.024244 C 39.440518,17.259164 38.656214,15.612364 37.662901,14.13176 L 41.25284,9.2075071 C 40.140075,7.8466524 38.870718,6.5895264 37.472284,5.5222596 L 32.293876,9.0804296 C 30.805549,8.200202 29.203897,7.5248159 27.464931,7.1424978 L 26.51185,1.1063165 C 25.644369,1.0042729 24.769749,0.94746963 23.874992,0.94746963 C 23.633166,0.94746964 23.384286,0.93986063 23.144296,0.94746963 C 23.027301,0.95117908 22.911525,0.94066346 22.794833,0.94746963 C 22.763228,0.94931296 22.73107,0.94531125 22.699525,0.94746963 z M 23.525529,16.387386 C 23.641592,16.381497 23.757473,16.387386 23.874992,16.387386 C 27.635598,16.387386 30.705408,19.457196 30.705408,23.217802 C 30.705409,26.978407 27.635597,30.016448 23.874992,30.016448 C 20.114387,30.016449 17.076346,26.978407 17.076346,23.217802 C 17.076347,19.574716 19.927558,16.569963 23.525529,16.387386 z " - id="path3243" /> - <path - inkscape:r_cy="true" - inkscape:r_cx="true" - sodipodi:type="arc" - style="opacity:0.64772728;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.62180054;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="path3283" - sodipodi:cx="23.511301" - sodipodi:cy="23.781593" - sodipodi:rx="12.727922" - sodipodi:ry="12.727922" - d="M 36.239223 23.781593 A 12.727922 12.727922 0 1 1 10.783379,23.781593 A 12.727922 12.727922 0 1 1 36.239223 23.781593 z" - transform="matrix(0.616598,0,0,0.616598,9.38202,8.539674)" /> - <path - inkscape:r_cy="true" - inkscape:r_cx="true" - id="path3285" - d="M 21.995808,2.1484671 L 21.103024,8.0235243 C 19.404254,8.4103946 16.279442,9.5936035 14.841657,10.485771 L 10.091975,6.9406268 C 8.828145,7.9218257 8.741474,7.9883656 7.730867,9.2277688 L 11.165063,14.320988 C 10.179537,15.827071 8.995796,18.510982 8.570778,20.42893 C 8.570778,20.42893 2.552988,21.443355 2.552988,21.443355 C 2.449547,22.288234 2.49926,24.096528 2.56888,24.792303 L 8.317097,25.82782 C 8.71949,27.79261 10.225324,30.955232 11.291904,32.575161 L 7.656902,37.377719 C 8.620601,38.57411 8.813474,38.683589 10.01281,39.64377 L 14.873441,36.082733 C 16.538581,37.144954 19.84373,38.437109 21.858571,38.80386 L 22.656299,44.604952 C 23.291109,44.662736 25.044829,44.824827 25.931283,44.710701 L 26.824066,38.671821 C 28.737084,38.195749 32.042539,36.838896 33.603191,35.728798 L 38.458624,39.236958 C 39.647878,38.225166 39.658533,38.072709 40.597835,36.822978 L 36.999815,31.708667 C 37.90303,30.148767 39.070902,27.098068 39.388097,25.257187 L 45.279046,24.279744 C 45.328399,23.692424 45.330802,22.054578 45.18399,21.052439 L 39.182092,20.016922 C 38.73404,18.362463 37.196418,15.381153 36.265359,13.993342 L 40.080075,9.1907857 C 39.037052,7.915218 38.64924,7.7402002 37.338448,6.7398212 L 32.313994,10.337839 C 30.918941,9.5127782 28.137095,8.2550417 26.507114,7.8966842 L 25.619528,2.1484671 C 24.806414,2.0528187 22.460488,2.0952921 21.995808,2.1484671 z " - style="opacity:0.34659089;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.99999923;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc" /> - <path - style="opacity:0.5;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 10.102903,6.2970655 C 8.7545689,7.3438694 8.1656464,7.9719226 7.0874684,9.2941942 L 10.489927,14.259153 C 9.4385072,15.857755 8.3316275,18.426114 8.1423859,19.987706 C 8.1423859,19.987706 2.0798859,21.0319 2.0798859,21.0319 C 2.0109129,21.595256 1.90625,22.884803 1.90625,22.884803 L 2.0830267,24.447303 C 2.5107567,24.535638 2.9231817,24.617818 3.3642767,24.666053 L 3.8642767,23.134803 C 4.2083177,23.163279 4.5439297,23.197303 4.8955267,23.197303 C 5.2467347,23.197303 5.6139847,23.163473 5.9580267,23.134803 L 6.4267767,24.666053 C 6.8680647,24.617818 7.3115487,24.535638 7.7392767,24.447303 L 7.7392767,22.884803 C 8.4250337,22.72518 9.0712777,22.497045 9.7080267,22.228553 L 10.645527,23.509803 C 11.047878,23.327709 11.421123,23.133984 11.801777,22.916053 L 11.301777,21.416053 C 11.89901,21.053803 12.463529,20.620706 12.989277,20.166053 L 14.270527,21.103553 C 14.596162,20.806973 14.91164,20.491691 15.208027,20.166053 L 14.270527,18.916053 C 14.725373,18.390305 15.127027,17.826171 15.489277,17.228553 L 16.989277,17.697303 C 17.207208,17.316456 17.432571,16.943209 17.614277,16.541053 L 16.333027,15.603553 C 16.601517,14.966804 16.798016,14.320561 16.958027,13.634803 L 18.551777,13.634803 C 18.640112,13.207076 18.691236,12.763591 18.739277,12.322303 L 17.239277,11.853553 C 17.268139,11.509705 17.301777,11.142456 17.301777,10.791053 C 17.301776,10.43965 17.267753,10.104039 17.239277,9.7598034 L 18.739277,9.2910534 C 18.69373,8.8711662 18.633686,8.4490548 18.551777,8.0410534 C 17.404349,8.4403544 15.999117,9.1941729 14.983265,9.8245243 L 10.102903,6.2970655 z " - id="path3767" - inkscape:r_cx="true" - inkscape:r_cy="true" - sodipodi:nodetypes="cccccccccsccccccccccccccccccccsccccc" /> - <path - style="opacity:0.5;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 37.236641,17.217754 C 36.85286,17.39913 36.490003,17.603509 36.123236,17.813295 L 36.692886,19.548136 C 35.995792,19.970436 35.338156,20.467825 34.725008,20.998151 L 33.249099,19.910639 C 32.869013,20.256538 32.507327,20.618223 32.161588,20.998151 L 33.249099,22.474059 C 32.718773,23.087371 32.221547,23.745002 31.799084,24.441937 L 31.255328,24.260685 C 31.207646,24.960968 31.018949,25.62217 30.737466,26.228563 L 30.841038,26.306242 C 30.527881,27.048922 30.27649,27.83664 30.090137,28.636624 L 28.614229,28.636624 C 28.477946,28.722076 28.343676,28.821684 28.199938,28.895555 C 28.121568,29.310822 28.065026,29.712881 28.018687,30.138426 L 29.77942,30.708074 C 29.746033,31.10935 29.727633,31.515269 29.727633,31.925052 C 29.727631,32.334993 29.746034,32.740753 29.77942,33.142029 L 28.018687,33.711677 C 28.074705,34.226432 28.148678,34.740347 28.251725,35.239372 L 30.090137,35.213479 C 30.218255,35.763466 30.393202,36.320918 30.582107,36.844746 C 31.327023,36.557466 32.05594,36.214561 32.731236,35.809021 C 32.319649,34.59298 32.083908,33.279913 32.083908,31.925052 C 32.083909,26.727119 35.376289,22.288397 39.981313,20.583861 L 38.893802,20.402608 C 38.671014,19.579946 38.382478,18.774017 38.013435,18.020441 C 38.002581,17.998277 37.99851,17.96486 37.987542,17.942761 L 37.935756,17.890975 L 37.236641,17.217754 z " - id="path3770" - inkscape:r_cx="true" - inkscape:r_cy="true" /> - </g> -</svg> diff --git a/source/images/boot.psd b/source/images/boot.psd Binary files differdeleted file mode 100644 index fe168aa..0000000 --- a/source/images/boot.psd +++ /dev/null diff --git a/source/images/catsfc.psd b/source/images/catsfc.psd Binary files differdeleted file mode 100644 index 420bb03..0000000 --- a/source/images/catsfc.psd +++ /dev/null diff --git a/source/images/hotkeys-preview.psd b/source/images/hotkeys-preview.psd Binary files differdeleted file mode 100644 index a718ab9..0000000 --- a/source/images/hotkeys-preview.psd +++ /dev/null diff --git a/source/images/interface-preview.psd b/source/images/interface-preview.psd Binary files differdeleted file mode 100644 index ec26be0..0000000 --- a/source/images/interface-preview.psd +++ /dev/null diff --git a/source/images/key.svg b/source/images/key.svg deleted file mode 100644 index 0fc1678..0000000 --- a/source/images/key.svg +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="210mm" height="297mm" id="svg2" version="1.1" inkscape:version="0.48.0 r9654"> - <defs id="defs4"> - <linearGradient inkscape:collect="always" id="linearGradient3813"> - <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3815"/> - <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3817"/> - </linearGradient> - <linearGradient inkscape:collect="always" id="linearGradient3784"> - <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3786"/> - <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3788"/> - </linearGradient> - <linearGradient inkscape:collect="always" id="linearGradient3774"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3776"/> - <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3778"/> - </linearGradient> - <linearGradient inkscape:collect="always" id="linearGradient3821"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3823"/> - <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3825"/> - </linearGradient> - <linearGradient inkscape:collect="always" id="linearGradient3809"> - <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3811"/> - <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3813"/> - </linearGradient> - <linearGradient inkscape:collect="always" id="linearGradient3796"> - <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3798"/> - <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3800"/> - </linearGradient> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3796" id="linearGradient3802" x1="491.42859" y1="533.79071" x2="397.14282" y2="612.36218" gradientUnits="userSpaceOnUse" gradientTransform="translate(-8.5714286,12.857143)"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3809" id="linearGradient3817" x1="451.4375" y1="387.35266" x2="70" y2="264.49554" gradientUnits="userSpaceOnUse"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3821" id="linearGradient3827" x1="291.02759" y1="456.15002" x2="559.2226" y2="784.44958" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.83333333,0,0,0.89559246,41.428572,48.08126)"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3774" id="linearGradient3780" x1="154.54454" y1="316.20752" x2="339.69678" y2="375.80652" gradientUnits="userSpaceOnUse"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3784" id="linearGradient3790" x1="310.11683" y1="619.51182" x2="492.95444" y2="619.51182" gradientUnits="userSpaceOnUse"/> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3813" id="radialGradient3819" cx="162.63455" cy="473.54477" fx="162.63455" fy="473.54477" r="403.05087" gradientTransform="matrix(1,0,0,0.23308269,0,363.16968)" gradientUnits="userSpaceOnUse"/> - <filter inkscape:collect="always" id="filter3821" x="-0.041358053" width="1.0827161" y="-0.1774394" height="1.3548788"> - <feGaussianBlur inkscape:collect="always" stdDeviation="13.891166" id="feGaussianBlur3823"/> - </filter> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3784" id="linearGradient5873" gradientUnits="userSpaceOnUse" x1="310.11683" y1="619.51182" x2="492.95444" y2="619.51182"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3774" id="linearGradient5876" gradientUnits="userSpaceOnUse" x1="154.54454" y1="316.20752" x2="339.69678" y2="375.80652"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3821" id="linearGradient5879" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.83333333,0,0,0.89559246,41.428572,48.08126)" x1="291.02759" y1="456.15002" x2="559.2226" y2="784.44958"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3809" id="linearGradient5882" gradientUnits="userSpaceOnUse" x1="451.4375" y1="387.35266" x2="70" y2="264.49554"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3796" id="linearGradient5885" gradientUnits="userSpaceOnUse" gradientTransform="translate(-8.5714286,12.857143)" x1="491.42859" y1="533.79071" x2="397.14282" y2="612.36218"/> - </defs> - <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="183.47351" inkscape:cy="630.2247" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" showguides="true" inkscape:guide-bbox="true" inkscape:snap-global="false" inkscape:window-width="1271" inkscape:window-height="702" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0"> - <sodipodi:guide orientation="0,1" position="-237.14286,948.57143" id="guide2987"/> - <sodipodi:guide orientation="0,1" position="-182.85714,234.28571" id="guide2989"/> - <sodipodi:guide orientation="1,0" position="11.428571,157.14286" id="guide2993"/> - <sodipodi:guide orientation="1,0" position="725.71429,345.71429" id="guide2995"/> - </sodipodi:namedview> - <metadata id="metadata7"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> - <dc:title>key</dc:title> - <dc:date>Mar 2011</dc:date> - <dc:creator> - <cc:Agent> - <dc:title>Franziska Sponsel</dc:title> - </cc:Agent> - </dc:creator> - <dc:rights> - <cc:Agent> - <dc:title>Franziska Sponsel</dc:title> - </cc:Agent> - </dc:rights> - <dc:publisher> - <cc:Agent> - <dc:title>RRZE</dc:title> - </cc:Agent> - </dc:publisher> - <dc:subject> - <rdf:Bag> - <rdf:li>key</rdf:li> - <rdf:li>lock</rdf:li> - <rdf:li>chain</rdf:li> - <rdf:li>secure</rdf:li> - <rdf:li>save</rdf:li> - </rdf:Bag> - </dc:subject> - <dc:contributor> - <cc:Agent> - <dc:title>Beate Kaspar, Hendrik Eggers</dc:title> - </cc:Agent> - </dc:contributor> - <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"/> - </cc:Work> - <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"> - <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/> - <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/> - <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/> - </cc:License> - </rdf:RDF> - </metadata> - <g inkscape:label="Ebene 1" inkscape:groupmode="layer" id="layer1"> - <g id="g6659"> - <path transform="matrix(0.78703889,0,0,0.50001477,250.80749,512.53703)" d="m 565.68542,473.54477 a 403.05087,93.944183 0 1 1 -806.10174,0 403.05087,93.944183 0 1 1 806.10174,0 z" sodipodi:ry="93.944183" sodipodi:rx="403.05087" sodipodi:cy="473.54477" sodipodi:cx="162.63455" id="path3811" style="opacity:0.67295598;fill:url(#radialGradient3819);fill-opacity:1;stroke:none;filter:url(#filter3821)" sodipodi:type="arc"/> - <rect y="103.79076" x="11.428572" height="714.28571" width="714.28571" id="rect2985" style="fill:none;stroke:none"/> - <path sodipodi:nodetypes="ssscccccccccccccccccccccsssssss" inkscape:connector-curvature="0" id="path3765" d="m 240,189.5 c -88.36556,0 -160,71.63444 -160,160 0,74.01072 51.08528,133.42284 118.49765,154.56619 28.76063,9.02054 65.10031,3.78277 68.69777,4.48537 l -18.56502,21.66877 27.05314,3.51253 -10.31899,28.23625 44.73064,0.86845 -17.84433,26.01022 39.2217,-4.21803 -5.11585,27.44772 28.42454,-6.4704 17.77455,40.78089 37.64027,23.35189 -28.57265,31.19477 c 2.02311,1.37812 44.72926,6.83324 44.72926,6.83324 l -0.24554,28.95536 21.34376,14.22767 30.60714,3.37947 57.55357,-33.66518 0.25,-46.66072 -112.44643,-175.66964 -3.75893,-37.17411 -35.42857,-33.07589 C 387.0643,416.159 401.42857,396.57961 400,349.5 c -2.68011,-88.32491 -71.63444,-160 -160,-160 z m -24.28125,75.71875 c 23.66935,0 42.84375,19.1744 42.84375,42.84375 0,23.66935 -19.1744,42.875 -42.84375,42.875 -23.66935,0 -42.875,-19.20565 -42.875,-42.875 0,-23.66935 19.20565,-42.84375 42.875,-42.84375 z" style="fill:#c4a000;stroke:#000000;stroke-width:13;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> - <path sodipodi:nodetypes="ccccccc" inkscape:connector-curvature="0" id="path3792" d="M 351.42857,468.07647 368.57142,500.93361 490,685.21932 514.28571,713.79075 507.14285,682.36218 382.85714,488.07646 z" style="fill:#ffffff;fill-opacity:1;stroke:none;opacity:0.59433962"/> - <path style="opacity:0.66465411;fill:url(#linearGradient5885);fill-opacity:1;stroke:none" d="m 351.42858,468.07647 17.14285,32.85714 121.42858,184.28571 24.28571,28.57143 -15.22408,-29.91334 -121.76033,-187.21465 z" id="path3794" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccc"/> - <path id="path3804" d="m 240.71875,209.5 c -76.92538,0 -139.28125,62.35587 -139.28125,139.28125 0,76.92538 62.35587,139.28125 139.28125,139.28125 C 317.64413,488.0625 380,425.70663 380,348.78125 380,271.85587 317.64413,209.5 240.71875,209.5 z m -26.4375,58.5625 c 21.30241,0 38.5625,17.29134 38.5625,38.59375 0,21.30241 -17.26009,38.5625 -38.5625,38.5625 -21.30241,0 -38.5625,-17.26009 -38.5625,-38.5625 0,-21.30241 17.26009,-38.59375 38.5625,-38.59375 z" style="opacity:0.61320759;fill:url(#linearGradient5882);fill-opacity:1;stroke:none" inkscape:connector-curvature="0"/> - <path sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" id="path3819" d="m 248.57143,495.43421 c 30.96868,0.78722 47.28356,9.8516 87.07517,-24.91902 l 162.92482,249.68882 -14.88154,11.71002 C 434.27974,660.85127 361.25763,568.58045 309.22589,502.82691 c -30.07132,13.01986 -37.53909,-0.11886 -60.65446,-7.3927 z" style="opacity:0.7295598;fill:url(#linearGradient5879);fill-opacity:1;stroke:none"/> - <path sodipodi:nodetypes="czczc" inkscape:connector-curvature="0" id="path3772" d="m 164.65486,306.86961 c 0,0 10.21318,55.82918 60.60915,48.48731 50.39597,-7.34186 37.37565,-70.71067 37.37565,-70.71067 0,0 23.33506,78.18103 -38.3858,84.85282 -61.72087,6.67179 -59.599,-62.62946 -59.599,-62.62946 z" style="opacity:0.59748427;fill:url(#linearGradient5876);fill-opacity:1;stroke:none"/> - <path sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" id="path3782" d="m 310.11683,504.8595 6.06092,36.36549 139.40105,174.7564 27.27412,18.18274 3.03045,-4.04061 z" style="opacity:0.5251572;fill:url(#linearGradient5873);fill-opacity:1;stroke:none"/> - </g> - </g> -</svg> diff --git a/source/images/manage.svg b/source/images/manage.svg deleted file mode 100644 index 063dd65..0000000 --- a/source/images/manage.svg +++ /dev/null @@ -1,391 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" height="297mm" id="svg2" inkscape:export-xdpi="76.235291" inkscape:export-ydpi="76.235291" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.48.0 r9654" sodipodi:version="0.32" width="290mm" version="1.1"> - <title id="title12945">manage</title> - <defs id="defs4"> - <inkscape:perspective id="perspective14608" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" inkscape:vp_x="0 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="744.09448 : 526.18109 : 1" sodipodi:type="inkscape:persp3d"/> - <linearGradient id="linearGradient2265"> - <stop id="stop2267" offset="0" style="stop-color:#000000;stop-opacity:1;"/> - <stop id="stop2269" offset="1" style="stop-color:#000000;stop-opacity:0;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1021.3138,469.27875)" gradientUnits="userSpaceOnUse" id="linearGradient2271" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/> - <linearGradient id="linearGradient2257" inkscape:collect="always"> - <stop id="stop2259" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop2261" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1020.7435,465.29004)" gradientUnits="userSpaceOnUse" id="linearGradient2263" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/> - <linearGradient id="linearGradient3087"> - <stop id="stop3089" offset="0" style="stop-color:#3465a4;stop-opacity:1;"/> - <stop id="stop3095" offset="0" style="stop-color:#729fcf;stop-opacity:1;"/> - <stop id="stop2242" offset="0" style="stop-color:#3465a4;stop-opacity:1;"/> - <stop id="stop2244" offset="0.75" style="stop-color:#729fcf;stop-opacity:1;"/> - <stop id="stop3091" offset="1" style="stop-color:#386eb4;stop-opacity:1;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient3093" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/> - <linearGradient id="linearGradient2250" inkscape:collect="always"> - <stop id="stop2252" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop2254" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/> - </linearGradient> - <linearGradient gradientTransform="translate(1019.1501,465.21085)" gradientUnits="userSpaceOnUse" id="linearGradient2256" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/> - <linearGradient id="linearGradient3077"> - <stop id="stop3079" offset="0" style="stop-color:#888a85;stop-opacity:1;"/> - <stop id="stop3081" offset="1" style="stop-color:#d3d7cf;stop-opacity:1;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.9976,470.79956)" gradientUnits="userSpaceOnUse" id="linearGradient3083" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/> - <linearGradient id="linearGradient3061"> - <stop id="stop3063" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop3065" offset="1" style="stop-color:#000000;stop-opacity:1;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(0.8782699,0,0,0.8782699,1049.7965,-403.53398)" gradientUnits="userSpaceOnUse" id="linearGradient3067" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/> - <linearGradient id="linearGradient3049"> - <stop id="stop3051" offset="0" style="stop-color:#888a85;stop-opacity:1;"/> - <stop id="stop2262" offset="0.5" style="stop-color:#d3d7cf;stop-opacity:1;"/> - <stop id="stop2264" offset="0.67612958" style="stop-color:#eeeeec;stop-opacity:1;"/> - <stop id="stop2268" offset="0.84051722" style="stop-color:#babdb6;stop-opacity:1;"/> - <stop id="stop2266" offset="0.875" style="stop-color:#d3d7cf;stop-opacity:1;"/> - <stop id="stop3053" offset="1" style="stop-color:#babdb6;stop-opacity:1;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient3055" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient3047" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <linearGradient id="linearGradient3041" inkscape:collect="always"> - <stop id="stop3043" offset="0" style="stop-color:#000000;stop-opacity:1;"/> - <stop id="stop3045" offset="1" style="stop-color:#000000;stop-opacity:0;"/> - </linearGradient> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2260" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <linearGradient gradientTransform="translate(131.91072,132.23618)" gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="43.944302" x2="411.3941" y1="733.39258" y2="425.06561"> - <stop id="stop2170" offset="0.0562" style="stop-color:#003F90"/> - <stop id="stop2172" offset="0.5674" style="stop-color:#0093D2"/> - <stop id="stop2174" offset="0.9551" style="stop-color:#EDF3F7"/> - </linearGradient> - <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="43.943802" x2="411.39359" y1="733.39258" y2="425.06561"> - <stop id="stop2179" offset="0.0562" style="stop-color:#2e3436;stop-opacity:1;"/> - <stop id="stop2181" offset="0.56739998" style="stop-color:#888a85;stop-opacity:1;"/> - <stop id="stop2183" offset="0.9551" style="stop-color:#d3d7cf;stop-opacity:1;"/> - </linearGradient> - <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient5020" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/> - <linearGradient gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" gradientUnits="userSpaceOnUse" id="linearGradient5016" inkscape:collect="always" x1="302.85715" x2="302.85715" xlink:href="#linearGradient5048" y1="366.64789" y2="609.50507"/> - <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient5013" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/> - <linearGradient id="linearGradient2795"> - <stop id="stop2797" offset="0.0000000" style="stop-color:#000000;stop-opacity:0.068627454;"/> - <stop id="stop2799" offset="1.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient2803"> - <stop id="stop2805" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop2807" offset="1.0000000" style="stop-color:#cbcbcb;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient2094"> - <stop id="stop2096" offset="0.0000000" style="stop-color:#d6e3f0;stop-opacity:1.0000000;"/> - <stop id="stop2098" offset="1.0000000" style="stop-color:#95b1cf;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient12512"> - <stop id="stop12513" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/> - <stop id="stop12517" offset="0.50000000" style="stop-color:#fff520;stop-opacity:0.89108908;"/> - <stop id="stop12514" offset="1.0000000" style="stop-color:#fff300;stop-opacity:0.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient5048"> - <stop id="stop5050" offset="0" style="stop-color:black;stop-opacity:0;"/> - <stop id="stop5056" offset="0.5" style="stop-color:black;stop-opacity:1;"/> - <stop id="stop5052" offset="1" style="stop-color:black;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient5060" inkscape:collect="always"> - <stop id="stop5062" offset="0" style="stop-color:black;stop-opacity:1;"/> - <stop id="stop5064" offset="1" style="stop-color:black;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient2994"> - <stop id="stop2996" offset="0" style="stop-color:#000000;stop-opacity:1;"/> - <stop id="stop2998" offset="1" style="stop-color:#c9c9c9;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient2974"> - <stop id="stop2976" offset="0" style="stop-color:#c1c1c1;stop-opacity:1;"/> - <stop id="stop2978" offset="1" style="stop-color:#acacac;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient2966"> - <stop id="stop2968" offset="0" style="stop-color:#ffd1d1;stop-opacity:1;"/> - <stop id="stop3006" offset="0.5" style="stop-color:#ff1d1d;stop-opacity:1;"/> - <stop id="stop2970" offset="1" style="stop-color:#6f0000;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient2846"> - <stop id="stop2848" offset="0.0000000" style="stop-color:#8a8a8a;stop-opacity:1.0000000;"/> - <stop id="stop2850" offset="1.0000000" style="stop-color:#484848;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient2366"> - <stop id="stop2368" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop2374" offset="0.50000000" style="stop-color:#ffffff;stop-opacity:0.21904762;"/> - <stop id="stop2370" offset="1.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient4467"> - <stop id="stop4469" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop4471" offset="1.0000000" style="stop-color:#ffffff;stop-opacity:0.24761905;"/> - </linearGradient> - <linearGradient id="linearGradient4454"> - <stop id="stop4456" offset="0.0000000" style="stop-color:#729fcf;stop-opacity:0.20784314;"/> - <stop id="stop4458" offset="1.0000000" style="stop-color:#729fcf;stop-opacity:0.67619050;"/> - </linearGradient> - <linearGradient id="linearGradient4440"> - <stop id="stop4442" offset="0" style="stop-color:#7d7d7d;stop-opacity:1;"/> - <stop id="stop4448" offset="0.50000000" style="stop-color:#b1b1b1;stop-opacity:1.0000000;"/> - <stop id="stop4444" offset="1.0000000" style="stop-color:#686868;stop-opacity:1.0000000;"/> - </linearGradient> - <radialGradient cx="24.306795" cy="42.07798" fx="24.306795" fy="42.07798" gradientTransform="matrix(1.000000,0.000000,0.000000,0.284916,0.000000,30.08928)" gradientUnits="userSpaceOnUse" id="radialGradient4548" inkscape:collect="always" r="15.821514" xlink:href="#linearGradient4542"/> - <linearGradient id="linearGradient259"> - <stop id="stop260" offset="0.0000000" style="stop-color:#fafafa;stop-opacity:1.0000000;"/> - <stop id="stop261" offset="1.0000000" style="stop-color:#bbbbbb;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient269"> - <stop id="stop270" offset="0.0000000" style="stop-color:#a3a3a3;stop-opacity:1.0000000;"/> - <stop id="stop271" offset="1.0000000" style="stop-color:#4c4c4c;stop-opacity:1.0000000;"/> - </linearGradient> - <radialGradient cx="20.8921" cy="114.5684" fx="20.8921" fy="114.5684" gradientUnits="userSpaceOnUse" id="aigrd2" r="5.256"> - <stop id="stop15566" offset="0" style="stop-color:#F0F0F0"/> - <stop id="stop15568" offset="1.0000000" style="stop-color:#9a9a9a;stop-opacity:1.0000000;"/> - </radialGradient> - <radialGradient cx="20.8921" cy="64.5679" fx="20.8921" fy="64.5679" gradientUnits="userSpaceOnUse" id="aigrd3" r="5.257"> - <stop id="stop15573" offset="0" style="stop-color:#F0F0F0"/> - <stop id="stop15575" offset="1.0000000" style="stop-color:#9a9a9a;stop-opacity:1.0000000;"/> - </radialGradient> - <linearGradient id="linearGradient15662"> - <stop id="stop15664" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/> - <stop id="stop15666" offset="1.0000000" style="stop-color:#f8f8f8;stop-opacity:1.0000000;"/> - </linearGradient> - <linearGradient id="linearGradient4542" inkscape:collect="always"> - <stop id="stop4544" offset="0" style="stop-color:#000000;stop-opacity:1;"/> - <stop id="stop4546" offset="1" style="stop-color:#000000;stop-opacity:0;"/> - </linearGradient> - <linearGradient gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" gradientUnits="userSpaceOnUse" id="linearGradient2659" inkscape:collect="always" x1="302.85715" x2="302.85715" xlink:href="#linearGradient5048" y1="366.64789" y2="609.50507"/> - <linearGradient id="linearGradient2651"> - <stop id="stop2653" offset="0" style="stop-color:black;stop-opacity:0;"/> - <stop id="stop2655" offset="0.5" style="stop-color:black;stop-opacity:1;"/> - <stop id="stop2657" offset="1" style="stop-color:black;stop-opacity:0;"/> - </linearGradient> - <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient2649" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/> - <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient2641" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient2408" inkscape:collect="always" x1="18.935766" x2="53.588622" xlink:href="#linearGradient2402" y1="23.667896" y2="26.649362"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient2386" inkscape:collect="always" x1="62.513836" x2="15.984863" xlink:href="#linearGradient2380" y1="36.061237" y2="20.60858"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient1501" inkscape:collect="always" x1="46.834816" x2="45.380436" xlink:href="#linearGradient2871" y1="45.264122" y2="50.939667"/> - <linearGradient id="linearGradient2831"> - <stop id="stop2833" offset="0" style="stop-color:#1d5e23;stop-opacity:1;"/> - <stop id="stop2855" offset="0.33333334" style="stop-color:#329652;stop-opacity:1;"/> - <stop id="stop2835" offset="1" style="stop-color:#83d8ab;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient2871" inkscape:collect="always"> - <stop id="stop2873" offset="0" style="stop-color:#3465a4;stop-opacity:1;"/> - <stop id="stop2875" offset="1" style="stop-color:#3465a4;stop-opacity:1"/> - </linearGradient> - <linearGradient id="linearGradient2380"> - <stop id="stop2382" offset="0" style="stop-color:#b9e7c9;stop-opacity:1;"/> - <stop id="stop2384" offset="1" style="stop-color:#72cf79;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient2402"> - <stop id="stop2404" offset="0" style="stop-color:#72cf7b;stop-opacity:1;"/> - <stop id="stop2406" offset="1" style="stop-color:#57c552;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient2682"> - <stop id="stop2684" offset="0" style="stop-color:#3977c3;stop-opacity:1;"/> - <stop id="stop2686" offset="1" style="stop-color:#89aedc;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient2690"> - <stop id="stop2692" offset="0" style="stop-color:#57be6f;stop-opacity:1;"/> - <stop id="stop2694" offset="1" style="stop-color:#c4ebca;stop-opacity:0;"/> - </linearGradient> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5903" inkscape:collect="always" x1="62.513836" x2="15.984863" xlink:href="#linearGradient2380" y1="36.061237" y2="20.60858"/> - <linearGradient gradientTransform="matrix(-6.0935847,-5.1483414,-5.1483414,6.0935847,846.16404,624.52042)" gradientUnits="userSpaceOnUse" id="linearGradient5908" inkscape:collect="always" x1="62.513836" x2="15.984863" xlink:href="#linearGradient2380" y1="36.061237" y2="20.60858"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient7848" inkscape:collect="always" x1="18.935766" x2="53.588622" xlink:href="#linearGradient2402" y1="23.667896" y2="26.649362"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient7850" inkscape:collect="always" x1="46.834816" x2="45.380436" xlink:href="#linearGradient2871" y1="45.264122" y2="50.939667"/> - <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9972" inkscape:collect="always" x1="28.244684" x2="28.244684" xlink:href="#linearGradient9910" y1="60.445503" y2="68.224884"/> - <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9968" inkscape:collect="always" x1="28.244684" x2="28.244684" xlink:href="#linearGradient9920" y1="60.445503" y2="68.224884"/> - <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9965" inkscape:collect="always" x1="28.244684" x2="28.244684" xlink:href="#linearGradient9910" y1="60.445503" y2="68.224884"/> - <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9961" inkscape:collect="always" x1="55.876038" x2="38.061356" xlink:href="#linearGradient9952" y1="62.401989" y2="62.827091"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient6401" inkscape:collect="always" x1="20.064156" x2="20.682873" xlink:href="#linearGradient6395" y1="27.140348" y2="44.110912"/> - <radialGradient cx="23.25" cy="37.75" fx="23.25" fy="37.75" gradientTransform="matrix(1,0,0,0.420168,0,21.88866)" gradientUnits="userSpaceOnUse" id="radialGradient6353" inkscape:collect="always" r="14.875" xlink:href="#linearGradient5048"/> - <linearGradient gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,48.6929,-14.14491)" gradientUnits="userSpaceOnUse" id="linearGradient6349" inkscape:collect="always" x1="25.71875" x2="25.514589" xlink:href="#linearGradient2994" y1="31.046875" y2="30.703125"/> - <radialGradient cx="29.053354" cy="27.640751" fx="29.053354" fy="27.640751" gradientTransform="matrix(1.53767e-2,2.923527,2.029691,-1.067544e-2,20.39098,-69.72665)" gradientUnits="userSpaceOnUse" id="radialGradient6347" inkscape:collect="always" r="3.2408545" xlink:href="#linearGradient2984"/> - <linearGradient gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,42.99552,-2.496241)" gradientUnits="userSpaceOnUse" id="linearGradient6345" inkscape:collect="always" x1="46" x2="47.6875" xlink:href="#linearGradient2974" y1="19.8125" y2="22.625"/> - <linearGradient gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,42.9955,-2.496241)" gradientUnits="userSpaceOnUse" id="linearGradient6343" inkscape:collect="always" x1="48.90625" x2="50.988335" xlink:href="#linearGradient2966" y1="17.376184" y2="22.250591"/> - <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5074" inkscape:collect="always" x1="11.75" x2="37.625" xlink:href="#linearGradient5068" y1="14.1875" y2="14.1875"/> - <linearGradient gradientTransform="translate(0,5.625)" gradientUnits="userSpaceOnUse" id="linearGradient5064" inkscape:collect="always" x1="30.875" x2="15.625" xlink:href="#linearGradient5058" y1="19.4596" y2="19.0846"/> - <radialGradient cx="23.25" cy="37.75" fx="23.25" fy="37.75" gradientTransform="matrix(1,0,0,0.420168,0,21.88866)" gradientUnits="userSpaceOnUse" id="radialGradient5054" inkscape:collect="always" r="14.875" xlink:href="#linearGradient5048"/> - <linearGradient gradientTransform="translate(0,5.625)" gradientUnits="userSpaceOnUse" id="linearGradient5042" inkscape:collect="always" x1="15.375" x2="34.250416" xlink:href="#linearGradient5036" y1="26.0846" y2="26.0846"/> - <linearGradient id="linearGradient5036"> - <stop id="stop5038" offset="0" style="stop-color:#f5f5f5;stop-opacity:0.09;"/> - <stop id="stop5044" offset="0.2631579" style="stop-color:#ffffff;stop-opacity:0.89999998;"/> - <stop id="stop5088" offset="0.74792242" style="stop-color:#c7c7c7;stop-opacity:0.46000001;"/> - <stop id="stop5040" offset="1" style="stop-color:#ffffff;stop-opacity:0.78039217;"/> - </linearGradient> - <linearGradient id="linearGradient5058"> - <stop id="stop5060" offset="0" style="stop-color:#959791;stop-opacity:1;"/> - <stop id="stop5066" offset="0.5" style="stop-color:#f8f8f8;stop-opacity:1;"/> - <stop id="stop3430" offset="1" style="stop-color:#8c8c8c;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient5068"> - <stop id="stop5070" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop5078" offset="0.32894737" style="stop-color:#ffffff;stop-opacity:0.69;"/> - <stop id="stop5076" offset="0.65789473" style="stop-color:#c2c2c2;stop-opacity:0.34;"/> - <stop id="stop5072" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient3414"> - <stop id="stop3416" offset="0" style="stop-color:#ffd1d1;stop-opacity:1;"/> - <stop id="stop3418" offset="0.5" style="stop-color:#ff1d1d;stop-opacity:1;"/> - <stop id="stop3420" offset="1" style="stop-color:#6f0000;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient3408"> - <stop id="stop3410" offset="0" style="stop-color:#c1c1c1;stop-opacity:1;"/> - <stop id="stop3412" offset="1" style="stop-color:#acacac;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient2984" inkscape:collect="always"> - <stop id="stop2986" offset="0" style="stop-color:#e7e2b8;stop-opacity:1;"/> - <stop id="stop2988" offset="1" style="stop-color:#e7e2b8;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient3399"> - <stop id="stop3401" offset="0" style="stop-color:#000000;stop-opacity:1;"/> - <stop id="stop3403" offset="1" style="stop-color:#c9c9c9;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient6395" inkscape:collect="always"> - <stop id="stop6397" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop6399" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient9910"> - <stop id="stop9912" offset="0" style="stop-color:#729fcf;stop-opacity:1;"/> - <stop id="stop9918" offset="0.31578946" style="stop-color:#a5bfda;stop-opacity:1;"/> - <stop id="stop9914" offset="1" style="stop-color:#376ca4;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient9920"> - <stop id="stop9922" offset="0" style="stop-color:#5b90c8;stop-opacity:1;"/> - <stop id="stop9924" offset="0.31578946" style="stop-color:#8fb0d1;stop-opacity:1;"/> - <stop id="stop9926" offset="1" style="stop-color:#34679d;stop-opacity:1;"/> - </linearGradient> - <linearGradient id="linearGradient9952" inkscape:collect="always"> - <stop id="stop9954" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop9956" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/> - </linearGradient> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2746" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2748" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient2750" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/> - <linearGradient gradientTransform="matrix(0.8782699,0,0,0.8782699,1049.7965,-403.53398)" gradientUnits="userSpaceOnUse" id="linearGradient2752" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.9976,470.79956)" gradientUnits="userSpaceOnUse" id="linearGradient2754" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/> - <linearGradient gradientTransform="translate(1019.1501,465.21085)" gradientUnits="userSpaceOnUse" id="linearGradient2756" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient2758" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/> - <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1020.7435,465.29004)" gradientUnits="userSpaceOnUse" id="linearGradient2760" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/> - <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1021.3138,469.27875)" gradientUnits="userSpaceOnUse" id="linearGradient2762" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2777" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2779" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient2781" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/> - <linearGradient gradientTransform="matrix(0.8782698,0,0,0.8782698,1879.0669,-455.80257)" gradientUnits="userSpaceOnUse" id="linearGradient2783" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1638.2097,1028.2081)" gradientUnits="userSpaceOnUse" id="linearGradient2785" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/> - <linearGradient gradientTransform="translate(1635.3622,1022.6194)" gradientUnits="userSpaceOnUse" id="linearGradient2787" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient2789" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/> - <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1636.9556,1022.6986)" gradientUnits="userSpaceOnUse" id="linearGradient2791" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/> - <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1637.5259,1026.6873)" gradientUnits="userSpaceOnUse" id="linearGradient2793" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/> - <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient14628" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/> - <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient144058" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient144060" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient144062" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144064" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/> - <linearGradient gradientTransform="matrix(0.8782698,0,0,0.8782698,1879.0669,-455.80257)" gradientUnits="userSpaceOnUse" id="linearGradient144066" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1638.2097,1028.2081)" gradientUnits="userSpaceOnUse" id="linearGradient144068" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/> - <linearGradient gradientTransform="translate(1635.3622,1022.6194)" gradientUnits="userSpaceOnUse" id="linearGradient144070" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144072" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/> - <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1636.9556,1022.6986)" gradientUnits="userSpaceOnUse" id="linearGradient144074" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/> - <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1637.5259,1026.6873)" gradientUnits="userSpaceOnUse" id="linearGradient144076" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144103" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/> - <linearGradient gradientTransform="matrix(0.8782698,0,0,0.8782698,1879.0669,-455.80257)" gradientUnits="userSpaceOnUse" id="linearGradient144105" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1638.2097,1028.2081)" gradientUnits="userSpaceOnUse" id="linearGradient144107" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/> - <linearGradient gradientTransform="translate(1635.3622,1022.6194)" gradientUnits="userSpaceOnUse" id="linearGradient144109" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/> - <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144111" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/> - <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1636.9556,1022.6986)" gradientUnits="userSpaceOnUse" id="linearGradient144113" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/> - <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1637.5259,1026.6873)" gradientUnits="userSpaceOnUse" id="linearGradient144115" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/> - <linearGradient gradientTransform="matrix(8.3498595,-0.1647314,0.1647314,8.3498595,9960.2178,4925.5768)" gradientUnits="userSpaceOnUse" id="linearGradient144118" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/> - <linearGradient gradientTransform="matrix(9.5779968,-0.2507077,0.2507077,9.5779968,9954.7948,4887.6482)" gradientUnits="userSpaceOnUse" id="linearGradient144122" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/> - <linearGradient gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" gradientUnits="userSpaceOnUse" id="linearGradient144127" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/> - <linearGradient gradientTransform="matrix(9.5090184,0,0,9.5090184,9939.6432,4886.8951)" gradientUnits="userSpaceOnUse" id="linearGradient144130" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/> - <linearGradient gradientTransform="matrix(8.3514856,0,0,8.3514856,9966.7201,4940.0381)" gradientUnits="userSpaceOnUse" id="linearGradient144133" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/> - <linearGradient gradientTransform="matrix(8.3514838,0,0,8.3514838,10487.711,-3691.9132)" gradientUnits="userSpaceOnUse" id="linearGradient144136" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/> - <linearGradient gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" gradientUnits="userSpaceOnUse" id="linearGradient144140" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/> - <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient144144" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/> - <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient144150" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3041" id="radialGradient12894" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" r="17.6875"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3049" id="linearGradient12896" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" x1="19.648342" y1="42.253601" x2="20.631224" y2="6.7758031"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3061" id="linearGradient12898" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.351484,0,0,8.351484,10487.711,-3691.9132)" x1="50.152931" y1="-3.6324477" x2="25.291086" y2="-4.3002653"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3077" id="linearGradient12900" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3514856,0,0,8.3514856,9966.7201,4940.0381)" x1="38.227654" y1="13.602527" x2="37.53537" y2="6.6285896"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient2250" id="linearGradient12902" gradientUnits="userSpaceOnUse" gradientTransform="matrix(9.5090184,0,0,9.5090184,9939.6432,4886.8951)" x1="31.177404" y1="19.821514" x2="40.859177" y2="9.6568537"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3087" id="linearGradient12904" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" x1="9.7503242" y1="32.28376" x2="16.915297" y2="39.443218"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient2257" id="linearGradient12906" gradientUnits="userSpaceOnUse" gradientTransform="matrix(9.5779968,-0.2507077,0.2507077,9.5779968,9954.7948,4887.6482)" x1="12.004697" y1="35.688461" x2="10.650805" y2="33.194965"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient2265" id="linearGradient12908" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3498595,-0.1647314,0.1647314,8.3498595,9960.2178,4925.5768)" x1="14.017542" y1="36.942543" x2="15.415793" y2="38.268368"/> - </defs> - <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="-277.41277" inkscape:cy="430.03335" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="756" inkscape:window-width="1276" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="0.43901235" pagecolor="#ffffff" showgrid="false" showguides="true" inkscape:snap-global="false" inkscape:window-maximized="0"> - <sodipodi:guide id="guide2280" orientation="horizontal" position="545.21834"/> - <sodipodi:guide id="guide2282" orientation="vertical" position="-66.057367,779.02136"/> - <sodipodi:guide id="guide2284" orientation="vertical" position="712.54005"/> - <sodipodi:guide id="guide2286" orientation="horizontal" position="-211.83914,88.83577"/> - <sodipodi:guide id="guide2491" orientation="horizontal" position="348.50956,936.19234"/> - <sodipodi:guide id="guide2495" orientation="vertical" position="785.85489,697.01912"/> - <sodipodi:guide id="guide2497" orientation="horizontal" position="154.80103"/> - </sodipodi:namedview> - <metadata id="metadata7"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> - <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"/> - <dc:title>manage</dc:title> - <dc:date>Sept 2012</dc:date> - <dc:creator> - <cc:Agent> - <dc:title>Franziska Sponsel</dc:title> - </cc:Agent> - </dc:creator> - <dc:rights> - <cc:Agent> - <dc:title>Franziska Sponsel</dc:title> - </cc:Agent> - </dc:rights> - <dc:publisher> - <cc:Agent> - <dc:title>RRZE</dc:title> - </cc:Agent> - </dc:publisher> - <dc:subject> - <rdf:Bag> - <rdf:li>manage</rdf:li> - <rdf:li>tools</rdf:li> - <rdf:li>administrate</rdf:li> - <rdf:li>management</rdf:li> - <rdf:li>administration</rdf:li> - </rdf:Bag> - </dc:subject> - <dc:contributor> - <cc:Agent> - <dc:title>Hendrik Eggers, Frank Troeger</dc:title> - </cc:Agent> - </dc:contributor> - <dc:description>uses <http://ftp.uni-erlangen.de/pub/rrze/tango/rrze-icon-set/tango/16x16/categories/user-admin.png></dc:description> - </cc:Work> - <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"> - <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/> - <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/> - <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/> - </cc:License> - </rdf:RDF> - </metadata> - <g id="layer1" inkscape:groupmode="layer" inkscape:label="Ebene 1" transform="translate(80, 0)"> - <g id="g12910"> - <rect height="850" id="rect2300" style="fill:none;stroke:none" width="850" x="-64.879845" y="115.85568"/> - <g transform="matrix(1.8906321,0,0,1.8906321,-591.22637,-769.37328)" id="g12880"> - <path transform="matrix(7.1423949,0,0,5.5028975,410.56814,647.32339)" style="opacity:0.19886367;fill:url(#radialGradient12894);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:type="arc" sodipodi:ry="6.625" sodipodi:rx="17.6875" sodipodi:cy="39.125" sodipodi:cx="24.8125" id="path2258" d="m 42.5,39.125 c 0,3.658886 -7.918963,6.625 -17.6875,6.625 -9.768537,0 -17.6875,-2.966114 -17.6875,-6.625 0,-3.658886 7.918963,-6.625 17.6875,-6.625 9.768537,0 17.6875,2.966114 17.6875,6.625 z"/> - <path inkscape:connector-curvature="0" style="fill:url(#linearGradient12896);fill-opacity:1;fill-rule:nonzero;stroke:#2e3436;stroke-width:9.50901604;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cczcccccccccsc" id="path2140" d="m 418.80143,664.93656 180.60088,184.77668 c 7.30759,8.35149 30.46224,14.80611 45.93322,0 14.93981,-14.29795 11.48328,-34.44993 -3.13179,-49.06501 L 468.91034,614.82765 C 490.30563,555.39629 447.0027,505.47803 391.13722,516.17567 l -12.00533,10.96133 37.58174,35.49384 2.0878,31.31814 -28.05959,25.6135 -33.53261,-3.69083 -34.44984,-32.36205 c 0,0 -12.07759,11.93287 -12.07759,11.93287 -5.61755,53.64342 50.4712,101.58703 108.11963,69.49409 z"/> - <path inkscape:connector-curvature="0" style="opacity:0.42613639;fill:none;stroke:#ffffff;stroke-width:9.50901031;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cczccccccccccc" id="path3057" d="m 420.80479,652.80715 182.60054,190.44291 c 5.65701,6.46508 23.5817,11.46179 35.55811,0 11.56544,-11.0684 8.88961,-26.66861 -2.42441,-37.98264 L 460.70273,618.68955 c 14.26352,-61.80862 -17.67527,-95.13431 -65.22036,-93.94568 l -2.56867,2.59958 34.26023,30.77375 1.23779,39.76471 -34.36484,31.36531 -40.3401,-4.35713 -30.20626,-28.44603 -3.35316,4.08944 c -2.97157,56.75696 61.72988,82.58364 100.65743,52.27365 z"/> - <rect y="120.39947" x="773.19269" width="221.25844" transform="matrix(0.69793809,0.71615809,-0.71615809,0.69793809,0,0)" style="opacity:0.17045456;fill:none;stroke:url(#linearGradient12898);stroke-width:9.50899029;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" ry="4.4455171" rx="4.4455171" id="rect3059" height="19.545702"/> - <path inkscape:connector-curvature="0" style="fill:url(#linearGradient12900);fill-opacity:1;fill-rule:nonzero;stroke:#2e3436;stroke-width:9.50901604;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="ccccccccc" id="path2144" d="m 462.4677,749.65916 c 7.92614,-6.79391 126.31618,-127.88213 126.31618,-127.88213 l 29.23015,-2.08789 45.93322,-63.68009 -38.26743,-34.09164 -59.5043,51.15281 0,29.23025 -121.09659,125.79423 c -5.74164,5.74164 10.08118,27.82805 17.38877,21.56446 z"/> - <path inkscape:connector-curvature="0" style="opacity:0.53977272;fill:none;stroke:url(#linearGradient12902);stroke-width:9.50902081;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="ccccccccc" id="path3085" d="m 461.54713,739.77045 c 6.15015,-5.27161 123.84926,-125.80251 123.84926,-125.80251 l 27.84792,-2.35814 40.07024,-53.84073 -27.4785,-24.23839 -52.0769,44.85851 1.47638,27.10983 -120.53737,126.39691 c -4.45516,4.45517 1.17874,12.73467 6.84897,7.87452 z"/> - <path inkscape:connector-curvature="0" style="fill:url(#linearGradient12904);fill-opacity:1;fill-rule:nonzero;stroke:#204a87;stroke-width:9.50901604;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="ccccccscc" id="path2142" d="m 329.02298,877.89949 c 12.51948,13.9329 47.29491,20.23672 62.71626,-6.75064 6.72382,-11.76674 19.91131,-44.71901 78.74532,-97.6696 9.8813,-8.88313 20.34844,-29.20352 11.47501,-40.16486 l -22.96656,-22.96656 c -9.39539,-10.43938 -35.51067,-5.5699 -46.22506,9.04184 -31.93841,43.70535 -84.11744,78.49581 -95.88428,82.69822 -22.51659,8.04169 -19.98234,41.23253 -5.08561,57.02074 l 17.22492,18.79086 z"/> - <path transform="matrix(8.3514856,0,0,8.3514856,271.60658,511.47803)" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#888a85;stroke-width:1.13860166;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.94117647;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:type="arc" sodipodi:ry="1.375" sodipodi:rx="1.375" sodipodi:cy="37.5" sodipodi:cx="41.875" id="path2146" d="m 43.25,37.5 c 0,0.759392 -0.615608,1.375 -1.375,1.375 -0.759392,0 -1.375,-0.615608 -1.375,-1.375 0,-0.759392 0.615608,-1.375 1.375,-1.375 0.759392,0 1.375,0.615608 1.375,1.375 z"/> - <path transform="matrix(5.4284704,0,0,5.4284704,335.57983,570.18338)" style="opacity:0.60227272;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:type="arc" sodipodi:ry="1.767767" sodipodi:rx="1.767767" sodipodi:cy="28.20101" sodipodi:cx="19.003494" id="path3101" d="m 20.771261,28.20101 c 0,0.97631 -0.791456,1.767767 -1.767767,1.767767 -0.97631,0 -1.767767,-0.791457 -1.767767,-1.767767 0,-0.976311 0.791457,-1.767767 1.767767,-1.767767 0.976311,0 1.767767,0.791456 1.767767,1.767767 z"/> - <path inkscape:connector-curvature="0" style="fill:none;stroke:url(#linearGradient12906);stroke-width:21.81852913;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cc" id="path3103" d="m 426.14429,744.89914 c 0,0 -68.17861,69.41222 -100.11713,81.17896"/> - <path inkscape:connector-curvature="0" style="opacity:0.19886367;fill:none;stroke:#ffffff;stroke-width:9.50901318;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="csccccscc" id="path2270" d="m 332.26261,867.20309 c 13.70506,16.59903 43.73711,20.55117 53.16644,-3.52395 6.47859,-16.54103 31.69946,-53.8761 77.95104,-95.5025 7.76801,-6.98323 15.99654,-22.95781 9.02082,-31.57498 l -18.05477,-18.05477 c -7.38613,-8.20676 -27.9162,-4.37871 -36.3391,7.10809 -25.10799,34.35827 -80.66833,79.30102 -94.09887,83.73289 -20.79432,6.86181 -16.89752,30.6314 -5.18669,43.04305 l 13.54113,14.77217 z"/> - <path inkscape:connector-curvature="0" style="opacity:0.27840911;fill:none;stroke:url(#linearGradient12908);stroke-width:21.81852913;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cc" id="path2247" d="m 446.5477,760.45798 c 0,0 -69.63226,62.92508 -84.76102,103.26842"/> - </g> - </g> - </g> -</svg> diff --git a/source/images/media-flash.svg b/source/images/media-flash.svg deleted file mode 100644 index 13f910f..0000000 --- a/source/images/media-flash.svg +++ /dev/null @@ -1,477 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:export-ydpi="90.000000" - inkscape:export-xdpi="90.000000" - inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png" - width="48px" - height="48px" - id="svg11300" - sodipodi:version="0.32" - inkscape:version="0.46" - sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme-extras/scalable/devices" - sodipodi:docname="media-flash.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape"> - <defs - id="defs3"> - <inkscape:perspective - sodipodi:type="inkscape:persp3d" - inkscape:vp_x="0 : 24 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_z="48 : 24 : 1" - inkscape:persp3d-origin="24 : 16 : 1" - id="perspective71" /> - <linearGradient - inkscape:collect="always" - id="linearGradient6210"> - <stop - style="stop-color:white;stop-opacity:1;" - offset="0" - id="stop6212" /> - <stop - style="stop-color:white;stop-opacity:0;" - offset="1" - id="stop6214" /> - </linearGradient> - <linearGradient - id="linearGradient6196"> - <stop - style="stop-color:#edd400;stop-opacity:1;" - offset="0" - id="stop6198" /> - <stop - id="stop6204" - offset="0.5" - style="stop-color:#c3af07;stop-opacity:1;" /> - <stop - style="stop-color:#ffeb3e;stop-opacity:1;" - offset="1" - id="stop6200" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient6151"> - <stop - style="stop-color:#2e3436;stop-opacity:1;" - offset="0" - id="stop6153" /> - <stop - style="stop-color:#2e3436;stop-opacity:0;" - offset="1" - id="stop6155" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient6125"> - <stop - style="stop-color:black;stop-opacity:1;" - offset="0" - id="stop6127" /> - <stop - style="stop-color:black;stop-opacity:0;" - offset="1" - id="stop6129" /> - </linearGradient> - <linearGradient - id="linearGradient6115"> - <stop - style="stop-color:#555753;stop-opacity:1;" - offset="0" - id="stop6117" /> - <stop - style="stop-color:#3e3f3c;stop-opacity:1;" - offset="1" - id="stop6119" /> - </linearGradient> - <linearGradient - id="linearGradient6099"> - <stop - style="stop-color:#eeeeec;stop-opacity:1;" - offset="0" - id="stop6101" /> - <stop - id="stop6107" - offset="0.8918919" - style="stop-color:#dededa;stop-opacity:1;" /> - <stop - style="stop-color:#838375;stop-opacity:1;" - offset="1" - id="stop6103" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient6099" - id="linearGradient6105" - x1="22.797205" - y1="39.679859" - x2="22.797205" - y2="46.635937" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1,0,0,0.934004,0,1.557982)" /> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient6125" - id="radialGradient6131" - cx="24.218407" - cy="45.25996" - fx="24.218407" - fy="45.25996" - r="21.38998" - gradientTransform="matrix(1,0,0,0.128099,9.432564e-16,39.4622)" - gradientUnits="userSpaceOnUse" /> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient6151" - id="radialGradient6157" - cx="33.45499" - cy="28.603338" - fx="33.45499" - fy="28.603338" - r="3.8890872" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(3.657239,1.232816e-15,-1.232816e-15,3.657239,-88.89792,-76.00592)" /> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient6151" - id="radialGradient6161" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(8.342154,-3.746956e-16,3.746956e-16,8.342154,-227.6289,-207.0663)" - cx="29.61227" - cy="27.974968" - fx="29.61227" - fy="27.974968" - r="3.8890872" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient6196" - id="linearGradient6202" - x1="29.374996" - y1="21.741114" - x2="22.101643" - y2="7.6786127" - gradientUnits="userSpaceOnUse" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient6115" - id="linearGradient6208" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1,0,0,0.982516,0,-7.076703e-2)" - x1="21.617008" - y1="4.6076145" - x2="26.443777" - y2="47.007381" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient6210" - id="linearGradient6216" - x1="16.845879" - y1="8.6784801" - x2="30.507824" - y2="78.505272" - gradientUnits="userSpaceOnUse" /> - <filter - inkscape:collect="always" - id="filter5339" - x="-0.068965518" - width="1.137931" - y="-0.62068962" - height="2.2413792"> - <feGaussianBlur - inkscape:collect="always" - stdDeviation="1.1886709" - id="feGaussianBlur5341" /> - </filter> - </defs> - <sodipodi:namedview - stroke="#ef2929" - fill="#eeeeec" - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="0.25490196" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="200.83545" - inkscape:cy="-11.195251" - inkscape:current-layer="layer1" - showgrid="true" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:showpageshadow="false" - inkscape:window-width="663" - inkscape:window-height="688" - inkscape:window-x="355" - inkscape:window-y="160"> - <inkscape:grid - type="xygrid" - id="grid4690" /> - </sodipodi:namedview> - <metadata - id="metadata4"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:creator> - <cc:Agent> - <dc:title>Jakub Steiner</dc:title> - </cc:Agent> - </dc:creator> - <dc:source>http://jimmac.musichall.cz</dc:source> - <cc:license - rdf:resource="http://creativecommons.org/licenses/publicdomain/" /> - <dc:title>Generic Flash Media</dc:title> - <dc:subject> - <rdf:Bag> - <rdf:li>flash</rdf:li> - <rdf:li>memory</rdf:li> - <rdf:li>removable</rdf:li> - <rdf:li>photo</rdf:li> - </rdf:Bag> - </dc:subject> - <dc:rights> - <cc:Agent> - <dc:title>Novell, Inc., Jakub Steiner</dc:title> - </cc:Agent> - </dc:rights> - </cc:Work> - <cc:License - rdf:about="http://creativecommons.org/licenses/publicdomain/"> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Reproduction" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Distribution" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> - </cc:License> - </rdf:RDF> - </metadata> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <rect - style="opacity:0.43373497;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.50843191px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter5339);enable-background:accumulate" - id="rect4692" - width="41.365746" - height="4.5961943" - x="3.3587573" - y="41.989594" - rx="2.3794458" - ry="2.2980971" - transform="matrix(0.965812,0,0,1,0.8219361,0)" /> - <path - style="opacity:1;color:black;fill:url(#linearGradient6208);fill-opacity:1;fill-rule:evenodd;stroke:#2e3436;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 5.4999978,3.2368595 L 5.4999978,43.618858 C 5.569704,44.669066 6.4987349,45.72121 7.8834214,45.616246 L 39.735278,45.616246 C 40.628844,45.573136 41.513052,44.830044 41.499984,43.358328 L 41.499984,6.4283398 C 41.499984,5.7118028 41.268737,5.2304363 40.743728,4.7146061 C 40.743728,4.7146061 37.994733,1.8791213 37.994733,1.8791213 C 37.707471,1.6077368 37.530774,1.4999993 36.735279,1.4999993 L 6.7352914,1.4999993 C 5.7977914,1.5614066 5.4374978,2.4999722 5.4999978,3.2368595 z " - id="path4291" - sodipodi:nodetypes="cccccccsccc" /> - <rect - ry="1.8974454" - rx="1.8974441" - y="5.616117" - x="9.4999952" - height="16.999992" - width="27.976646" - id="rect6089" - style="opacity:1;color:black;fill:#edd400;fill-opacity:1;fill-rule:evenodd;stroke:#2e3436;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <rect - style="opacity:1;color:black;fill:url(#linearGradient6202);fill-opacity:1.0;fill-rule:evenodd;stroke:#c4a000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect4293" - width="27.976646" - height="16.999992" - x="9.4999952" - y="5.616117" - rx="1.8974441" - ry="1.8974454" /> - <rect - ry="1.1461133" - rx="1.1461439" - y="6.6162395" - x="10.578098" - height="15.00028" - width="26.000004" - id="rect4295" - style="opacity:0.44943824;color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.0000087;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - transform="matrix(1,0,-5.5327e-3,0.999985,0,0)" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 12,6.116117 L 12,12.11612 C 19.204912,9.2558473 27.058025,16.094119 35,14.11612 L 35,6.1880393 L 36,6.1880393 L 36,22.11612 L 35,22.11612 L 35,16.11612 C 26.337016,18.056862 19.445696,11.070476 12,14.11612 L 12,22.11612 L 11,22.11612 L 11,6.116117 L 12,6.116117 z " - id="path6043" - sodipodi:nodetypes="ccccccccccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 13,6.116117 L 13,10.850955 L 14,10.611733 L 14,6.116117 L 13,6.116117 z " - id="path6045" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 15,10.611732 L 15,6.116117 L 16,6.116117 L 16,10.523344 L 15,10.611732 z " - id="path6047" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 17,10.523344 L 17,6.116117 L 18,6.116117 L 18,10.674178 L 17,10.523344 z " - id="path6049" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 19,10.895149 L 19,6.116117 L 20,6.116117 L 20,11.11612 L 19,10.895149 z " - id="path6051" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 21,11.274645 L 21,6.116117 L 22,6.116117 L 22,11.451422 L 21,11.274645 z " - id="path6053" - sodipodi:nodetypes="ccccc" /> - <path - id="path6055" - d="M 23,11.804975 L 23,6.116117 L 24,6.116117 L 24,11.937558 L 23,11.804975 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 25,12.335305 L 25,6.116117 L 26,6.116117 L 26,12.512082 L 25,12.335305 z " - id="path6057" - sodipodi:nodetypes="ccccc" /> - <path - id="path6059" - d="M 27,12.733053 L 27,6.116117 L 28,6.116117 L 28,12.90983 L 27,12.733053 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 29,13.219189 L 29,6.116117 L 30,6.116117 L 30,13.307577 L 29,13.219189 z " - id="path6061" - sodipodi:nodetypes="ccccc" /> - <path - id="path6063" - d="M 31,13.395965 L 31,6.116117 L 32,6.116117 L 32,13.395966 L 31,13.395965 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 33,13.395965 L 33,6.116117 L 34,6.116117 L 34,13.263383 L 33,13.395965 z " - id="path6065" - sodipodi:nodetypes="ccccc" /> - <path - id="path6067" - d="M 13,22.070139 L 13,14.639459 L 14,14.525128 L 14,22.070139 L 13,22.070139 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - id="path6069" - d="M 15,14.480935 L 15,22.070139 L 16,22.070139 L 16,14.348352 L 15,14.480935 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - id="path6071" - d="M 17,14.348352 L 17,22.070139 L 18,22.070139 L 18,14.462683 L 17,14.348352 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - id="path6073" - d="M 19,14.772042 L 19,22.070139 L 20,22.070139 L 20,14.993013 L 19,14.772042 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - id="path6075" - d="M 21,15.232235 L 21,22.070139 L 22,22.070139 L 22,15.4974 L 21,15.232235 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 23,15.850954 L 23,22.070139 L 24,22.070139 L 24,16.204507 L 23,15.850954 z " - id="path6077" - sodipodi:nodetypes="ccccc" /> - <path - id="path6079" - d="M 25,16.381284 L 25,22.070139 L 26,22.070139 L 26,16.646449 L 25,16.381284 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 27,16.823226 L 27,22.070139 L 28,22.070139 L 28,17.000002 L 27,16.823226 z " - id="path6081" - sodipodi:nodetypes="ccccc" /> - <path - id="path6083" - d="M 29,17.176779 L 29,22.070139 L 30,22.070139 L 30,17.220973 L 29,17.176779 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <path - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 31,17.39775 L 31,22.070139 L 32,22.070139 L 32,17.265167 L 31,17.39775 z " - id="path6085" - sodipodi:nodetypes="ccccc" /> - <path - id="path6087" - d="M 33,17.353556 L 33,22.070139 L 34,22.070139 L 34,17.176779 L 33,17.353556 z " - style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:nodetypes="ccccc" /> - <rect - style="opacity:1;color:black;fill:#2e3436;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect6095" - width="31" - height="11" - x="8" - y="35.116135" - rx="0.81717849" - ry="0.81717849" /> - <rect - ry="0.12967849" - rx="0.12967849" - y="36.116135" - x="9" - height="9" - width="29" - id="rect6097" - style="opacity:1;color:black;fill:url(#linearGradient6105);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <rect - style="opacity:1;color:black;fill:#8f5902;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.80000000000000004;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect6109" - width="29" - height="3.0000017" - x="9" - y="36.116135" - rx="0.12967849" - ry="0.12967849" /> - <rect - style="opacity:1;color:black;fill:#e9b96e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.80000000000000004;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect6111" - width="10.036427" - height="1.9999989" - x="11" - y="37.116135" - rx="0.12967849" - ry="0.12967849" /> - <rect - ry="0.12967849" - rx="0.12967849" - y="37.116135" - x="22.963573" - height="1.9999989" - width="4.0364265" - id="rect6113" - style="opacity:1;color:black;fill:#e9b96e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.80000000000000004;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <path - sodipodi:type="inkscape:offset" - inkscape:radius="-1.000373" - inkscape:original="M 6.75 1.5 C 5.8124999 1.5614073 5.4375 2.5131127 5.5 3.25 L 5.5 43.625 C 5.5697064 44.675208 6.4903135 45.729964 7.875 45.625 L 39.75 45.625 C 40.643565 45.581891 41.513068 44.815466 41.5 43.34375 L 41.5 6.4375 C 41.499999 5.7209628 41.275009 5.2345802 40.75 4.71875 C 40.749999 4.7187498 38 1.875 38 1.875 C 37.712739 1.6036155 37.545495 1.5 36.75 1.5 L 6.75 1.5 z " - xlink:href="#path4291" - style="opacity:0.17977528;color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6216);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="path6206" - inkscape:href="#path4291" - d="M 6.8125,2.5 C 6.6714126,2.5092414 6.665484,2.505736 6.59375,2.625 C 6.522016,2.744264 6.486054,2.9918242 6.5,3.15625 C 6.501465,3.1874828 6.501465,3.2187672 6.5,3.25 L 6.5,43.5625 C 6.5340897,44.076101 6.9647984,44.689259 7.8125,44.625 C 7.8333282,44.624349 7.8541718,44.624349 7.875,44.625 L 39.6875,44.625 C 40.042231,44.607886 40.509542,44.418409 40.5,43.34375 L 40.5,6.4375 C 40.499999,5.9303711 40.465181,5.8331404 40.0625,5.4375 C 40.051855,5.4273147 40.041435,5.4168955 40.03125,5.40625 C 40.03125,5.40625 37.37257,2.6558683 37.3125,2.59375 C 37.252809,2.537358 37.283219,2.5655737 37.28125,2.5625 C 37.279281,2.5594263 37.249931,2.5312266 37.25,2.53125 C 37.250138,2.5312967 37.104314,2.5 36.75,2.5 L 6.8125,2.5 z " /> - </g> -</svg> diff --git a/source/images/sbutto.svg b/source/images/sbutto.svg deleted file mode 100644 index 3f131f1..0000000 --- a/source/images/sbutto.svg +++ /dev/null @@ -1,14 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="76" height="16"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#5c3e9a" /> - <stop offset="1" stop-color="#461f99" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="0" y="0" width="76" height="16" rx="4" ry="4" stroke-width="1" stroke="#330099" fill="url(#interior)" /> - <rect x="1" y="1" width="74" height="8" stroke="none" fill="url(#glass)" /> -</svg> diff --git a/source/images/slide-audio.svg b/source/images/slide-audio.svg deleted file mode 100644 index 5a9be13..0000000 --- a/source/images/slide-audio.svg +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="210mm" height="297mm" id="svg2" version="1.1" inkscape:version="0.47 r22583"> - <title id="title4032">slide audio</title> - <defs id="defs4"> - <linearGradient inkscape:collect="always" id="linearGradient3877"> - <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3879"/> - <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3881"/> - </linearGradient> - <linearGradient id="linearGradient3782"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3784"/> - <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3786"/> - </linearGradient> - <linearGradient inkscape:collect="always" id="linearGradient3718"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3720"/> - <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3722"/> - </linearGradient> - <linearGradient id="linearGradient3632"> - <stop style="stop-color:#555753;stop-opacity:1;" offset="0" id="stop3634"/> - <stop style="stop-color:#555753;stop-opacity:0;" offset="1" id="stop3636"/> - </linearGradient> - <linearGradient id="linearGradient3622"> - <stop style="stop-color:#babdb6;stop-opacity:0.16384181;" offset="0" id="stop3624"/> - <stop id="stop3630" offset="0.5" style="stop-color:#babdb6;stop-opacity:1;"/> - <stop style="stop-color:#babdb6;stop-opacity:0.33898309;" offset="1" id="stop3626"/> - </linearGradient> - <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="744.09448 : 526.18109 : 1" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" id="perspective10"/> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3877" id="radialGradient3883" cx="-91.428575" cy="-37.637817" fx="-91.428575" fy="-37.637817" r="468.57144" gradientTransform="matrix(1,0,0,0.11890244,457.14286,801.12313)" gradientUnits="userSpaceOnUse"/> - <filter inkscape:collect="always" id="filter3897" x="-0.052189089" width="1.1043782" y="-0.43892363" height="1.8778473"> - <feGaussianBlur inkscape:collect="always" stdDeviation="20.378597" id="feGaussianBlur3899"/> - </filter> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3954" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3956" gradientUnits="userSpaceOnUse" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3958" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,743.62054,0)" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3960" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3782" id="linearGradient3962" gradientUnits="userSpaceOnUse" x1="252.44557" y1="377.28876" x2="637.08942" y2="732.86249"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3718" id="linearGradient3964" gradientUnits="userSpaceOnUse" x1="73.20138" y1="286.6479" x2="669.65576" y2="286.6479"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3718" id="linearGradient3970" gradientUnits="userSpaceOnUse" x1="73.20138" y1="286.6479" x2="669.65576" y2="286.6479" gradientTransform="translate(0,-48)"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3782" id="linearGradient3975" gradientUnits="userSpaceOnUse" x1="252.44557" y1="377.28876" x2="637.08942" y2="732.86249" gradientTransform="translate(0,-48)"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3980" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077" gradientTransform="matrix(1,0,0,0.84207554,0,45.31159)"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3984" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,743.62054,-48)" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3987" gradientUnits="userSpaceOnUse" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051" gradientTransform="translate(0,-48)"/> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3990" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077" gradientTransform="translate(0,-48)"/> - <filter height="1.2103233" y="-0.10516165" width="1.0759758" x="-0.037987912" id="filter3689" inkscape:collect="always"> - <feGaussianBlur id="feGaussianBlur3691" stdDeviation="7.2590033" inkscape:collect="always"/> - </filter> - <radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.36262332,0,256.11321)" r="229.80462" fy="401.82394" fx="-17.172595" cy="401.82394" cx="-17.172595" id="radialGradient3679" xlink:href="#linearGradient3673" inkscape:collect="always"/> - <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3668" xlink:href="#linearGradient3639" inkscape:collect="always"/> - <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3661" xlink:href="#linearGradient3639" inkscape:collect="always"/> - <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3657" xlink:href="#linearGradient3639" inkscape:collect="always"/> - <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3653" xlink:href="#linearGradient3639" inkscape:collect="always"/> - <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3649" xlink:href="#linearGradient3639" inkscape:collect="always"/> - <radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" id="radialGradient3645" xlink:href="#linearGradient3639" inkscape:collect="always"/> - <inkscape:perspective id="perspective10-4" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" inkscape:vp_z="744.09448 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 526.18109 : 1" sodipodi:type="inkscape:persp3d"/> - <linearGradient id="linearGradient3639" inkscape:collect="always"> - <stop id="stop3641" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/> - <stop id="stop3643" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/> - </linearGradient> - <linearGradient id="linearGradient3673" inkscape:collect="always"> - <stop id="stop3675" offset="0" style="stop-color:#000000;stop-opacity:1;"/> - <stop id="stop3677" offset="1" style="stop-color:#000000;stop-opacity:0;"/> - </linearGradient> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3673" id="radialGradient3540" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.36262332,0,256.11321)" cx="-17.172595" cy="401.82394" fx="-17.172595" fy="401.82394" r="229.80462"/> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3639" id="radialGradient3542" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" cx="225.84628" cy="630.30914" fx="225.84628" fy="630.30914" r="266.9534"/> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3673" id="radialGradient3557" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.36262332,0,256.11321)" cx="-17.172595" cy="401.82394" fx="-17.172595" fy="401.82394" r="229.80462"/> - <radialGradient inkscape:collect="always" xlink:href="#linearGradient3639" id="radialGradient3559" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" cx="225.84628" cy="630.30914" fx="225.84628" fy="630.30914" r="266.9534"/> - </defs> - <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="-501.32201" inkscape:cy="338.27094" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:snap-to-guides="false" inkscape:snap-grids="false" inkscape:snap-nodes="false" inkscape:snap-global="false" showguides="true" inkscape:guide-bbox="true" inkscape:window-width="1280" inkscape:window-height="750" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"> - <sodipodi:guide orientation="0,1" position="-260,911.42857" id="guide3591"/> - <sodipodi:guide orientation="0,1" position="-165.71429,188.57143" id="guide3593"/> - <sodipodi:guide orientation="1,0" position="734.28571,82.857143" id="guide3595"/> - <sodipodi:guide orientation="1,0" position="11.428571,-57.142857" id="guide3597"/> - <sodipodi:guide orientation="1,0" position="371.42857,380" id="guide3608"/> - <sodipodi:guide orientation="0,1" position="662.85714,457.14286" id="guide3618"/> - </sodipodi:namedview> - <metadata id="metadata7"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> - <dc:title>slide audio</dc:title> - <dc:date>April 2010</dc:date> - <dc:creator> - <cc:Agent> - <dc:title>Franziska Sponsel</dc:title> - </cc:Agent> - </dc:creator> - <dc:rights> - <cc:Agent> - <dc:title>Franziska Sponsel</dc:title> - </cc:Agent> - </dc:rights> - <dc:publisher> - <cc:Agent> - <dc:title>RRZE</dc:title> - </cc:Agent> - </dc:publisher> - <dc:subject> - <rdf:Bag> - <rdf:li>slide</rdf:li> - <rdf:li>transperancy</rdf:li> - <rdf:li>flip chart</rdf:li> - <rdf:li>chart</rdf:li> - <rdf:li>audio</rdf:li> - <rdf:li>audiovisual</rdf:li> - </rdf:Bag> - </dc:subject> - <dc:contributor> - <cc:Agent> - <dc:title>Beate Kaspar, Hendrik Eggers</dc:title> - </cc:Agent> - </dc:contributor> - <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"/> - </cc:Work> - <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"> - <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/> - <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/> - <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/> - <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/> - </cc:License> - </rdf:RDF> - </metadata> - <g inkscape:label="Ebene 1" inkscape:groupmode="layer" id="layer1"> - <g id="g3561"> - <g id="g4012"> - <path style="opacity:0.67383513;fill:url(#radialGradient3883);fill-opacity:1;fill-rule:evenodd;stroke:none;filter:url(#filter3897)" d="m 834.28573,796.6479 c 0,30.77015 -209.78658,55.71428 -468.57145,55.71428 -258.78486,0 -468.57144,-24.94413 -468.57144,-55.71428 0,-30.77015 209.78658,-55.71429 468.57144,-55.71429 258.78487,0 468.57145,24.94414 468.57145,55.71429 z" id="path3870" transform="matrix(0.69356999,0,0,0.83614625,124.92298,67.676603)"/> - <path style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="m 11.428572,140.93361 722.857118,0 0,722.85712 -722.857118,0 0,-722.85712 z" id="rect2816"/> - <g id="g3995"> - <path sodipodi:nodetypes="cc" style="fill:none;stroke:#000000;stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 360.57143,556.64789 -101.84498,160.483" id="path3612"/> - <path id="path3616" d="m 383.01216,556.64789 101.84498,160.483" style="fill:none;stroke:#000000;stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" sodipodi:nodetypes="cc"/> - <path sodipodi:nodetypes="cc" style="fill:none;stroke:url(#linearGradient3987);stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 383.01216,556.64789 101.84498,160.483" id="path3644"/> - <path id="path3654" d="M 360.60838,556.64789 258.7634,717.13089" style="fill:none;stroke:url(#linearGradient3984);stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" sodipodi:nodetypes="cc"/> - <path style="fill:none;stroke:#000000;stroke-width:21.10587502;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 372,552.54605 0,196.08331" id="path3658"/> - <path id="path3660" d="m 372,552.54605 0,196.08331" style="fill:none;stroke:url(#linearGradient3980);stroke-width:21.10587502;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> - <path id="rect3603" d="m 621.59375,233.78125 c -167.85572,0.94631 -335.77808,-0.60629 -503.59375,0.875 -4.44378,2.98782 -1.84363,9.82763 -2.83738,14.40624 0.49245,103.81734 -0.84434,207.7618 0.58738,311.50001 5.49238,6.43755 15.13492,2.18184 22.375,3.12551 162.98952,-0.0584 326.06371,0.64237 489,-0.40676 6.98823,-5.66489 2.26238,-15.83285 3.22202,-23.40625 -0.001,-101.12276 1.0551,-202.42904 -0.59702,-303.4375 -1.90131,-2.31888 -5.32648,-2.73149 -8.15625,-2.65625 z" style="color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:20;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> - <path id="path3662" d="m 125.15625,246.0625 c 0,102.57292 0,205.14583 0,307.71875 165.13542,0 330.27083,0 495.40625,0 0,-103.23958 0,-206.47917 0,-309.71875 -165.13542,0 -330.27083,0 -495.40625,0 l 0,1 0,1 z" style="opacity:0.74910398;color:#000000;fill:none;stroke:none;stroke-width:14;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> - <path id="path3780" d="m 605.75,241.6875 c -160.74855,0.98338 -321.50186,-0.30623 -482.25,0.78125 -0.36312,104.46819 -0.65599,208.93888 0.0625,313.40625 166.33289,-0.51972 332.66919,0.61763 499,-0.65625 -0.76039,-104.51931 1.25082,-209.0544 -1.03125,-313.5625 -5.26039,0.0131 -10.5211,-0.0309 -15.78125,0.0312 z" style="opacity:0.75627238;color:#000000;fill:url(#linearGradient3975);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:20;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> - <path id="path3696" d="m 131.37715,274.63703 c -1.17032,19.56551 -0.16516,39.49915 -0.50057,59.20594 0,70.79971 0,141.59941 0,212.39912 3.61034,4.05882 11.65949,0.78851 17.01966,1.8412 154.98113,0 309.96227,0 464.94339,0 4.41399,-3.31983 0.85751,-10.7213 2.00232,-15.65016 0,-85.52927 0,-171.05854 0,-256.58781 -3.61034,-4.05882 -11.65949,-0.7885 -17.01966,-1.8412 -154.98113,0 -309.96227,0 -464.9434,0 l -0.91011,0.38357 -0.59163,0.24934 z" style="color:#000000;fill:none;stroke:#ffffff;stroke-width:13.44045448;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> - <path style="color:#000000;fill:#888a85;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:13;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="m 79.70138,215.49213 583.45438,0 0,46.31154 -583.45438,0 0,-46.31154 z" id="path3606"/> - <path id="path3716" d="m 89.6875,227.5 c 0,8.10417 0,16.20833 0,24.3125 187.82292,0 375.64583,0 563.46875,0 0,-8.77083 0,-17.54167 0,-26.3125 -187.82292,0 -375.64583,0 -563.46875,0 l 0,1 0,1 z" style="opacity:0.69360268;color:#000000;fill:url(#linearGradient3970);fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> - <path transform="matrix(0.78442893,-0.01960833,0.01960833,0.78442893,135.9589,100.42494)" d="M 257.58891,420.0067 87.209212,415.33991 176.44062,270.12016 257.58891,420.0067 z" inkscape:randomized="0" inkscape:rounded="0" inkscape:flatsided="true" sodipodi:arg2="1.59818" sodipodi:arg1="0.55098249" sodipodi:r2="49.202827" sodipodi:r1="98.405655" sodipodi:cy="368.48892" sodipodi:cx="173.74625" sodipodi:sides="3" id="path3757" style="fill:#3465a4;fill-opacity:1;fill-rule:nonzero;stroke:#204a87;stroke-width:7;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" sodipodi:type="star"/> - <path id="rect3759" d="m 421.23359,350.79348 104.04573,0 0,104.04573 -104.04573,0 0,-104.04573 z" style="color:#000000;fill:#edd400;fill-opacity:1;fill-rule:evenodd;stroke:#c4a000;stroke-width:7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> - <path id="path3754" d="m 424.78402,451.8236 c 0,30.963 -25.10047,56.06347 -56.06347,56.06347 -30.96299,0 -56.06346,-25.10047 -56.06346,-56.06347 0,-30.96299 25.10047,-56.06346 56.06346,-56.06346 30.963,0 56.06347,25.10047 56.06347,56.06346 z" style="fill:#cc0000;fill-rule:evenodd;stroke:#a40000;stroke-width:7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> - </g> - </g> - <g transform="matrix(0.7373169,0,0,0.7373169,1094.041,225.61903)" id="g3550"> - <path style="opacity:0.44444442;fill:url(#radialGradient3557);fill-opacity:1;fill-rule:evenodd;stroke:none;filter:url(#filter3689)" d="m 212.13203,401.82394 c 0,45.74714 -102.66318,82.83252 -229.304624,82.83252 -126.641446,0 -229.304626,-37.08538 -229.304626,-82.83252 0,-45.74713 102.66318,-82.83251 229.304626,-82.83251 126.641444,0 229.304624,37.08538 229.304624,82.83251 z" id="path3670" transform="matrix(1.1146383,0,0,0.71787424,-757.13212,498.47301)"/> - <g id="g3663" transform="matrix(0.76986668,0,0,0.76986668,-1015.2744,140.47471)"> - <path id="path3601" d="m 407.15179,106.625 0,507.3125 c -33.25046,-32.31145 -84.32093,-53 -141.59375,-53 -100.20023,0 -181.406254,63.32866 -181.406254,141.4375 0,78.10885 81.206024,141.40625 181.406254,141.40625 100.20024,0 181.4375,-63.2974 181.4375,-141.40625 0,-5.67397 -0.44786,-11.28196 -1.28125,-16.78125 l 0,-482.625 c 9.52033,39.16067 85.38568,25.52752 114.71875,68.40625 34.94685,51.08489 1.64832,222.52484 -3.59375,243.5625 2.45499,-6.037 10.3844,-24.65688 35.03125,-80.71875 46.82039,-106.49793 30.7096,-233.63144 -47.125,-252.84375 -73.96717,-18.2577 -94.76446,-60.57628 -99.03125,-71.59375 l 0,-3.15625 -38.5625,0 z m 149.6875,408.3125 c -1.85384,4.55873 -0.6875,2.15625 -0.6875,2.15625 0.0594,0.0891 0.32169,-0.68817 0.6875,-2.15625 z" style="fill:#555753;fill-rule:evenodd;stroke:#2e3436;stroke-width:14;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> - <path id="path3619" d="m 437,116.375 c -6.59735,0.66736 -13.23183,0.0664 -19.84375,0.21875 0.14237,165.55621 -0.33299,331.16278 0.25,496.6875 2.95995,8.29165 -9.24921,16.81846 -15.34375,9.78125 -46.27145,-45.66393 -116.54398,-60.24595 -179.1653,-48.04047 -48.54916,9.41681 -96.76138,37.50931 -118.86595,83.04047 -15.163182,32.27865 -12.673368,72.2909 7.40625,101.71875 27.821,43.13831 78.71561,66.76941 128.625,72.53125 56.63899,6.74704 117.46591,-8.82415 159.53125,-48.03125 25.06378,-23.7214 41.01361,-58.22899 36.91015,-93.12113 -1.70028,-49.77197 -0.22128,-99.58787 -0.77903,-149.37886 -0.0551,-114.4056 0.003,-228.89909 0.0876,-343.25001 1.49726,-8.10802 14.94817,-10.60531 17.75,-2.125 2.5768,11.48364 12.57457,19.80341 23.55496,22.77391 27.93929,10.97144 61.13655,14.08164 83.13254,36.50734 19.09363,18.86844 23.32736,47.21619 25.09461,72.87299 2.1674,35.93439 -0.46435,72.05333 -5.03211,107.65826 18.08379,-41.5745 29.57971,-86.60931 27.58791,-132.31133 -1.20008,-33.00266 -9.18004,-67.33124 -31.49416,-92.68867 C 563.97579,197.92551 546.71496,190.70326 529.16671,187.49544 491.42329,176.10381 454.76954,152.74389 437.5,116.3125 l -0.5,0.0625 z" style="opacity:0.4;fill:none;stroke:#ffffff;stroke-width:7;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> - <path id="path3637" d="m 438.1875,114.21875 c -7.49499,0.98493 -15.3901,0.10916 -23.03125,0.40625 0.0833,166.18786 -0.16669,332.45613 0.125,498.59375 2.85665,6.59471 -6.58582,14.2273 -11.8125,8.40625 C 359.86657,578.46388 294.72924,562.81942 234.94809,570.98886 186.24344,577.5849 137.65908,601.50027 110,643.28125 c -21.064401,31.64268 -23.997862,74.8593 -5.63293,108.29375 21.33564,40.64881 63.33841,66.4016 106.78918,77.425 60.11447,15.42727 127.94687,4.93539 177.71875,-32.875 29.92014,-22.78466 52.3267,-59.41196 49.96875,-98.375 -2.15518,-39.28125 -0.60629,-78.64601 -1.0848,-117.96875 -0.13535,-126.03651 -0.0136,-252.11436 0.0223,-378.125 -1.64762,-7.67075 10.79778,-12.37774 13.875,-4.6875 2.67662,10.46827 10.64405,19.42591 21.15625,22.625 27.97503,11.99889 61.39465,14.15858 84.3125,35.84375 18.93531,17.22092 23.73944,43.88654 25.8971,68.30891 3.07953,42.07705 -0.73594,84.48111 -6.5221,126.03484 17.54183,-38.5001 31.34925,-79.2309 33.08147,-121.80932 2.28167,-38.96402 -3.29184,-80.51209 -26.83706,-112.46679 -12.27263,-15.68983 -30.59,-25.92536 -50.23718,-29.09236 C 493.94398,175.29593 455.87491,151.75526 438.75,114.25 c -0.15144,-0.0477 -0.32942,-0.11743 -0.5625,-0.0312 z" style="opacity:0.6939057;fill:url(#radialGradient3559);fill-opacity:1;fill-rule:evenodd;stroke:none"/> - </g> - </g> - </g> - </g> -</svg> diff --git a/source/images/smaini.svg b/source/images/smaini.svg deleted file mode 100644 index 4f949ad..0000000 --- a/source/images/smaini.svg +++ /dev/null @@ -1,14 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="85" height="38"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#5c3e9a" /> - <stop offset="1" stop-color="#461f99" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="1" y="1" width="83" height="36" rx="4" ry="4" stroke-width="1" stroke="#330099" fill="url(#interior)" /> - <rect x="2" y="2" width="81" height="18" stroke="none" fill="url(#glass)" /> -</svg> diff --git a/source/images/smnsel.svg b/source/images/smnsel.svg deleted file mode 100644 index 8a71555..0000000 --- a/source/images/smnsel.svg +++ /dev/null @@ -1,14 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="79" height="15"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#aa80ff" /> - <stop offset="1" stop-color="#884dff" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="0" y="0" width="79" height="15" rx="4" ry="4" stroke-width="1" stroke="none" fill="url(#interior)" /> - <rect x="1" y="1" width="77" height="7" stroke="none" fill="url(#glass)" /> -</svg> diff --git a/source/images/smsel.svg b/source/images/smsel.svg deleted file mode 100644 index 043c8e7..0000000 --- a/source/images/smsel.svg +++ /dev/null @@ -1,14 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="79" height="15"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#5c3e9a" /> - <stop offset="1" stop-color="#461f99" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="0" y="0" width="79" height="15" rx="4" ry="4" stroke-width="1" stroke="none" fill="url(#interior)" /> - <rect x="1" y="1" width="77" height="7" stroke="none" fill="url(#glass)" /> -</svg> diff --git a/source/images/smsgfr.svg b/source/images/smsgfr.svg deleted file mode 100644 index 5f1156f..0000000 --- a/source/images/smsgfr.svg +++ /dev/null @@ -1,16 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="193" height="111"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#5c3e9a" /> - <stop offset="1" stop-color="#461f99" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="0.5" y="0.5" width="192" height="110" rx="6" ry="6" stroke-width="1" stroke="#330099" fill="#ffffff" /> - <rect x="1" y="1" width="191" height="26" rx="5.5" ry="5.5" stroke="none" fill="url(#interior)" /> - <rect x="2" y="2" width="190" height="10" stroke="none" fill="url(#glass)" /> - <rect x="1" y="22" width="191" height="5" stroke="none" fill="#ffffff" /> -</svg> diff --git a/source/images/snmaini.svg b/source/images/snmaini.svg deleted file mode 100644 index 6c8accb..0000000 --- a/source/images/snmaini.svg +++ /dev/null @@ -1,14 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="85" height="38"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#aa80ff" /> - <stop offset="1" stop-color="#884dff" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="1" y="1" width="83" height="36" rx="4" ry="4" stroke-width="1" stroke="#7734ff" fill="url(#interior)" /> - <rect x="2" y="2" width="81" height="18" stroke="none" fill="url(#glass)" /> -</svg> diff --git a/source/images/stitle.svg b/source/images/stitle.svg deleted file mode 100644 index 1f1b374..0000000 --- a/source/images/stitle.svg +++ /dev/null @@ -1,11 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="256" height="33"> - <defs> - <linearGradient id="gradient" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#5c3e9a" /> - <stop offset="1" stop-color="#461f99" /> - </linearGradient> - </defs> - <rect x="0" y="0" width="256" height="33" stroke="none" fill="#ffffff" /> - <rect x="0" y="0" width="256" height="31" stroke-width="1" stroke="none" fill="url(#gradient)" /> - <line x1="0" x2="256" y1="32.5" y2="32.5" stroke="#461f99" stroke-width="1" /> -</svg> diff --git a/source/images/subsela.svg b/source/images/subsela.svg deleted file mode 100644 index 929afcc..0000000 --- a/source/images/subsela.svg +++ /dev/null @@ -1,14 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="245" height="22"> - <defs> - <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#5c3e9a" /> - <stop offset="1" stop-color="#461f99" /> - </linearGradient> - <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1"> - <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" /> - <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" /> - </linearGradient> - </defs> - <rect x="1" y="1" width="243" height="20" rx="4" ry="4" stroke-width="1" stroke="#330099" fill="url(#interior)" /> - <rect x="2" y="2" width="241" height="10" stroke="none" fill="url(#glass)" /> -</svg> diff --git a/source/images/system-log-out.svg b/source/images/system-log-out.svg deleted file mode 100644 index adb9521..0000000 --- a/source/images/system-log-out.svg +++ /dev/null @@ -1,457 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:export-ydpi="90.000000" - inkscape:export-xdpi="90.000000" - inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png" - width="48px" - height="48px" - id="svg11300" - sodipodi:version="0.32" - inkscape:version="0.46" - sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions" - sodipodi:docname="system-log-out.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - sodipodi:modified="true"> - <defs - id="defs3"> - <inkscape:perspective - sodipodi:type="inkscape:persp3d" - inkscape:vp_x="0 : 24 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_z="48 : 24 : 1" - inkscape:persp3d-origin="24 : 16 : 1" - id="perspective70" /> - <linearGradient - inkscape:collect="always" - id="linearGradient6467"> - <stop - style="stop-color:#babdb6;stop-opacity:1;" - offset="0" - id="stop6469" /> - <stop - style="stop-color:#babdb6;stop-opacity:0;" - offset="1" - id="stop6471" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient6365"> - <stop - style="stop-color:#ffffff;stop-opacity:1;" - offset="0" - id="stop6367" /> - <stop - style="stop-color:#ffffff;stop-opacity:0;" - offset="1" - id="stop6369" /> - </linearGradient> - <linearGradient - id="linearGradient6347"> - <stop - style="stop-color:#4e9a06;stop-opacity:1;" - offset="0" - id="stop6349" /> - <stop - style="stop-color:#2d5903;stop-opacity:1;" - offset="1" - id="stop6351" /> - </linearGradient> - <linearGradient - id="linearGradient9896"> - <stop - id="stop9898" - offset="0" - style="stop-color:#cecece;stop-opacity:1;" /> - <stop - id="stop9900" - offset="1.0000000" - style="stop-color:#9e9e9e;stop-opacity:1.0000000;" /> - </linearGradient> - <linearGradient - id="linearGradient9888" - inkscape:collect="always"> - <stop - id="stop9890" - offset="0" - style="stop-color:#ffffff;stop-opacity:1;" /> - <stop - id="stop9892" - offset="1" - style="stop-color:#ffffff;stop-opacity:0;" /> - </linearGradient> - <linearGradient - id="linearGradient9880" - inkscape:collect="always"> - <stop - id="stop9882" - offset="0" - style="stop-color:#525252;stop-opacity:1;" /> - <stop - id="stop9884" - offset="1" - style="stop-color:#525252;stop-opacity:0;" /> - </linearGradient> - <linearGradient - id="linearGradient9868"> - <stop - style="stop-color:#4e4e4e;stop-opacity:1.0000000;" - offset="0.0000000" - id="stop9870" /> - <stop - style="stop-color:#616161;stop-opacity:0.0000000;" - offset="1.0000000" - id="stop9872" /> - </linearGradient> - <linearGradient - id="linearGradient9854"> - <stop - id="stop9856" - offset="0.0000000" - style="stop-color:#4e4e4e;stop-opacity:1.0000000;" /> - <stop - id="stop9858" - offset="1.0000000" - style="stop-color:#ababab;stop-opacity:1.0000000;" /> - </linearGradient> - <linearGradient - id="linearGradient9830"> - <stop - id="stop9832" - offset="0.0000000" - style="stop-color:#505050;stop-opacity:1.0000000;" /> - <stop - id="stop9834" - offset="1.0000000" - style="stop-color:#181818;stop-opacity:1.0000000;" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient8662"> - <stop - style="stop-color:#000000;stop-opacity:1;" - offset="0" - id="stop8664" /> - <stop - style="stop-color:#000000;stop-opacity:0;" - offset="1" - id="stop8666" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient8650"> - <stop - style="stop-color:#ffffff;stop-opacity:1;" - offset="0" - id="stop8652" /> - <stop - style="stop-color:#ffffff;stop-opacity:0;" - offset="1" - id="stop8654" /> - </linearGradient> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient8650" - id="radialGradient8656" - cx="19.701141" - cy="2.8969381" - fx="19.701141" - fy="2.8969381" - r="17.171415" - gradientTransform="matrix(1.253442,-2.296195e-16,1.747460e-16,0.953900,-15.47908,11.27663)" - gradientUnits="userSpaceOnUse" /> - <radialGradient - r="15.644737" - fy="36.421127" - fx="24.837126" - cy="36.421127" - cx="24.837126" - gradientTransform="matrix(1.000000,0.000000,0.000000,0.536723,1.673575e-15,16.87306)" - gradientUnits="userSpaceOnUse" - id="radialGradient9826" - xlink:href="#linearGradient8662" - inkscape:collect="always" /> - <linearGradient - gradientUnits="userSpaceOnUse" - y2="27.759069" - x2="18.031221" - y1="19.804117" - x1="46.845825" - id="linearGradient9864" - xlink:href="#linearGradient9854" - inkscape:collect="always" - gradientTransform="translate(-12.020815,0)" /> - <radialGradient - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(2.565823,0,0,1.403262,-49.804045,-9.483303)" - r="9.7227182" - fy="7.1396070" - fx="27.883883" - cy="7.1396070" - cx="27.883883" - id="radialGradient9876" - xlink:href="#linearGradient9868" - inkscape:collect="always" /> - <linearGradient - gradientTransform="translate(-13.136935,0)" - gradientUnits="userSpaceOnUse" - y2="24.764584" - x2="34.007416" - y1="19.107729" - x1="31.852951" - id="linearGradient9886" - xlink:href="#linearGradient9880" - inkscape:collect="always" /> - <linearGradient - gradientUnits="userSpaceOnUse" - y2="43.449947" - x2="19.755548" - y1="13.663074" - x1="8.7600641" - id="linearGradient9894" - xlink:href="#linearGradient9888" - inkscape:collect="always" /> - <linearGradient - gradientUnits="userSpaceOnUse" - y2="18.064039" - x2="33.710651" - y1="21.511185" - x1="31.078955" - id="linearGradient9902" - xlink:href="#linearGradient9896" - inkscape:collect="always" - gradientTransform="translate(-12.020815,0)" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient6365" - id="linearGradient6371" - x1="40.25" - y1="31.625" - x2="40.25" - y2="43.25" - gradientUnits="userSpaceOnUse" - gradientTransform="translate(-12.020815,0)" /> - <filter - inkscape:collect="always" - x="-0.14153846" - width="1.2830769" - y="-0.10415094" - height="1.2083019" - id="filter6421"> - <feGaussianBlur - inkscape:collect="always" - stdDeviation="2.07" - id="feGaussianBlur6423" /> - </filter> - <filter - inkscape:collect="always" - x="-0.066812893" - width="1.1336258" - y="-0.11952912" - height="1.2390582" - id="filter6451"> - <feGaussianBlur - inkscape:collect="always" - stdDeviation="0.76879489" - id="feGaussianBlur6453" /> - </filter> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient8662" - id="radialGradient6461" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1,0,0,0.536723,0,16.87306)" - cx="24.837126" - cy="36.421127" - fx="24.837126" - fy="36.421127" - r="15.644737" /> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient8650" - id="radialGradient6463" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1.253442,0,0,0.9539,-15.47908,11.27663)" - cx="19.701141" - cy="2.8969381" - fx="19.701141" - fy="2.8969381" - r="17.171415" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient9888" - id="linearGradient6465" - gradientUnits="userSpaceOnUse" - x1="8.7600641" - y1="13.663074" - x2="19.755548" - y2="43.449947" - gradientTransform="matrix(0.968718,0,0,0.9689198,0.3616813,0.7378237)" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient6467" - id="linearGradient6473" - x1="18.729185" - y1="44" - x2="18.729185" - y2="29.068014" - gradientUnits="userSpaceOnUse" /> - </defs> - <sodipodi:namedview - stroke="#a40000" - fill="#727e0a" - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="0.25490196" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="-103.37653" - inkscape:cy="5.4914491" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:showpageshadow="false" - inkscape:window-width="966" - inkscape:window-height="762" - inkscape:window-x="468" - inkscape:window-y="86" /> - <metadata - id="metadata4"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:creator> - <cc:Agent> - <dc:title>Jakub Steiner</dc:title> - </cc:Agent> - </dc:creator> - <dc:source>http://jimmac.musichall.cz</dc:source> - <cc:license - rdf:resource="http://creativecommons.org/licenses/publicdomain/" /> - <dc:title>System Log Out</dc:title> - <dc:subject> - <rdf:Bag> - <rdf:li>log out</rdf:li> - <rdf:li>logout</rdf:li> - <rdf:li>exit</rdf:li> - </rdf:Bag> - </dc:subject> - </cc:Work> - <cc:License - rdf:about="http://creativecommons.org/licenses/publicdomain/"> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Reproduction" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Distribution" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> - </cc:License> - </rdf:RDF> - </metadata> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <rect - ry="0.7071048" - rx="0.70710522" - y="2.5692098" - x="1.4809071" - height="41.942028" - width="31.99555" - id="rect9828" - style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:1.00000048;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - inkscape:r_cx="true" - inkscape:r_cy="true" /> - <rect - y="17.240852" - x="1.9791847" - height="26.759148" - width="30.999998" - id="rect9840" - style="opacity:1;color:#000000;fill:url(#linearGradient6473);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - inkscape:r_cx="true" - inkscape:r_cy="true" /> - <path - style="opacity:0.55428569;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6451)" - d="M 2.1041847,43.875 L 23.479185,35 C 23.479185,35 26.992726,32.780416 23.729185,31.5 C 20.314184,30.16016 16.729185,32 16.729185,32 L 2.1041847,43.875 z " - id="path6425" - sodipodi:nodetypes="cczcc" /> - <path - sodipodi:nodetypes="ccccc" - id="path9852" - d="M 2.0168467,43.944859 L 1.9780137,3.0545252 L 21.92031,3.0987194 L 21.964504,33.018175 L 2.0168467,43.944859 z " - style="opacity:1;color:#000000;fill:url(#linearGradient9864);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <path - style="opacity:0.42222224;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible" - d="M 1.9489857,43.944859 L 22.097088,33.062369 L 3.5355337,41.989592 L 3.5355337,3.0103306 L 1.9650707,3.0103306 L 1.9489857,43.944859 z " - id="path1360" - inkscape:r_cx="true" - inkscape:r_cy="true" - sodipodi:nodetypes="cccccc" /> - <path - style="opacity:1;color:#000000;fill:url(#radialGradient9876);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 2.0239957,43.757359 L 1.9791847,3.0545252 L 21.92031,3.0545252 L 21.741064,33.681088 L 2.0239957,43.757359 z " - id="path9866" - sodipodi:nodetypes="ccccc" - inkscape:r_cx="true" - inkscape:r_cy="true" /> - <path - sodipodi:nodetypes="cccsscc" - id="path9878" - d="M 17.62221,18.456195 L 19.544657,20.908971 L 18.086249,25.726136 C 18.086249,25.726136 18.351414,27.228738 19.124812,26.212272 C 19.89821,25.195806 22.097267,22.630218 21.710171,20.754291 C 21.422909,19.362175 20.627414,18.699263 20.627414,18.699263 L 17.62221,18.456195 z " - style="opacity:1;color:#000000;fill:url(#linearGradient9886);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <path - sodipodi:nodetypes="csccscs" - id="path9862" - d="M 19.456269,17.35134 C 19.456269,17.35134 21.619539,18.353058 21.688074,19.229593 C 21.789855,20.531315 17.445433,24.665476 17.445433,24.665476 C 16.9372,25.284194 16.097511,24.731767 16.56155,24.135146 C 16.56155,24.135146 20.028154,20.017173 19.809822,19.693631 C 19.536211,19.288174 17.843181,18.655068 17.843181,18.655068 C 16.826715,17.903768 18.110802,16.349605 19.456269,17.35134 z " - style="opacity:1;color:#000000;fill:url(#linearGradient9902);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <path - style="fill:url(#linearGradient6371);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6421);opacity:0.87428571" - d="M 22.229185,3.5 L 21.729185,33.25 L 3.7291847,43 L 32.979185,43.25 L 32.729185,3.5 L 22.229185,3.5 z " - id="path6355" /> - <g - id="g6455" - transform="matrix(-1,0,0,1,48.201368,-4.7335e-2)"> - <path - transform="matrix(0.77849,0,0,0.77849,-7.579815,1.598139)" - d="M 40.481863 36.421127 A 15.644737 8.3968935 0 1 1 9.1923885,36.421127 A 15.644737 8.3968935 0 1 1 40.481863 36.421127 z" - sodipodi:ry="8.3968935" - sodipodi:rx="15.644737" - sodipodi:cy="36.421127" - sodipodi:cx="24.837126" - id="path8660" - style="opacity:0.29946522;color:#000000;fill:url(#radialGradient6461);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - sodipodi:type="arc" /> - <path - sodipodi:nodetypes="cccccccc" - id="path8643" - d="M 1.7317981,17.593819 L 1.7317981,30.355364 L 9.6641034,30.355364 L 9.6641034,36.176147 L 21.887745,23.952503 L 9.5913424,11.656101 L 9.5913424,17.597067 L 1.7317981,17.593819 z " - style="opacity:1;color:#000000;fill:#cc0000;fill-opacity:1;fill-rule:evenodd;stroke:#a40000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <path - sodipodi:nodetypes="cccccc" - id="path8645" - d="M 9.9240084,12.478043 L 9.9240084,18.115661 L 2.0746151,18.115661 L 2.0746151,24.53144 C 12.332521,20.703863 11.954992,27.773987 21.29428,23.94641 L 9.9240084,12.478043 z " - style="opacity:0.5080214;color:#000000;fill:url(#radialGradient6463);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> - <path - style="opacity:0.48128339;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6465);stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - d="M 2.6834412,18.565933 L 2.6834412,29.355867 L 10.584702,29.355867 L 10.584702,33.481479 L 20.127982,23.941908 L 10.522155,13.997214 L 10.522155,18.568726 L 2.6834412,18.565933 z " - id="path8658" - sodipodi:nodetypes="cccccccc" /> - </g> - </g> -</svg> diff --git a/source/memmap.cpp b/source/memmap.cpp index 9ff1c02..037d357 100644 --- a/source/memmap.cpp +++ b/source/memmap.cpp @@ -111,8 +111,6 @@ #include "spc7110.h" #include "seta.h" -#include "unzip/unzip.h" - #ifdef DS2_DMA //#include "ds2_cpu.h" //#include "ds2_dma.h" diff --git a/source/nds/bdf_font.c b/source/nds/bdf_font.c deleted file mode 100644 index aff3b94..0000000 --- a/source/nds/bdf_font.c +++ /dev/null @@ -1,1086 +0,0 @@ -/* bdf_font.c - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -//v1.1 - -#include "port.h" -#include <string.h> -#include "ds2_types.h" -#include "ds2_malloc.h" -#include "ds2io.h" -#include "fs_api.h" -#include "bdf_font.h" -#include "gui.h" - - -#define BDF_PICTOCHAT "SYSTEM/Pictochat-16.bdf" -#define BDF_SONG "SYSTEM/song.bdf" -#define ODF_PICTOCHAT "SYSTEM/Pictochat-16.odf" -#define ODF_SONG "SYSTEM/song.odf" - -#define HAVE_ODF // Define this if you have generated Pictochat-16.odf [Neb] -// #define DUMP_ODF // Define this if you want to regenerate Pictochat-16.odf [Neb] - -#define BDF_LIB_NUM 2 -#define ODF_VERSION "1.0" - -struct bdflibinfo bdflib_info[BDF_LIB_NUM]; -struct bdffont *bdf_font; //ASCII charactor -struct bdffont *bdf_nasci; //non-ASCII charactor -static u32 font_height; -static u32 fonts_max_height; - -/*----------------------------------------------------------------------------- -------------------------------------------------------------------------------*/ -static u32 bitmap_code(unsigned char *code, unsigned char *bitmap) -{ - unsigned char *map; - u8 a, b; - u32 len; - - len= 0; - map= (unsigned char*)bitmap; - while(*map) - { - // One hex character represents the state of 4 successive pixels - if(*map != 0x0A) - { - if (*map <= '9') a= *map - '0'; - else if (*map <= 'F') a= *map - 'A' + 10; - else if (*map <= 'f') a= *map - 'a' + 10; - map++; - - if (*map <= '9') b= *map - '0'; - else if (*map <= 'F') b= *map - 'A' + 10; - else if (*map <= 'f') b= *map - 'a' + 10; - - *code++ = (a << 4) | b; - len++; - } - map++; - } - - return len; -} - -/*----------------------------------------------------------------------------- -------------------------------------------------------------------------------*/ -/* -* example -* -* STARTCHAR <arbitrary number or name> -* ENCODING 8804 -* SWIDTH 840 0 -* DWIDTH 14 0 -* BBX 10 12 2 1 -* BITMAP -* 00C0 -* 0300 -* 1C00 -* 6000 -* 8000 -* 6000 -* 1C00 -* 0300 -* 00C0 -* 0000 -* 0000 -* FFC0 -* ENDCHAR -*/ - -/*----------------------------------------------------------------------------- -* filename: bdf file's name, including path -* start: the coding of first font to parse -* span: number of fonts begin at start to parse -* *bdflibinfop: font library information -* method: font index method; 0-absolut sequence; 1-relative sequence; 2-compact; -* others reserved -* return: if error return < 0; else return= char numbers -------------------------------------------------------------------------------*/ -static int parse_bdf(char *filename, u32 start, u32 span, struct bdflibinfo *bdflibinfop, u32 method) -{ - FILE *fp; - char string[256]; - char map[256]; - char *pt; - unsigned char *bitbuff; - int num, x_off, y_off, ret; - u32 tmp, i, end, length, index; - struct bdffont *bdffontp; - - //initial bdflibinfo - bdflibinfop -> width= 0; - bdflibinfop -> height= 0; - bdflibinfop -> start= 0; - bdflibinfop -> span= 0; - bdflibinfop -> maplen= 0; - bdflibinfop -> mapmem= NULL; - bdflibinfop -> fonts= NULL; - - fp= fopen(filename, "r"); //Open bdf font library - if(fp == NULL) - return -1; - - ret= 0; - //SIZE - while(1) - { - pt= fgets(string, 255, fp); - if(pt == NULL) - { - ret= -2; - goto parse_bdf_error; - } - if(!(strncasecmp(string, "SIZE ", 5))) - break; - } - - //FONTBOUNDINGBOX - pt= fgets(string, 255, fp); - pt += 16; - bdflibinfop -> width= atoi(pt); - pt = 1 + strchr(pt, ' '); - bdflibinfop -> height= atoi(pt); - pt = 1 + strchr(pt, ' '); - x_off= atoi(pt); - pt = 1 + strchr(pt, ' '); - y_off= atoi(pt); - - //CHARS - while(1) - { - pt= fgets(string, 255, fp); - if(pt == NULL) - { - ret= -3; - goto parse_bdf_error; - } - if(!(strncasecmp(string, "CHARS ", 6))) - break; - } - pt += 6; - ret= atoi(pt); - - if (method == 1) - bdflibinfop -> start= start; - switch (method) { - case 0: - default: - bdflibinfop -> span= span + start; - break; - case 1: - bdflibinfop -> span= span; - break; - } - - //construct bdf font information - bdffontp= (struct bdffont*)malloc(span * sizeof(struct bdffont)); - if(bdffontp == NULL) - { - ret= -4; - goto parse_bdf_error; - } - bdflibinfop -> fonts= bdffontp; - - bitbuff= (unsigned char*)malloc((bdflibinfop -> width * bdflibinfop -> height * span) >> 3); - if(bitbuff == NULL) - { - ret= -5; - goto parse_bdf_error; - } - bdflibinfop -> mapmem= bitbuff; - - tmp= bdflibinfop -> width << 16; - for(i= 0; i < span; i++) - { - bdffontp[i].dwidth= tmp; - bdffontp[i].bbx= 0; - } - - end= start + span; - //STARTCHAR START - while(1) - { - pt= fgets(string, 255, fp); - if(pt == NULL) - { - ret= -6; - goto parse_bdf_error; - } - if(!(strncasecmp(string, "STARTCHAR ", 10))) - { - break; - } - } - - i= 0; - length= 0; - while(1) - { - //ENCODING - while(1) - { - pt= fgets(string, 255, fp); - if(pt == NULL) goto parse_bdf_error; - if(!(strncasecmp(string, "ENCODING ", 9))) break; - } - - pt= string + 9; - index= atoi(pt); - if(index < start || index >= end) break; - - if(method == 0) i= index; - else if(method == 1) i= index-start; - else i++; - - //SWIDTH - pt= fgets(string, 255, fp); - if(pt == NULL) {ret= -8; goto parse_bdf_error;} - - //DWIDTH - pt= fgets(string, 255, fp); - if(pt == NULL) {ret= -9; goto parse_bdf_error;} - - pt += 7; - num= atoi(pt); - tmp= num << 16; - pt= 1+ strchr(pt, ' '); - num= atoi(pt); - tmp |= num & 0xFFFF; - - bdffontp[i].dwidth= tmp; - - //BBX - pt= fgets(string, 255, fp); - if(pt == NULL) {ret= -10; goto parse_bdf_error;} - - pt += 4; - num= atoi(pt); - tmp= num & 0xFF; - - pt= 1+ strchr(pt, ' '); - num= atoi(pt); - tmp= tmp<<8 | (num & 0xFF); - - pt= 1+ strchr(pt, ' '); - num= atoi(pt); - num= num - x_off; - tmp= tmp<<8 | (num & 0xFF); - - pt= 1+ strchr(pt, ' '); - num= atoi(pt); - num= num - y_off; - tmp= tmp <<8 | (num & 0xFF); - - bdffontp[i].bbx= tmp; - - //BITMAP - pt= fgets(string, 255, fp); - if(pt == NULL) {ret= -11; goto parse_bdf_error;} - - map[0]= '\0'; - while(1) - { - pt= fgets(string, 255, fp); - if(pt == NULL) {ret= -12; goto parse_bdf_error;} - if(!strncasecmp(pt, "ENDCHAR", 7)) break; - strcat(map, pt); - } - - tmp = bitmap_code(bitbuff, (unsigned char*)map); - - if(tmp) - bdffontp[i].bitmap = bitbuff; - else - bdffontp[i].bitmap = NULL; - - bitbuff += tmp; - length += tmp; - } - -parse_bdf_error: - fclose(fp); - if(ret < 0) - { - if(bdflibinfop -> fonts != NULL) - free((void*)bdflibinfop -> fonts); - if(bdflibinfop -> mapmem != NULL) - free((void*)bdflibinfop -> mapmem); - bdflibinfop -> fonts = NULL; - bdflibinfop -> mapmem = NULL; - } - else - { - bdflibinfop -> maplen = length; - bdflibinfop -> mapmem = (unsigned char*)realloc((void*)bdflibinfop -> mapmem, length); - } - - return ret; -} - -/*----------------------------------------------------------------------------- -------------------------------------------------------------------------------*/ -int dump2odf(char *filename, struct bdflibinfo *bdflibinfop) -{ - char *pt; - char string[256]; - FILE *fp; - u32 mapaddr; - u32 fontaddr; - u32 num; - char buff[1024]; - u32 i, j; - - - strcpy(string, filename); - pt= strrchr(string, '.'); - if(!strcasecmp(pt, ".bdf")) - strcpy(pt, ".odf"); - else - return -1; - - fp= fopen(string, "wb"); - if(fp == NULL) - return -2; - - pt= buff; - strcpy(pt, "ODF"); - pt += 4; - strcpy(pt, ODF_VERSION); - pt += 4; - - struct bdflibinfo *bdflibinfo_i; - - memcpy(pt, (char*)bdflibinfop, sizeof(struct bdflibinfo)); - bdflibinfo_i= (struct bdflibinfo *)pt; - bdflibinfo_i -> mapmem= NULL; - bdflibinfo_i -> fonts= NULL; - pt += sizeof(struct bdflibinfo); - - num= pt-buff; - fwrite(buff, num, 1, fp); //write odf file header - - num= (u32)bdflibinfop -> span; - mapaddr= (u32)bdflibinfop -> mapmem; - fontaddr= (u32)bdflibinfop -> fonts; - - while(num) - { - struct bdffont *bdffontp; - - i= 1024/sizeof(struct bdffont); - if(num > i) num -= i; - else i= num, num= 0; - - memcpy(buff, (char*)fontaddr, i*sizeof(struct bdffont)); - fontaddr += i*sizeof(struct bdffont); - bdffontp= (struct bdffont*)buff; - - for(j= 0; j< i; j++) - bdffontp[j].bitmap -= mapaddr; - - fwrite(buff, i*sizeof(struct bdffont), 1, fp); - } - - fwrite((char*)mapaddr, bdflibinfop -> maplen, 1, fp); - - fclose(fp); - return 0; -} - -/*----------------------------------------------------------------------------- -------------------------------------------------------------------------------*/ -int init_from_odf(char *filename, struct bdflibinfo *bdflibinfop) -{ - FILE *fp; - char buff[512]; - char *pt; - u32 len, tmp; - u32 span, maplen; - struct bdffont *bdffontp; - - //initial bdflibinfo - bdflibinfop -> width= 0; - bdflibinfop -> height= 0; - bdflibinfop -> start= 0; - bdflibinfop -> span= 0; - bdflibinfop -> maplen= 0; - bdflibinfop -> mapmem= NULL; - bdflibinfop -> fonts= NULL; - - fp= fopen(filename, "rb"); - if(fp == NULL) - return -1; - - tmp= 8 + sizeof(struct bdflibinfo); - len= fread(buff, 1, tmp, fp); - if(len < tmp) - { - fclose(fp); - return -2; - } - - pt= buff; - if(strcmp(pt, "ODF")) - { - fclose(fp); - return -2; - } - - pt += 4; - if(strcmp(pt, ODF_VERSION)) - { - fclose(fp); - return -3; - } - - pt += 4; - memcpy((char*)bdflibinfop, pt, sizeof(struct bdflibinfo)); - - span= bdflibinfop -> span; - if(span == 0) - { - fclose(fp); - return -4; - } - - maplen= bdflibinfop -> maplen; - if(maplen == 0) - { - fclose(fp); - return -5; - } - - bdffontp= (struct bdffont*)malloc(span * sizeof(struct bdffont)); - if(bdffontp == NULL) - { - fclose(fp); - return -6; - } - - len= fread((char*)bdffontp, 1, span * sizeof(struct bdffont), fp); - if(len != span * sizeof(struct bdffont)) - { - free((void*)bdffontp); - fclose(fp); - return -7; - } - - pt= (char*)malloc(maplen); - len= fread(pt, 1, maplen, fp); - if(len != maplen) - { - free((void*)bdffontp); - free((void*)pt); - fclose(fp); - return -8; - } - - bdflibinfop -> mapmem = (unsigned char*)pt; - bdflibinfop -> fonts = bdffontp; - - u32 i, j; - j= (u32)bdflibinfop -> mapmem; - for(i= 0; i < span; i++) - bdffontp[i].bitmap += j; - - fclose(fp); - return 0; -} - -int BDF_font_init(void) -{ - int err; - char tmp_path[MAX_PATH]; - - fonts_max_height= 0; -#ifndef HAVE_ODF - sprintf(tmp_path, "%s/%s", main_path, BDF_PICTOCHAT); - err= parse_bdf(tmp_path, 32 /* from SPACE */, 8564 /* to one past the last character, "DOWNWARDS ARROW" */, &bdflib_info[0], 1); - if(err < 0) - { - printf("BDF 0 initial error: %d\n", err); - return -1; - } -#else - sprintf(tmp_path, "%s/%s", main_path, ODF_PICTOCHAT); - err= init_from_odf(tmp_path, &bdflib_info[0]); - if(err < 0) - { - printf("ODF 0 initial error: %d\n", err); - return -1; - } -#endif - bdf_font= bdflib_info[0].fonts; - font_height= bdflib_info[0].height; - if(fonts_max_height < bdflib_info[0].height) - fonts_max_height = bdflib_info[0].height; - -#ifdef DUMP_ODF - sprintf(tmp_path, "%s/%s", main_path, BDF_PICTOCHAT); - err= dump2odf(tmp_path, &bdflib_info[0]); - if(err < 0) - { - printf("BDF dump odf 0 error: %d\n", err); - } -#endif - -#ifndef HAVE_ODF - sprintf(tmp_path, "%s/%s", main_path, BDF_SONG); - err= parse_bdf(tmp_path, 0x4E00, 20902, &bdflib_info[1], 1); - if(err < 0) - { - printf("BDF 1 initial error: %d\n", err); - return -1; - } -#else - sprintf(tmp_path, "%s/%s", main_path, ODF_SONG); - err= init_from_odf(tmp_path, &bdflib_info[1]); - if(err < 0) - { - printf("ODF 1 initial error: %d\n", err); - return -1; - } -#endif - bdf_nasci= bdflib_info[1].fonts; - if(fonts_max_height < bdflib_info[1].height) - fonts_max_height = bdflib_info[1].height; - -#ifdef DUMP_ODF - sprintf(tmp_path, "%s/%s", main_path, BDF_SONG); - err= dump2odf(tmp_path, &bdflib_info[1]); - if(err < 0) - { - printf("BDF dump odf 1 error: %d\n", err); - } -#endif - - return 0; -} - -/*----------------------------------------------------------------------------- -// release resource of BDF fonts -------------------------------------------------------------------------------*/ -void BDF_font_release(void) -{ - u32 i; - - for(i= 0; i < BDF_LIB_NUM; i++) - { - if(bdflib_info[i].fonts) - free((void*)bdflib_info[i].fonts); - if(bdflib_info[i].mapmem) - free((void*)bdflib_info[i].mapmem); - } -} - -/*---------------------------------------------------------------------------- -//16-bit color -// Unicode Character -// back is background, 0x8000 is transparence, other are visable colors -------------------------------------------------------------------------------*/ -u32 BDF_render16_ucs(void* screen_address, u32 screen_w, u32 v_align, u32 back, u32 front, u16 ch) -{ - unsigned short *screen, *screenp; - unsigned char *map; - u32 width, height, x_off, y_off, i, k, m, ret, fonts_height; - unsigned char cc; - struct bdffont *bdffontp; - - int font_num; - bool found = 0; - for (font_num = 0; font_num < BDF_LIB_NUM && !found; font_num++) { - if(bdflib_info[font_num].fonts != NULL) - { - k = bdflib_info[font_num].start; - if (ch < k) - continue; - m = k + bdflib_info[font_num].span; - if (ch >= m) - continue; - ch -= k; - bdffontp= bdflib_info[font_num].fonts; - fonts_height= bdflib_info[font_num].height; - found = 1; - } - } - if (!found) - return 8; // the width of an undefined character, not an error code - - width= bdffontp[ch].dwidth >> 16; - ret= width; - height= fonts_max_height; - //if charactor is not transparent - if(!(back & 0x8000)) - { - for(k= 0; k < height; k++) - { - screenp= (unsigned short*)screen_address + k *screen_w; - for(i= 0; i < width; i++) - *screenp++ = back; - } - } - - width= bdffontp[ch].bbx >> 24; - if(width == 0) - return ret; - - height= (bdffontp[ch].bbx >> 16) & 0xFF; - x_off= (bdffontp[ch].bbx >> 8) & 0xFF; - y_off= bdffontp[ch].bbx & 0xFF; - - if(v_align== 0) //v align bottom - screen= (unsigned short*)screen_address + x_off + (fonts_max_height - height - y_off) *screen_w; - else if(v_align== 1) //v align center - screen= (unsigned short*)screen_address + x_off + (fonts_max_height - height - y_off)/2 *screen_w; - else //v align top - screen= (unsigned short*)screen_address + x_off; - - x_off= width >> 3; - y_off= width & 7; - - map= bdffontp[ch].bitmap; - for(k= 0; k < height; k++) - { - screenp = screen + k *screen_w; - i= x_off; - while(i--) - { - m= 0x80; - cc= *map++; - while(m) - { - if(m & cc) *screenp = front; - screenp++; - m >>= 1; - } - } - - i= y_off; - if(i) - { - i= 8 - y_off; - cc= *map++; - cc >>= i; - m= 0x80 >> i; - while(m) - { - if(m & cc) *screenp = front; - screenp++; - m >>= 1; - } - } - } - - return ret; -} - -/* Returns the width, in pixels, of a character given its UCS-16 codepoint. */ -u32 BDF_width16_ucs(u16 ch) -{ - u32 k, ret; - - int font_num; - for (font_num = 0; font_num < BDF_LIB_NUM; font_num++) { - if(bdflib_info[font_num].fonts != NULL) - { - k = bdflib_info[font_num].start; - if (ch < k) - continue; - if (ch > k + bdflib_info[font_num].span) - continue; - ch -= k; - return bdflib_info[font_num].fonts[ch].dwidth >> 16; - } - } - return 8; // the width of an undefined character, not an error code -} - -/*----------------------------------------------------------------------------- -//16-bit color -// ASCII Character -// back is background, 0x8000 is transparence, other are visable colors -------------------------------------------------------------------------------*/ -static u32 BDF_render16_font(char *screen_address, u32 back, u32 front, u16 ch) -{ - unsigned short *screen, *screenp; - unsigned char *map; - u32 width, height, x_off, y_off, i, k, m, ret; - unsigned char cc; - - if(ch > 127) - return 8; - - width= bdf_font[ch].dwidth >> 16; - ret= width; - height= font_height; - //if charactor is not transparent - if(!(back & 0x8000)) - { - for(k= 0; k < height; k++) - { - screenp= (unsigned short*)screen_address + k *SCREEN_WIDTH; - for(i= 0; i < width; i++) - *screenp++ = back; - } - } - - width= bdf_font[ch].bbx >> 24; - if(width == 0) - return ret; - height= (bdf_font[ch].bbx >> 16) & 0xFF; - x_off= (bdf_font[ch].bbx >> 8) & 0xFF; - y_off= bdf_font[ch].bbx & 0xFF; - screen= (unsigned short*)screen_address + x_off + (font_height - height -y_off) *SCREEN_WIDTH; - - x_off= width >> 3; - y_off= width & 7; - - map= bdf_font[ch].bitmap; - for(k= 0; k < height; k++) - { - screenp = screen + k *SCREEN_WIDTH; - i= x_off; - while(i--) - { - m= 0x80; - cc= *map++; - while(m) - { - if(m & cc) *screenp = front; - screenp++; - m >>= 1; - } - } - - i= y_off; - if(i) - { - i= 8 - y_off; - cc= *map++; - cc >>= i; - m= 0x80 >> i; - while(m) - { - if(m & cc) *screenp = front; - screenp++; - m >>= 1; - } - } - } - - return ret; -} - -/*----------------------------------------------------------------------------- -// ASCII Code Only -------------------------------------------------------------------------------*/ -void BDF_render_string(void* screen_address, u32 x, u32 y, u32 back, u32 front, char *string) -{ - char *pt; - u32 screenp, line_start; - u32 width, line, cmp; - - pt= string; - screenp= (u32)screen_address + (x + y *SCREEN_WIDTH)*2; - line= 1 + y; - line_start= (u32)screen_address + line *SCREEN_WIDTH *2; - - width= 0; - while(*pt) - { - if(*pt == 0x0D) - { - pt++; - continue; - } - if(*pt == 0x0A) - { - line += font_height; - line_start= (u32)screen_address + line *SCREEN_WIDTH *2; - screenp = line_start - SCREEN_WIDTH *2; - pt++; - continue; - } - - cmp = (bdf_font[(u32)(*pt)].dwidth >> 16) << 1; - if((screenp+cmp) >= line_start) - { - line += font_height; - line_start= (u32)screen_address + line *SCREEN_WIDTH *2; - screenp = line_start - SCREEN_WIDTH *2; - } - width= BDF_render16_font((char*)screenp, back, front, (u32)(*pt)); - screenp += width*2; - pt++; - } -} - -/*----------------------------------------------------------------------------- -------------------------------------------------------------------------------*/ -char* utf8decode(char *utf8, u16 *ucs) -{ - unsigned char c = *utf8++; - unsigned long code; - int tail = 0; - - if ((c <= 0x7f) || (c >= 0xc2)) { - /* Start of new character. */ - if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */ - code = c; - } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */ - tail = 1; - code = c & 0x1f; - } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */ - tail = 2; - code = c & 0x0f; - } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */ - tail = 3; - code = c & 0x07; - } else { - /* Invalid size. */ - code = 0; - } - - while (tail-- && ((c = *utf8++) != 0)) { - if ((c & 0xc0) == 0x80) { - /* Valid continuation character. */ - code = (code << 6) | (c & 0x3f); - - } else { - /* Invalid continuation char */ - code = 0xfffd; - utf8--; - break; - } - } - } else { - /* Invalid UTF-8 char */ - code = 0; - } - /* currently we don't support chars above U-FFFF */ - *ucs = (code < 0x10000) ? code : 0; - return utf8; -} - -unsigned char* skip_utf8_unit(unsigned char* utf8, unsigned int num) -{ - while(num--) - { - unsigned char c = *utf8++; - int tail = 0; - if ((c <= 0x7f) || (c >= 0xc2)) { - /* Start of new character. */ - if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */ - } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */ - tail = 1; - } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */ - tail = 2; - } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */ - tail = 3; - } else { /* Invalid size. */ - } - - while (tail-- && ((c = *utf8++) != 0)) { - if ((c & 0xc0) != 0x80) { - /* Invalid continuation char */ - utf8--; - break; - } - } - } - } - - /* currently we don't support chars above U-FFFF */ - return utf8; -} - -/*----------------------------------------------------------------------------- -// UTF8 Code String -------------------------------------------------------------------------------*/ -void BDF_render_mix(void* screen_address, u32 screen_w, u32 x, u32 y, u32 v_align, - u32 back, u32 front, char *string) -{ - char *pt; - u32 screenp, line_start; - u32 width, line, cmp, start, end; - u16 unicode; - struct bdffont *bdf_fontp[2]; - - bdf_fontp[0]= bdflib_info[0].fonts; - start= bdflib_info[1].start; - end= start + bdflib_info[1].span; - bdf_fontp[1]= bdflib_info[1].fonts; - - pt= string; - screenp= (u32)screen_address + (x + y *screen_w)*2; - line= 1 + y; - line_start= (u32)screen_address + line *screen_w *2; - - width= 0; - while(*pt) - { - pt= utf8decode(pt, &unicode); - - if(unicode == 0x0D) continue; - if(unicode == 0x0A) - { - line += font_height; - line_start= (u32)screen_address + line *screen_w *2; - screenp = line_start - screen_w *2; - continue; - } - - /* If the text would go beyond the end of the line, go back to the - * start instead. */ - cmp = BDF_width16_ucs(unicode); - - if((screenp+cmp) >= line_start) - { - line += font_height; - line_start= (u32)screen_address + line *screen_w *2; - screenp = line_start - screen_w *2; - } - - width= BDF_render16_ucs((unsigned short*)screenp, screen_w, v_align, back, front, unicode); - screenp += width*2; - } -} - -/*----------------------------------------------------------------------------- -- count UNICODE charactor numbers in width pixels, input are UTF8, not UNICODE-16 -- direction 0: count UNICODE charactor numbers in width pixels, from end, -- return bytes numbers -- direction 1: count UNICODE charactor numbers in width pixels, from front, -- return bytes numbers -- direction 2: count total pixel width of the string -------------------------------------------------------------------------------*/ -u32 BDF_cut_string(char *string, u32 width, u32 direction) -{ - char *pt; - u16 unicode[256]; - u32 len, xw; - - if(direction > 2) return -1; - - pt= string; - len= 0; - while(*pt) - { - pt= utf8decode(pt, &unicode[len]); - if(unicode[len] != 0x0A) - { - len++; - if(len >= 256) break; - } - } - - if(len >= 256) return -1; - - u16 *unicodep; - if(direction == 0) - unicodep= &unicode[len-1]; - else - unicodep= &unicode[0]; - - if(direction == 2) direction = 3; - xw= BDF_cut_unicode(unicodep, len, width, direction); - - if(direction < 2) - { - if(direction < 1) - xw= len - xw; - - pt= string; - while(xw) - { - pt= utf8decode(pt, unicodep); - if(unicode[xw] != 0x0A) xw--; - } - - xw= pt -string; - } - - return xw; -} - -/*----------------------------------------------------------------------------- -- count UNICODE charactor numbers in width pixels -- direction 0: count UNICODE charactor numbers in width pixels, from end -- direction 1: count UNICODE charactor numbers in width pixels, from front -- direction 2: conut total pixel width of len UNICODE charachtors, from end -- direction 3: conut total pixel width of len UNICODE charachtors, from front -------------------------------------------------------------------------------*/ -u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction) -{ - u32 i, lastSpace = 0, xw, num; - u16 unicode; - u32 start, end; - struct bdffont *bdf_fontp[2]; - - bdf_fontp[0]= bdflib_info[0].fonts; - start= bdflib_info[1].start; - end= start + bdflib_info[1].span; - bdf_fontp[1]= bdflib_info[1].fonts; - - if(direction < 2) - { - if(direction < 1) direction = -1; - - i= 0; - xw = 0; - num= len; - while(len > 0) - { - unicode= unicodes[i]; - if (unicode == 0x0A) - return num - len; - else if (unicode == ' ') - lastSpace = len; - - xw += BDF_width16_ucs(unicode); - - if(xw > width) return num - lastSpace; - i += direction; - len--; - } - - return num - len; - } - else - { - if(direction < 3) direction = -1; - else direction = 1; - - i= 0; - xw = 0; - while(len-- > 0) - { - unicode= unicodes[i]; - xw += BDF_width16_ucs(unicode); - i += direction; - } - - num= xw; - - return num; - } -} - - diff --git a/source/nds/bdf_font.h b/source/nds/bdf_font.h deleted file mode 100644 index 074f5de..0000000 --- a/source/nds/bdf_font.h +++ /dev/null @@ -1,64 +0,0 @@ -/* bdf_font.h - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __BDF_FONT_H__ -#define __BDF_FONT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -struct bdffont{ - unsigned int dwidth; //byte 3:2 x-distance; 1:0 y-distance - unsigned int bbx; //byte 3 x-width; 2 y-height; 1 x-offset; 0 y-offset - unsigned char *bitmap; -}; - -struct bdflibinfo{ - unsigned int width; - unsigned int height; - unsigned int start; - unsigned int span; - unsigned int maplen; - unsigned char *mapmem; - struct bdffont *fonts; -}; - - -/*----------------------------------------------------------------------------- -------------------------------------------------------------------------------*/ -extern int BDF_font_init(void); -extern void BDF_render_string(void* screen_address, unsigned int x, unsigned int y, unsigned int back, - unsigned int front, char *string); -extern unsigned int BDF_render16_ucs(void* screen_address, unsigned int screen_w, - unsigned int v_align, unsigned int back, unsigned int front, unsigned short ch); -extern void BDF_render_mix(void* screen_address, unsigned int screen_w, unsigned int x, - unsigned int y, unsigned int v_align, unsigned int back, unsigned int front, char *string); -//extern unsigned int BDF_string_width(char *string, unsigned int *len); -extern char* utf8decode(char *utf8, unsigned short *ucs); -extern unsigned char* skip_utf8_unit(unsigned char* utf8, unsigned int num); -extern unsigned int BDF_cut_unicode(unsigned short *unicodes, unsigned int len, unsigned int width, unsigned int direction); -extern unsigned int BDF_cut_string(char *string, unsigned int width, unsigned int direction); -extern void BDF_font_release(void); - -#ifdef __cplusplus -} -#endif - -#endif //__BDF_FONT_H__ diff --git a/source/nds/bitmap.c b/source/nds/bitmap.c deleted file mode 100644 index efeb11c..0000000 --- a/source/nds/bitmap.c +++ /dev/null @@ -1,224 +0,0 @@ -/* bitmap.c - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -//v1.1 - -#include "fs_api.h" -#include "bitmap.h" -#include "ds2_malloc.h" - -int BMP_read(char* filename, char *buf, unsigned int width, unsigned int height, unsigned int* type) -{ - FILE* fp; - BMPHEADER bmp_header; - int flag; - u32 bytepixel; - u32 x, y, sx, sy, m; - unsigned char *dest; - s32 fpos; - unsigned short st[54/2]; - - fp= fopen(filename, "rb"); - if(fp == NULL) - return BMP_ERR_OPENFAILURE; - - flag= fread(st, sizeof(st), 1, fp); - if(!flag) { - fclose(fp); - return BMP_ERR_FORMATE; - } - - bmp_header.bfType= st[0]; - bmp_header.bfSize= st[1] | (st[2]<<16); - bmp_header.bfReserved0= st[3]; - bmp_header.bfReserved1= st[4]; - bmp_header.bfImgoffst= st[5] | (st[6]<<16); - bmp_header.bfImghead.imHeadsize= st[7] | (st[8]<<16); - bmp_header.bfImghead.imBitmapW= st[9] | (st[10]<<16); - bmp_header.bfImghead.imBitmapH= st[11] | (st[12]<<16); - bmp_header.bfImghead.imPlanes= st[13]; - bmp_header.bfImghead.imBitpixel= st[14]; - bmp_header.bfImghead.imCompess= st[15] | (st[16]<<16); - bmp_header.bfImghead.imImgsize= st[17] | (st[18]<<16); - bmp_header.bfImghead.imHres= st[19] | (st[20]<<16); - bmp_header.bfImghead.imVres= st[21] | (st[22]<<16); - bmp_header.bfImghead.imColnum= st[23] | (st[24]<<16); - bmp_header.bfImghead.imImcolnum= st[25] | (st[26]<<16); - - if(bmp_header.bfType != 0x4D42) { //"BM" - fclose(fp); - return BMP_ERR_FORMATE; - } - - if(bmp_header.bfImghead.imCompess != BI_RGB && - bmp_header.bfImghead.imCompess != BI_BITFIELDS) { - fclose(fp); - return BMP_ERR_NEED_GO_ON; //This funciton now not support... - } - - bytepixel= bmp_header.bfImghead.imBitpixel >> 3; - if(bytepixel < 2) { //byte per pixel >= 2 - fclose(fp); - return BMP_ERR_NEED_GO_ON; //This funciton now not support... - } - - *type = bytepixel; - - x= width; - y= height; - sx= bmp_header.bfImghead.imBitmapW; - sy= bmp_header.bfImghead.imBitmapH; - if(x > sx) - x= sx; - if(y > sy) - y= sy; - - // Expect a certain amount of bytes and read them all at once. - unsigned int BytesPerLine = (sx * bytepixel + 3) & ~3; - char* FileBuffer = (char*) malloc(BytesPerLine * (sy - 1) + sx * bytepixel); - if (FileBuffer == NULL) { - fclose(fp); - return BMP_ERR_NEED_GO_ON; // Memory allocation error - } - - fseek(fp, (s32) bmp_header.bfImgoffst, SEEK_SET); - m = fread(FileBuffer, 1, BytesPerLine * (sy - 1) + sx * bytepixel, fp); - - if (m < BytesPerLine * (sy - 1) + sx * bytepixel) { - free(FileBuffer); - fclose(fp); - return BMP_ERR_FORMATE; // incomplete file - } - - // Reorder all the bytes, because scanlines are from bottom to top. - for (m = 0; m < y; m++) { - memcpy(buf + m * x * bytepixel, FileBuffer + (sy - m - 1) * BytesPerLine, x * bytepixel); - } - - free(FileBuffer); - fclose(fp); - - return BMP_OK; -} - -/* -* open BMP file -*/ -int openBMP(BMPINFO* bmpInfo, const char* file) -{ - FILE* fp; - unsigned short st[54/2]; - int len; - - bmpInfo->fp = NULL; - - fp = fopen(file, "r"); - if(NULL == fp) - return BMP_ERR_OPENFAILURE; - - len = fread((void*)st, 1, sizeof(BMPHEADER), fp); - if(len < sizeof(BMPHEADER)) { - fclose(fp); - return BMP_ERR_FORMATE; - } - - bmpInfo->bmpHead.bfType= st[0]; - bmpInfo->bmpHead.bfSize= st[1] | (st[2]<<16); - bmpInfo->bmpHead.bfReserved0= st[3]; - bmpInfo->bmpHead.bfReserved1= st[4]; - bmpInfo->bmpHead.bfImgoffst= st[5] | (st[6]<<16); - bmpInfo->bmpHead.bfImghead.imHeadsize= st[7] | (st[8]<<16); - bmpInfo->bmpHead.bfImghead.imBitmapW= st[9] | (st[10]<<16); - bmpInfo->bmpHead.bfImghead.imBitmapH= st[11] | (st[12]<<16); - bmpInfo->bmpHead.bfImghead.imPlanes= st[13]; - bmpInfo->bmpHead.bfImghead.imBitpixel= st[14]; - bmpInfo->bmpHead.bfImghead.imCompess= st[15] | (st[16]<<16); - bmpInfo->bmpHead.bfImghead.imImgsize= st[17] | (st[18]<<16); - bmpInfo->bmpHead.bfImghead.imHres= st[19] | (st[20]<<16); - bmpInfo->bmpHead.bfImghead.imVres= st[21] | (st[22]<<16); - bmpInfo->bmpHead.bfImghead.imColnum= st[23] | (st[24]<<16); - bmpInfo->bmpHead.bfImghead.imImcolnum= st[25] | (st[26]<<16); - - if(bmpInfo->bmpHead.bfType != 0x4D42) //"BM" - { - fclose(fp); - return BMP_ERR_FORMATE; - } - - if(bmpInfo->bmpHead.bfImghead.imCompess != BI_RGB && - bmpInfo->bmpHead.bfImghead.imCompess != BI_BITFIELDS) - { - fclose(fp); - return BMP_ERR_NEED_GO_ON; //This funciton now not support... - } - - bmpInfo->fp = fp; - - return BMP_OK; -} - -/* -* read pixel form BMP file -*/ -int readBMP(BMPINFO* bmpInfo, unsigned int start_x, unsigned int start_y, - unsigned int width, unsigned int height, void* buffer) -{ - unsigned int m, n; - unsigned int bmp_w, bmp_h; - int fpos; - unsigned char* dst; - unsigned int bytepixel; - - bytepixel = bmpInfo->bmpHead.bfImghead.imBitpixel >> 3; - if(bytepixel < 2) //Not support <2 bytes per pixel now - return -1; - - //BMP scan from down to up - bmp_w = bmpInfo->bmpHead.bfImghead.imBitmapW; - bmp_h = bmpInfo->bmpHead.bfImghead.imBitmapH; - if(((start_x +1) > bmp_w) || ((start_y+1) > bmp_h)) return -1; - n = bmp_w - start_x; - if(n > width) n = width; //start_x + width < bmp_w - m = bmp_h - start_y; - if(m > height) m = height; //start_y + height < bmp_h - - fpos = (int)bmpInfo->bmpHead.bfImgoffst; - - fpos += (((bmp_w*bytepixel+3)>>2)<<2)*(bmp_h - start_y -1) + start_x*bytepixel; - dst = (unsigned char*)buffer; - n *= bytepixel; - while(m--) { - fseek(bmpInfo->fp, fpos, SEEK_SET); - fread(dst, 1, n, bmpInfo->fp); - fpos -= ((bmp_w*bytepixel+3)>>2)<<2; - dst += width*bytepixel; - } - - return 0; -} - -/* -* close BMP file -*/ -void closeBMP(BMPINFO* bmpInfo) -{ - if(NULL != bmpInfo->fp) - fclose(bmpInfo->fp); -} - - diff --git a/source/nds/bitmap.h b/source/nds/bitmap.h deleted file mode 100644 index c8f9c52..0000000 --- a/source/nds/bitmap.h +++ /dev/null @@ -1,111 +0,0 @@ -/* bitmap.c - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __BITMAP_H__ -#define __BITMAP_H__ -#include "ds2_types.h" -#include "fs_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _pixelmapheader{ - u32 imHeadsize; //Bitmap information header size - u32 imBitmapW; //bitmap width in pixel - u32 imBitmapH; //bitmap height in pixel - u16 imPlanes; //bitmap planes numbers, must be set to 1 - u16 imBitpixel; //bits per pixel - u32 imCompess; //compress method - u32 imImgsize; //image size, times of 4-byte - u32 imHres; //horizontal resolution, pixel/metel - u32 imVres; //vertical resolution, pixel/metel - u32 imColnum; //number of colors in color palette, 0 to exp(2) - u32 imImcolnum; //important colors numbers used -} IMAGEHEADER; - - -typedef struct _bitmapfileheader{ - u16 bfType; //BMP file types - u32 bfSize; //BMP file size(Not the pixel image size) - u16 bfReserved0;//reserved area0 - u16 bfReserved1;//reserved area1 - u32 bfImgoffst; //pixel data area offset - IMAGEHEADER bfImghead; -} BMPHEADER; - - -typedef struct _bitmapInfo{ - FILE* fp; - BMPHEADER bmpHead; -} BMPINFO; - -//#define NULL 0 - -//compression method -/* Value Identified by Compression method Comments -* 0 BI_RGB none Most common -* 1 BI_RLE8 RLE 8-bit/pixel Can be used only with 8-bit/pixel bitmaps -* 2 BI_RLE4 RLE 4-bit/pixel Can be used only with 4-bit/pixel bitmaps -* 3 BI_BITFIELDS Bit field Can be used only with 16 and 32-bit/pixel bitmaps. -* 4 BI_JPEG JPEG The bitmap contains a JPEG image -* 5 BI_PNG PNG The bitmap contains a PNG image -*/ -#define BI_RGB 0 -#define BI_RLE8 1 -#define BI_RLE4 2 -#define BI_BITFIELDS 3 -#define BI_JPEG 4 -#define BI_PNG 5 - -//error message -#define BMP_OK 0 -#define BMP_ERR_OPENFAILURE 1 -#define BMP_ERR_FORMATE 2 -#define BMP_ERR_NOTSUPPORT 3 -#define BMP_ERR_NEED_GO_ON 4 - - -#define FILEOPENCHECK(fp) (fp!=NULL) - - -extern int BMP_read(char* filename, char *buf, unsigned int width, - unsigned int height, unsigned int *type); - -/* -* open BMP file -*/ -extern int openBMP(BMPINFO* bmpInfo, const char* file); - -/* -* read pixel form BMP file -*/ -extern int readBMP(BMPINFO* bmpInfo, unsigned int start_x, unsigned int start_y, - unsigned int width, unsigned int height, void* buffer); - -/* -* close BMP file -*/ -extern void closeBMP(BMPINFO* bmpInfo); - -#ifdef __cplusplus -} -#endif - -#endif //__BITMAP_H__ diff --git a/source/nds/cheatgrp.c b/source/nds/cheatgrp.c deleted file mode 100644 index 75513e8..0000000 --- a/source/nds/cheatgrp.c +++ /dev/null @@ -1,100 +0,0 @@ -/* cheatgrp.c - * - * Copyright (C) 2013 GBAtemp user Nebuleon. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "cheatgrp.h" -#include "string.h" -#include "ds2_malloc.h" - -extern struct SCheatData Cheat; - -/* - * Obtains the names of cheat groups currently defined in the Snes9x cheat - * data. - * Cheats are grouped by name, because multipart codes share the same name - * when loaded. - * This function only handles consecutive codes with the same name. If two - * runs of codes have the same name, two identically-named groups will be - * written. Enabling or disabling either of these groups will also enable - * or disable the other if using NDSSFCEnableCheatGroup or - * NDSSFCDisableCheatGroup. - * OUT: NamePointers, an array of MAX_CHEATS_T + 1 pointers which are updated - * by this function. All pointers beyond the last group name are updated - * to point to NULL. - * NameMemory, an array of MAX_CHEATS_T * MAX_SFCCHEAT_NAME char values - * which is updated to hold the names of the groups. - */ -void NDSSFCGetCheatGroups (char** NamePointers, char* NameMemory) -{ - unsigned int NameIndex = 0, cheat; - char* dst = NameMemory; - for (cheat = 0; cheat < Cheat.num_cheats; cheat++) - { - if (cheat == 0 || strcmp(Cheat.c [cheat].name, Cheat.c [cheat - 1].name) != 0) - { - memcpy(dst, Cheat.c [cheat].name, MAX_SFCCHEAT_NAME * sizeof (char)); - NamePointers[NameIndex] = dst; - dst += MAX_SFCCHEAT_NAME; - NameIndex++; - } - } - for (; NameIndex < MAX_CHEATS_T + 1; NameIndex++) - { - NamePointers[NameIndex] = NULL; - } -} - -void NDSSFCEnableCheatGroup (char* GroupName) -{ - uint32 cheat; - for (cheat = 0; cheat < Cheat.num_cheats; cheat++) - { - if (strcmp(Cheat.c [cheat].name, GroupName) == 0) - { - S9xEnableCheat (cheat); - } - } -} - -void NDSSFCDisableCheatGroup (char* GroupName) -{ - uint32 cheat; - for (cheat = 0; cheat < Cheat.num_cheats; cheat++) - { - if (strcmp(Cheat.c [cheat].name, GroupName) == 0) - { - S9xDisableCheat (cheat); - } - } -} - -bool8 NDSSFCIsCheatGroupEnabled (char* GroupName) -{ - bool8 NameFound = FALSE; - uint32 cheat; - for (cheat = 0; cheat < Cheat.num_cheats; cheat++) - { - if (strcmp(Cheat.c [cheat].name, GroupName) == 0) - { - if (!Cheat.c [cheat].enabled) - return FALSE; - NameFound = TRUE; - } - } - return NameFound; -} diff --git a/source/nds/cheatgrp.h b/source/nds/cheatgrp.h deleted file mode 100644 index d84549a..0000000 --- a/source/nds/cheatgrp.h +++ /dev/null @@ -1,27 +0,0 @@ -/* cheatgrp.h - * - * Copyright (C) 2013 GBAtemp user Nebuleon. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "port.h" -#include "cheats.h" - -extern void NDSSFCGetCheatGroups (char** NamePointers, char* NameMemory); -extern void NDSSFCEnableCheatGroup (char* GroupName); -extern void NDSSFCDisableCheatGroup (char* GroupName); -extern bool8 NDSSFCIsCheatGroupEnabled (char* GroupName); - diff --git a/source/nds/displaymodes.cpp b/source/nds/displaymodes.cpp deleted file mode 100644 index 173ead3..0000000 --- a/source/nds/displaymodes.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* displaymodes.cpp - * - * Copyright (C) 2012 GBAtemp user Nebuleon. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include <stdio.h> - -//#include "ds2_types.h" -//#include "ds2io.h" - -#include "gfx.h" - -static uint16 SevenToSixScanlineResize (uint16 TopColour, uint16 BottomColour, uint8 TopFraction, uint8 BottomFraction) -{ - // Speed hacks! - if (TopColour == BottomColour) // Two colours identical (no calc) - return TopColour; - if (TopColour == 0x0000) // From black to a non-identical colour - return - // Red component - ( ( ((BottomColour >> 10) & 0x1F) * BottomFraction / 7 ) << 10 ) - // Green component - | ( ( ((BottomColour >> 5) & 0x1F) * BottomFraction / 7 ) << 5 ) - // Blue component - | ( ( (BottomColour & 0x1F) * BottomFraction / 7 ) ) - ; - if (BottomColour == 0x0000) // To black from a non-identical colour - return - // Red component - ( ( ((TopColour >> 10) & 0x1F) * TopFraction / 7 ) << 10 ) - // Green component - | ( ( ((TopColour >> 5) & 0x1F) * TopFraction / 7 ) << 5 ) - // Blue component - | ( ( (TopColour & 0x1F) * TopFraction / 7 ) ) - ; - return - // Red component - ( ( ((TopColour >> 10) & 0x1F) * TopFraction / 7 + ((BottomColour >> 10) & 0x1F) * BottomFraction / 7 ) << 10 ) - // Green component - | ( ( ((TopColour >> 5) & 0x1F) * TopFraction / 7 + ((BottomColour >> 5) & 0x1F) * BottomFraction / 7 ) << 5 ) - // Blue component - | ( ( (TopColour & 0x1F) * TopFraction / 7 + (BottomColour & 0x1F) * BottomFraction / 7 ) ) - ; -} - -void NDSSFCDrawFrameAntialiased (void* screen_addr) -{ - uint16 X, Y; - uint16 *SrcTop = (uint16 *) GFX.Screen, *SrcBottom = SrcTop + 256, *Dest = (uint16 *) screen_addr; - - for (Y = 0; Y < 224; Y += 7) - { - for (X = 0; X < 256; X++) - *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 6, 1); - // At the end of this loop, line 1 for this block of 6 - // has been drawn from the 2 first lines in the block - // of 7. Do the rest. - for (X = 0; X < 256; X++) - *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 5, 2); - for (X = 0; X < 256; X++) - *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 4, 3); - for (X = 0; X < 256; X++) - *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 3, 4); - for (X = 0; X < 256; X++) - *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 2, 5); - for (X = 0; X < 256; X++) - *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 1, 6); - // At the end of these loops, SrcTop and SrcBottom point to - // the first element in the 7th line of the current block and - // the first element in the 1st line of the next. - // We need to increase the pointer to start on lines 1 & 2. - SrcTop += 256; - SrcBottom += 256; - } -} diff --git a/source/nds/dma_adj.c b/source/nds/dma_adj.c deleted file mode 100644 index 8b6f9ad..0000000 --- a/source/nds/dma_adj.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "ds2_malloc.h" -#include "dma_adj.h" - -#ifdef DS2_DMA - -struct SPointerAdjustments PtrAdj; - -void* AlignedMalloc (unsigned int Size, unsigned int Alignment, unsigned int* Adjustment) -{ - if (Alignment == 0) Alignment = 1; - - unsigned char* result = (unsigned char*) malloc(Size + Alignment); - if (!result) { - return result; - } else { - *Adjustment = Alignment - ((unsigned int) result & (Alignment - 1)); - return (void*) (result + *Adjustment); - } -} - -void AlignedFree (void* Memory, unsigned int Adjustment) -{ - free((void*) ((unsigned char*) Memory - Adjustment)); -} - -#endif // DS2_DMA diff --git a/source/nds/dma_adj.h b/source/nds/dma_adj.h deleted file mode 100644 index 3852f09..0000000 --- a/source/nds/dma_adj.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _DMA_ADJ_H_ -#define _DMA_ADJ_H_ - -#ifdef DS2_DMA - -#ifdef __cplusplus -extern "C" { -#endif - -struct SPointerAdjustments { - /* These are used by the DSTWO-NDS side code. */ - unsigned int GFXScreen; - - /* These are used by Snes9x. */ - unsigned int ROM; -}; - -extern struct SPointerAdjustments PtrAdj; - -extern void* AlignedMalloc (unsigned int Size, unsigned int Alignment, unsigned int* Adjustment); -extern void AlignedFree (void* Memory, unsigned int Adjustment); - -#ifdef __cplusplus -} -#endif - -#endif // DS2_DMA - -#endif // !_DMA_ADJ_H_ diff --git a/source/nds/draw.c b/source/nds/draw.c deleted file mode 100644 index 6344f5b..0000000 --- a/source/nds/draw.c +++ /dev/null @@ -1,1315 +0,0 @@ -/* draw.c - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -//v1.1 - -/****************************************************************************** - * draw.cpp - * basic program to draw some graphic - ******************************************************************************/ -#include "port.h" -#include <string.h> -#include <stdio.h> -#include "ds2_malloc.h" -#include "ds2_cpu.h" -#include "bdf_font.h" -#include "gui.h" -#include "bitmap.h" -#include "draw.h" - -/****************************************************************************** - * macro definition - ******************************************************************************/ -#define progress_sx (screen_width2 - SCREEN_WIDTH / 3) // Center -160/-80 -#define progress_ex (screen_width2 + SCREEN_WIDTH / 3) // Center +160/+80 -#define progress_sy (screen_height2 + 3) // Center +3 -#define progress_ey (screen_height2 + 13) // Center +13 -#define yesno_sx (screen_width2 - SCREEN_WIDTH / 3) // Center -160/-80 -#define yesno_ex (screen_width2 + SCREEN_WIDTH / 3) // Center +160/+80 -#define yesno_sy (screen_height2 + 3) // Center +3 -#define yesno_ey (screen_height2 + 13) // Center +13 -#define progress_color COLOR16(15,15,15) - -//#define progress_wait (0.5 * 1000 * 1000) -#define progress_wait (OS_TICKS_PER_SEC/2) //0.5S - -#define FONTS_HEIGHT 14 - -#define SCREEN_PITCH 256 - -#define VRAM_POS(screen, x, y) ((unsigned short*)screen + (x + (y) * SCREEN_PITCH)) - -#define BOOTLOGO "SYSTEM/GUI/boot.bmp" -#define GUI_SOURCE_PATH "SYSTEM/GUI" -#define GUI_PIC_BUFSIZE 1024*512 - -char gui_picture[GUI_PIC_BUFSIZE]; - -struct gui_iconlist gui_icon_list[]= { - //file system - /* 00 */ {"zipfile", 16, 16, NULL}, - /* 01 */ {"directory", 16, 16, NULL}, - /* 02 */ {"sfcfile", 16, 16, NULL}, - - //title - /* 03 */ {"stitle", 256, 33, NULL}, - //main menu - /* 04 */ {"savo", 52, 52, NULL}, - /* 05 */ {"ssaveo", 52, 52, NULL}, - /* 06 */ {"stoolo", 52, 52, NULL}, - /* 07 */ {"scheato", 52, 52, NULL}, - /* 08 */ {"sother", 52, 52, NULL}, - /* 09 */ {"sexito", 52, 52, NULL}, - /* 10 */ {"smsel", 79, 15, NULL}, - /* 11 */ {"smnsel", 79, 15, NULL}, - - /* 12 */ {"snavo", 52, 52, NULL}, - /* 13 */ {"snsaveo", 52, 52, NULL}, - /* 14 */ {"sntoolo", 52, 52, NULL}, - /* 15 */ {"sncheato", 52, 52, NULL}, - /* 16 */ {"snother", 52, 52, NULL}, - /* 17 */ {"snexito", 52, 52, NULL}, - - /* 18 */ {"sunnof", 16, 16, NULL}, - /* 19 */ {"smaini", 85, 38, NULL}, - /* 20 */ {"snmaini", 85, 38, NULL}, - /* 21 */ {"smaybgo", 256, 192, NULL}, - - /* 22 */ {"sticon", 29, 13, NULL}, - /* 23 */ {"ssubbg", 256, 192, NULL}, - - /* 24 */ {"subsela", 245, 22, NULL}, - /* 25 */ {"sfullo", 12, 12, NULL}, - /* 26 */ {"snfullo", 12, 12, NULL}, - /* 27 */ {"semptyo", 12, 12, NULL}, - /* 28 */ {"snemptyo", 12, 12, NULL}, - /* 29 */ {"fdoto", 16, 16, NULL}, - /* 30 */ {"backo", 19, 13, NULL}, - /* 31 */ {"nbacko", 19, 13, NULL}, - /* 32 */ {"chtfile", 16, 15, NULL}, - /* 33 */ {"smsgfr", 193, 111, NULL}, - /* 34 */ {"sbutto", 76, 16, NULL} - }; - -u16 COLOR_BG = COLOR16( 0, 0, 0); -u16 COLOR_INACTIVE_ITEM = COLOR16( 0, 0, 0); -u16 COLOR_ACTIVE_ITEM = COLOR16(31, 31, 31); -u16 COLOR_MSSG = COLOR16( 0, 0, 0); -u16 COLOR_INACTIVE_MAIN = COLOR16(31, 31, 31); -u16 COLOR_ACTIVE_MAIN = COLOR16(31, 31, 31); - - -/* -* Drawing string aroud center -*/ -void print_string_center(void* screen_addr, u32 sy, u32 color, u32 bg_color, char *str) -{ - int width = 0;//fbm_getwidth(str); - u32 sx = (SCREEN_WIDTH - width) / 2; - - PRINT_STRING_BG(screen_addr, str, color, bg_color, sx, sy); -} - -/* -* Drawing string with shadow around center -*/ -void print_string_shadow_center(void* screen_addr, u32 sy, u32 color, char *str) -{ - int width = 0;//fbm_getwidth(str); - u32 sx = (SCREEN_WIDTH - width) / 2; - - PRINT_STRING_SHADOW(screen_addr, str, color, sx, sy); -} - -/* -* Drawing horizontal line -*/ -void drawhline(void* screen_addr, u32 sx, u32 ex, u32 y, u32 color) -{ - u32 x; - u32 width = (ex - sx) + 1; - u16 *dst = VRAM_POS(screen_addr, sx, y); - - for (x = 0; x < width; x++) - *dst++ = (u16)color; -} - -/* -* Drawing vertical line -*/ -void drawvline(void* screen_addr, u32 x, u32 sy, u32 ey, u32 color) -{ - int y; - int height = (ey - sy) + 1; - u16 *dst = VRAM_POS(screen_addr, x, sy); - - for (y = 0; y < height; y++) - { - *dst = (u16)color; - dst += SCREEN_PITCH; - } -} - -/* -* Drawing rectangle -*/ -void drawbox(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 color) -{ - drawhline(screen_addr, sx, ex - 1, sy, color); - drawvline(screen_addr, ex, sy, ey - 1, color); - drawhline(screen_addr, sx + 1, ex, ey, color); - drawvline(screen_addr, sx, sy + 1, ey, color); -} - -/* -* Filling a rectangle -*/ -void drawboxfill(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 color) -{ - u32 x, y; - u32 width = (ex - sx) + 1; - u32 height = (ey - sy) + 1; - u16 *dst = VRAM_POS(screen_addr, sx, sy); - - for (y = 0; y < height; y++) - { - for (x = 0; x < width; x++) - { - dst[x + y * SCREEN_PITCH] = (u16)color; - } - } -} - -/* -* Drawing a selection item -- active 0 not fill -- 1 fill with gray -- 2 fill with color -- 3 fill with color and most brithness -- color 0 Red -- 1 Green -- 2 Blue -------------------------------------------------------*/ -void draw_selitem(void* screen_addr, u32 x, u32 y, u32 color, u32 active) -{ - u32 size; - u32 color0, color1, color2, color3; - - size= 10; - - switch(active) - { - case 1: - color0 = COLOR16(12, 12, 12); - color1 = COLOR16(2, 2, 2); - color2 = COLOR16(7, 7, 7); - color3 = COLOR16(22, 22, 22); - break; - case 2: - switch(color) - { - case 0: //Red - color0 = COLOR16(12, 12, 12); - color1 = COLOR16(8, 0, 0); - color2 = COLOR16(16, 0, 0); - color3 = COLOR16(24, 0, 0); - break; - case 1: //Green - color0 = COLOR16(12, 12, 12); - color1 = COLOR16(0, 8, 0); - color2 = COLOR16(0, 16, 0); - color3 = COLOR16(0, 24, 0); - break; - case 2: //Blue - color0 = COLOR16(12, 12, 12); - color1 = COLOR16(0, 0, 8); - color2 = COLOR16(0, 0, 16); - color3 = COLOR16(0, 0, 24); - break; - default: - color0 = COLOR16(12, 12, 12); - color1 = COLOR16(0, 8, 0); - color2 = COLOR16(0, 16, 0); - color3 = COLOR16(0, 24, 0); - break; - } - break; - case 3: - switch(color) - { - case 0: //Red - color0 = COLOR16(31, 31, 31); - color1 = COLOR16(16, 0, 0); - color2 = COLOR16(22, 0, 0); - color3 = COLOR16(31, 0, 0); - break; - case 1: //Green - color0 = COLOR16(31, 31, 31); - color1 = COLOR16(0, 16, 0); - color2 = COLOR16(0, 22, 0); - color3 = COLOR16(0, 31, 0); - break; - case 2: //Blue - color0 = COLOR16(31, 31, 31); - color1 = COLOR16(0, 0, 16); - color2 = COLOR16(0, 0, 22); - color3 = COLOR16(0, 0, 31); - break; - default: - color0 = COLOR16(31, 31, 31); - color1 = COLOR16(0, 16, 0); - color2 = COLOR16(0, 22, 0); - color3 = COLOR16(0, 31, 0); - break; - } - break; - default: - color0= COLOR16(18, 18, 18); - color1= color2= color3= COLOR16(18, 18, 18); - break; - } - - drawbox(screen_addr, x, y, x+size-1, y+size-1, color0); - - if(active >0) - { - drawbox(screen_addr, x+1, y+1, x+size-2, y+size-2, color1); - drawbox(screen_addr, x+2, y+2, x+size-3, y+size-3, color2); - drawboxfill(screen_addr, x+3, y+3, x+size-4, y+size-4, color3); - } -} - -/* -* Drawing message box -* Note if color_fg is transparent, screen_bg can't be transparent -*/ -void draw_message(void* screen_addr, u16 *screen_bg, u32 sx, u32 sy, u32 ex, u32 ey, - u32 color_fg) -{ - if(!(color_fg & 0x8000)) - { -// drawbox(screen_addr, sx, sy, ex, ey, COLOR16(12, 12, 12)); -// drawboxfill(screen_addr, sx+1, sy+1, ex-1, ey-1, color_fg); - show_icon(screen_addr, &ICON_MSG, (NDS_SCREEN_WIDTH - ICON_MSG.x) / 2, (NDS_SCREEN_HEIGHT - ICON_MSG.y) / 2); - } - else - { - u16 *screenp, *screenp1; - u32 width, height, i, k; - u32 tmp, tmp1, tmp2; - u32 r, g, b; - - width= ex-sx; - height= ey-sy; - r= ((color_fg >> 10) & 0x1F) * 6/7; - g= ((color_fg >> 5) & 0x1F) * 6/7; - b= (color_fg & 0x1F) * 6/7; - for(k= 0; k < height; k++) - { - screenp = VRAM_POS(screen_addr, sx, sy+k); - screenp1 = screen_bg + sx + (sy + k) * SCREEN_PITCH; - for(i= 0; i < width; i++) - { - tmp = *screenp1++; - tmp1 = ((tmp >> 10) & 0x1F) *1/7 + r; - tmp2 = (tmp1 > 31) ? 31 : tmp1; - tmp1 = ((tmp >> 5) & 0x1F) *1/7 + g; - tmp2 = (tmp2 << 5) | ((tmp1 > 31) ? 31 : tmp1); - tmp1 = (tmp & 0x1F) *1/7 + b; - tmp2 = (tmp2 << 5) | ((tmp1 > 31) ? 31 : tmp1); - *screenp++ = tmp2; - } - } - } -} - -/* -* Drawing string horizontal center aligned -*/ -void draw_string_vcenter(void* screen_addr, u32 sx, u32 sy, u32 width, u32 color_fg, char *string) -{ - u32 x, num, i, m; - u16 *screenp; - u16 unicode[256]; - - num= 0; - while(*string) - { - string= utf8decode(string, unicode+num); - num++; - } - - if(num== 0) return; - - screenp = (unsigned short*)screen_addr + sx + sy*SCREEN_WIDTH; - i= 0; - while(i < num) - { - m= BDF_cut_unicode(&unicode[i], num-i, width, 1); - x= (width - BDF_cut_unicode(&unicode[i], m, 0, 3)) / 2; - while(m--) - { - x += BDF_render16_ucs(screenp+x, SCREEN_WIDTH, 0, COLOR_TRANS, - color_fg, unicode[i++]); - } - if (i < num && (unicode[i] == 0x0D || unicode[i] == 0x0A)) - i++; - else { - while (i < num && (unicode[i] == ' ')) i++; - } - screenp += FONTS_HEIGHT * SCREEN_WIDTH; - } -} - -/*------------------------------------------------------ - Drawing a scroll string -------------------------------------------------------*/ -//limited -// < 256 Unicodes -// width < 256+128 -//#define MAX_SCROLL_STRING 8 - -/*------------------------------------------------------ -- scroll_val < 0 scroll toward left -- > 0 scroll toward right -------------------------------------------------------*/ -struct scroll_string_info{ - u16 *screenp; - u32 sx; - u32 sy; - u32 width; - u32 height; - u16 *unicode; - u32 color_bg; - u32 color_fg; - u16 *buff_fonts; - u32 buff_width; - u16 *buff_bg; - s32 pos_pixel; - u32 str_start; - u32 str_end; - u32 str_len; -}; - -static struct scroll_string_info scroll_strinfo[MAX_SCROLL_STRING]; -static u32 scroll_string_num= 0; - -/* - * Initialises a text scroller to display a certain string. - * Input assertions: sx + width < NDS_SCREEN_WIDTH && - * sy + [text height] < NDS_SCREEN_HEIGHT && string != NULL && - * screen_addr != NULL. - * Input: 'screen_addr', the address of the upper-left corner of the screen. - * 'sx' and 'sy', the X and Y coordinates of the upper-left corner of - * the text. - * 'width', the width of the scroller's viewport. - * 'color_bg', the RGB15 color of the background around the text, or - * COLOR_TRANS for transparency. - * 'color_fg', the RGB15 color of the text. - * 'string', the text to be scrolled, encoded as UTF-8. - * Output: the scroller's handle, to be used to scroll the text in - * draw_hscroll. - */ -u32 hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width, - u32 color_bg, u32 color_fg, char *string) -{ - u32 index, x, textWidth, num, len, i; - u16 *unicode, *screenp; - - // 1. Which scroller should we use for this request? - for(i= 0; i < MAX_SCROLL_STRING; i++) - { - if(scroll_strinfo[i].screenp == NULL) - break; - } - - if(i >= MAX_SCROLL_STRING) - return -1; - - index= i; - - // 2. Convert to Unicode while calculating the width of the text. - unicode= (u16*)malloc(strlen(string)*sizeof(u16)); - if(unicode == NULL) - { - scroll_strinfo[index].str_len = 0; - return -3; - } - - num= 0; - textWidth = 0; - while(*string) - { - string= utf8decode(string, unicode+num); - if(unicode[num] != 0x0D && unicode[num] != 0x0A) { - textWidth += BDF_width16_ucs(unicode[num]); - num++; - } - } - if (textWidth < width) - textWidth = width; - - // 3. Allocate a rectangle of pixels for drawing the entire text into. - screenp= (u16*)malloc(textWidth*FONTS_HEIGHT*sizeof(u16)); - if(screenp == NULL) - { - scroll_strinfo[index].str_len = 0; - free((void*)unicode); - return -2; - } - - if(color_bg == COLOR_TRANS) - memset(screenp, 0, textWidth*FONTS_HEIGHT*sizeof(u16)); - - scroll_string_num += 1; - scroll_strinfo[index].screenp = (unsigned short*)screen_addr; - scroll_strinfo[index].sx= sx; - scroll_strinfo[index].sy= sy; - scroll_strinfo[index].color_bg= color_bg; - scroll_strinfo[index].color_fg= color_fg; - scroll_strinfo[index].width= width; - scroll_strinfo[index].height= FONTS_HEIGHT; - scroll_strinfo[index].unicode= unicode; - scroll_strinfo[index].buff_fonts= screenp; - scroll_strinfo[index].buff_bg= 0; - scroll_strinfo[index].buff_width= textWidth; - scroll_strinfo[index].pos_pixel= 0; - scroll_strinfo[index].str_start= 0; - scroll_strinfo[index].str_end= len-1; - - scroll_strinfo[index].str_len= num; - if(num == 0) - return index; // (1. Which scroller?) - - // 4. Render text into the allocation. - i= 0; - x= 0; - while(i < num) - { - x += BDF_render16_ucs(screenp + x, textWidth, 0, color_bg, color_fg, unicode[i++]); - } - - return index; // (1. Which scroller?) -} - -u32 draw_hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width, - u32 color_bg, u32 color_fg, char *string) -{ - u32 ret = hscroll_init(screen_addr, sx, sy, width, color_bg, color_fg, string); - - draw_hscroll(ret, 0 /* stay on the left */); - - return ret; -} - -/* - * Scrolls an initialised scroller's text. - * A scroller is never allowed to go past the beginning of the text when - * scrolling to the left, or to go past the end when scrolling to the right. - * Input assertions: index was returned by a previous call to - * draw_hscroll_init and not used in a call to draw_hscroll_over. - * Input: 'index', the scroller's handle. - * 'scroll_val', the number of pixels to scroll. The sign affects the - * direction. If scroll_val > 0, the scroller's viewport is moved to - * the left; if < 0, the scroller's viewport is moved to the right. - * Output: the number of pixels still available to scroll in the direction - * specified by the sign of 'scroll_val'. - * - * Example: (assume each letter is 1 pixel; this won't be true in reality) - * [some lengthy text shown in ] | - * val -5 -> | [lengthy text shown in a scr]xxxxx -> to right, returns 5 - * val -5 -> | [hy text shown in a scroller] -> to right, returns 0 - * val 3 -> xxxxxxx[ngthy text shown in a scrol] | -> to left, returns 7 - * val 3 -> xxxx[ lengthy text shown in a sc] | -> to left, returns 4 - */ -u32 draw_hscroll(u32 index, s32 scroll_val) -{ - u32 color_bg, color_fg, i, width, height; - s32 xoff; - - if(index >= MAX_SCROLL_STRING) return -1; - if(scroll_strinfo[index].screenp == NULL) return -2; - if(scroll_strinfo[index].str_len == 0) return 0; - - width= scroll_strinfo[index].width; - height= scroll_strinfo[index].height; - color_bg= scroll_strinfo[index].color_bg; - color_fg= scroll_strinfo[index].color_fg; - - // 1. Shift the scroller. - scroll_strinfo[index].pos_pixel -= scroll_val; - if (scroll_strinfo[index].pos_pixel < 0) // Reached the beginning - scroll_strinfo[index].pos_pixel = 0; - else if (scroll_strinfo[index].pos_pixel > scroll_strinfo[index].buff_width - width) // Reached the end - scroll_strinfo[index].pos_pixel = scroll_strinfo[index].buff_width - width; - - // 2. Draw the scroller's text at its new position. - u32 x, sx, sy, pixel; - u16 *screenp, *screenp1; - - sx= scroll_strinfo[index].sx; - sy= scroll_strinfo[index].sy; - - if(color_bg == COLOR_TRANS) - { - for(i= 0; i < height; i++) - { - screenp= scroll_strinfo[index].screenp + sx + (sy + i) * SCREEN_WIDTH; - screenp1= scroll_strinfo[index].buff_fonts + scroll_strinfo[index].pos_pixel + i*scroll_strinfo[index].buff_width; - for(x= 0; x < width; x++) - { - pixel= *screenp1++; - if(pixel) *screenp = pixel; - screenp ++; - } - } - } - else - { - for(i= 0; i < height; i++) - { - screenp= scroll_strinfo[index].screenp + sx + (sy + i) * SCREEN_WIDTH; - screenp1= scroll_strinfo[index].buff_fonts + scroll_strinfo[index].pos_pixel + i*scroll_strinfo[index].buff_width; - for(x= 0; x < width; x++) - *screenp++ = *screenp1++; - } - } - - // 3. Return how many more pixels we can scroll in the same direction. - if(scroll_val > 0) - // Scrolling to the left: Return the number of pixels we can still go - // to the left. - return scroll_strinfo[index].pos_pixel; - else - // Scrolling to the right: Return the number of pixels we can still go - // to the right. - return scroll_strinfo[index].buff_width - scroll_strinfo[index].pos_pixel - width; -} - -void draw_hscroll_over(u32 index) -{ - if(scroll_strinfo[index].screenp== NULL) - return; - - if(index < MAX_SCROLL_STRING && scroll_string_num > 0) - { - if(scroll_strinfo[index].unicode) - { - free((void*)scroll_strinfo[index].unicode); - scroll_strinfo[index].unicode= NULL; - } - if(scroll_strinfo[index].buff_fonts) - { - free((void*)scroll_strinfo[index].buff_fonts); - scroll_strinfo[index].buff_fonts= NULL; - } - scroll_strinfo[index].screenp= NULL; - scroll_strinfo[index].str_len= 0; - - scroll_string_num -=1; - } -} - -/* -* Drawing dialog -*/ -/* -void draw_dialog(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey) -{ - drawboxfill(screen_addr, sx + 5, sy + 5, ex + 5, ey + 5, COLOR_DIALOG_SHADOW); - - drawhline(screen_addr, sx, ex - 1, sy, COLOR_FRAME); - drawvline(screen_addr, ex, sy, ey - 1, COLOR_FRAME); - drawhline(screen_addr, sx + 1, ex, ey, COLOR_FRAME); - drawvline(screen_addr, sx, sy + 1, ey, COLOR_FRAME); - - sx++; - ex--; - sy++; - ey--; - - drawhline(screen_addr, sx, ex - 1, sy, COLOR_FRAME); - drawvline(screen_addr, ex, sy, ey - 1, COLOR_FRAME); - drawhline(screen_addr, sx + 1, ex, ey, COLOR_FRAME); - drawvline(screen_addr, sx, sy + 1, ey, COLOR_FRAME); - - sx++; - ex--; - sy++; - ey--; - - drawboxfill(screen_addr, sx, sy, ex, ey, COLOR_DIALOG); -} -*/ - -/* -* Draw yes or no dialog -*/ -u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no) -{ - u16 unicode[8]; - u32 len, width, box_width, i; - char *string; - void* screen_addr; - - len= 0; - string= yes; - while(*string) - { - string= utf8decode(string, &unicode[len]); - if(unicode[len] != 0x0D && unicode[len] != 0x0A) - { - if(len < 8) len++; - else break; - } - } - width= BDF_cut_unicode(unicode, len, 0, 3); - - len= 0; - string= no; - while(*string) - { - string= utf8decode(string, &unicode[len]); - if(unicode[len] != 0x0D && unicode[len] != 0x0A) - { - if(len < 8) len++; - else break; - } - } - i= BDF_cut_unicode(unicode, len, 0, 3); - - if(width < i) width= i; - box_width= 64; - if(box_width < (width +6)) box_width = width +6; - - if(screen & UP_MASK) - screen_addr = up_screen_addr; - else - screen_addr = down_screen_addr; - - sy = (NDS_SCREEN_HEIGHT + ICON_MSG.y) / 2 - 8 - ICON_BUTTON.y; - - u32 left_sx = NDS_SCREEN_WIDTH / 2 - 8 - ICON_BUTTON.x, - right_sx = NDS_SCREEN_WIDTH / 2 + 8; - - show_icon((unsigned short*)screen_addr, &ICON_BUTTON, left_sx, sy); - draw_string_vcenter((unsigned short*)screen_addr, left_sx + 2, sy, ICON_BUTTON.x - 4, COLOR_WHITE, yes); - - show_icon((unsigned short*)screen_addr, &ICON_BUTTON, right_sx, sy); - draw_string_vcenter((unsigned short*)screen_addr, right_sx + 2, sy, ICON_BUTTON.x - 4, COLOR_WHITE, no); - - ds2_flipScreen(screen, 2); - - gui_action_type gui_action = CURSOR_NONE; - while((gui_action != CURSOR_SELECT) && (gui_action != CURSOR_BACK)) - { - gui_action = get_gui_input(); - if (gui_action == CURSOR_TOUCH) - { - struct key_buf inputdata; - ds2_getrawInput(&inputdata); - // Turn it into a SELECT (A) or BACK (B) if the button is touched. - if (inputdata.y >= sy && inputdata.y < sy + ICON_BUTTON.y) - { - if (inputdata.x >= left_sx && inputdata.x < left_sx + ICON_BUTTON.x) - gui_action = CURSOR_SELECT; - else if (inputdata.x >= right_sx && inputdata.x < right_sx + ICON_BUTTON.x) - gui_action = CURSOR_BACK; - } - } - mdelay(16); - } - - if (gui_action == CURSOR_SELECT) - return 1; - else - return 0; -} - -/* -* Draw hotkey dialog -* Returns DS keys pressed, as in ds2io.h. -*/ -u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel) -{ - u16 unicode[8]; - u32 len, width, box_width, i; - char *string; - void* screen_addr; - - len= 0; - string= clear; - while(*string) - { - string= utf8decode(string, &unicode[len]); - if(unicode[len] != 0x0D && unicode[len] != 0x0A) - { - if(len < 8) len++; - else break; - } - } - width= BDF_cut_unicode(unicode, len, 0, 3); - - len= 0; - string= cancel; - while(*string) - { - string= utf8decode(string, &unicode[len]); - if(unicode[len] != 0x0D && unicode[len] != 0x0A) - { - if(len < 8) len++; - else break; - } - } - i= BDF_cut_unicode(unicode, len, 0, 3); - - if(width < i) width= i; - box_width= 64; - if(box_width < (width +6)) box_width = width +6; - - if(screen & UP_MASK) - screen_addr = up_screen_addr; - else - screen_addr = down_screen_addr; - - i= SCREEN_WIDTH/2 - box_width - 2; - show_icon((unsigned short*)screen_addr, &ICON_BUTTON, 49, 128); - draw_string_vcenter((unsigned short*)screen_addr, 51, 130, 73, COLOR_WHITE, clear); - - i= SCREEN_WIDTH/2 + 3; - show_icon((unsigned short*)screen_addr, &ICON_BUTTON, 136, 128); - draw_string_vcenter((unsigned short*)screen_addr, 138, 130, 73, COLOR_WHITE, cancel); - - ds2_flipScreen(screen, 2); - - // This function has been started by a key press. Wait for it to end. - struct key_buf inputdata; - do { - mdelay(1); - ds2_getrawInput(&inputdata); - } while (inputdata.key != 0); - - // While there are no keys pressed, wait for keys. - do { - mdelay(1); - ds2_getrawInput(&inputdata); - } while (inputdata.key == 0); - - // Now, while there are keys pressed, keep a tally of keys that have - // been pressed. (IGNORE TOUCH AND LID! Otherwise, closing the lid or - // touching to get to the menu will do stuff the user doesn't expect.) - u32 TotalKeys = 0; - - do { - TotalKeys |= inputdata.key & ~(KEY_TOUCH | KEY_LID); - // If there's a touch on either button, turn it into a - // clear (A) or cancel (B) request. - if (inputdata.key & KEY_TOUCH) - { - if (inputdata.y >= 128 && inputdata.y < 128 + ICON_BUTTON.y) - { - if (inputdata.x >= 49 && inputdata.x < 49 + ICON_BUTTON.x) - return KEY_A; - else if (inputdata.x >= 136 && inputdata.x < 136 + ICON_BUTTON.x) - return KEY_B; - } - } - mdelay(1); - ds2_getrawInput(&inputdata); - } while (inputdata.key != 0 || TotalKeys == 0); - - return TotalKeys; -} - -/* -* Drawing scroll bar -*/ -#define SCROLLBAR_COLOR1 COLOR16( 0, 2, 8) -#define SCROLLBAR_COLOR2 COLOR16(15,15,15) - -void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now) -{ - u32 scrollbar_sy; - u32 scrollbar_ey; - u32 len; - - len = ey - sy - 2; - - if ((all != 0) && (all > now)) - scrollbar_sy = (u32)((float)len * (float)now / (float)all) +sy + 1; - else - scrollbar_sy = sy + 1; - - if ((all > (now + view)) && (all != 0)) - scrollbar_ey = (u32)((float)len * (float)(now + view) / (float)all ) + sy + 1; - else - scrollbar_ey = len + sy + 1; - - drawbox(screen_addr, sx, sy, ex, ey, COLOR_BLACK); - drawboxfill(screen_addr, sx + 1, sy + 1, ex - 1, ey - 1, SCROLLBAR_COLOR1); - drawboxfill(screen_addr, sx + 1, scrollbar_sy, ex - 1, scrollbar_ey, SCROLLBAR_COLOR2); -} - -#if 0 -static struct background back_ground = {{0}, {0}}; - -int show_background(void *screen, char *bgname) -{ - int ret; - - if(strcasecmp(bgname, back_ground.bgname)) - { - char *buff, *src; - int x, y; - unsigned short *dst; - unsigned int type; - - buff= (char*)malloc(256*192*4); - - ret= BMP_read(bgname, buff, 256, 192, &type); - if(ret != BMP_OK) - { - free((intptr_t)buff); - return(-1); - } - - src = buff; - - if(type ==2) //2 bytes per pixel - { - unsigned short *pt; - pt = (unsigned short*)buff; -// memcpy((char*)back_ground.bgbuffer, buff, 256*192*2); - dst=(unsigned short*)back_ground.bgbuffer; - for(y= 0; y< 192; y++) - { - for(x= 0; x< 256; x++) - { - *dst++= RGB16_15(pt); - pt += 1; - } - } - } - else if(type ==3) //3 bytes per pixel - { - dst=(unsigned short*)back_ground.bgbuffer; - for(y= 0; y< 192; y++) - { - for(x= 0; x< 256; x++) - { - *dst++= RGB24_15(buff); - buff += 3; - } - } - } - else - { - free((intptr_t)buff); - return(-1); - } - - free((intptr_t)src); - strcpy(back_ground.bgname, bgname); - } - - memcpy((char*)screen, back_ground.bgbuffer, 256*192*2); - - return 0; -} -#endif - -/* -* change GUI icon -*/ -int gui_change_icon(u32 language_id) -{ - char path[128]; - char fpath[8]; - u32 i, item; - int err, ret; - char *buff, *src; - u32 x, y; - char *icondst; - unsigned int type; - - item= sizeof(gui_icon_list)/16; - buff= (char*)malloc(256*192*4); - if(buff == NULL) - return -1; - - ret= 0; - icondst= gui_picture; - - sprintf(fpath, "%d.bmp", language_id); - for(i= 0; i< item; i++) - { - sprintf(path, "%s/%s/%s%s", main_path, GUI_SOURCE_PATH, gui_icon_list[i].iconname, fpath); - - src= buff; - err= BMP_read(path, src, gui_icon_list[i].x, gui_icon_list[i].y, &type); - if(err != BMP_OK) - { - sprintf(path, "%s/%s/%s%s", main_path, GUI_SOURCE_PATH, gui_icon_list[i].iconname, ".bmp"); - err= BMP_read(path, src, gui_icon_list[i].x, gui_icon_list[i].y, &type); - } - - if(type < 2) //< 1 byte per pixels, not surpport now - { - if(!ret) ret = -(i+1); - gui_icon_list[i].iconbuff= NULL; - continue; - } - - if(err == BMP_OK) - { - unsigned short *dst; - - if(icondst >= gui_picture + GUI_PIC_BUFSIZE -1) - { - ret = 1; - break; - } - - if(type == 2) - { - unsigned short *pt; - pt = (unsigned short*)src; -// memcpy((char*)icondst, src, 256*192*2); - dst = (unsigned short*)icondst; - for(y= 0; y< gui_icon_list[i].y; y++) - { - for(x= 0; x < gui_icon_list[i].x; x++) - { - *dst++ = RGB16_15(pt); - pt += 1; - } - } - } - - if(type == 3) - { - dst = (unsigned short*)icondst; - for(y= 0; y< gui_icon_list[i].y; y++) - { - for(x= 0; x < gui_icon_list[i].x; x++) - { - *dst++ = RGB24_15(src); - src += 3; - } - } - } - - gui_icon_list[i].iconbuff= icondst; - icondst += gui_icon_list[i].x*gui_icon_list[i].y*2; - } - else - { - if(!ret) ret = -(i+1); - gui_icon_list[i].iconbuff= NULL; - } - } - - free((void*)buff); -//printf("icon_buf: %08x\n", icondst - gui_picture ); - return ret; -} - -/*************************************************************/ -int icon_init(u32 language_id) -{ - u32 i; - int ret; - -//Initial draw_scroll_string function - scroll_string_num = 0; - for(i= 0; i < MAX_SCROLL_STRING; i++) - { - scroll_strinfo[i].unicode= NULL; - scroll_strinfo[i].buff_fonts= NULL; - scroll_strinfo[i].screenp = NULL; - scroll_strinfo[i].str_len = 0; - } - - ret= gui_change_icon(language_id); - -//#define GUI_INIT_DEBUG -#if 0 - item= sizeof(gui_icon_list)/12; - buff= (char*)malloc(256*192*4); - src= buff; - ret= 0; - icondst= gui_picture; - - for(i= 0; i< item; i++) - { - sprintf(path, "%s\\%s", GUI_SOURCE_PATH, gui_icon_list[i].iconname); - - err= BMP_read(path, buff, gui_icon_list[i].x, gui_icon_list[i].y); - if(err == BMP_OK) - { - unsigned short *dst; - - if(icondst >= gui_picture + GUI_PIC_BUFSIZE -1) - { - ret = 1; -#ifdef GUI_INIT_DEBUG - printf("GUI Initial overflow\n"); -#endif - break; - } - - for(y= 0; y< gui_icon_list[i].y; y++) - { - dst= (unsigned short*)(icondst + (gui_icon_list[i].y - y -1)*gui_icon_list[i].x*2); - for(x= 0; x < gui_icon_list[i].x; x++) - { - *dst++ = RGB24_15(buff); - buff += 4; - } - } - - gui_icon_list[i].iconname= icondst; - icondst += gui_icon_list[i].x*gui_icon_list[i].y*2; - } - else - if(!ret) - { - ret = -(i+1); - gui_icon_list[i].iconname= NULL; -#ifdef GUI_INIT_DEBUG - printf("GUI Initial: %s not open\n", path); -#endif - } - } - -#ifdef GUI_INIT_DEBUG - printf("GUI buff %d\n", icondst - gui_picture); -#endif - - free((intptr_t)src); -#endif - - return ret; -} - -int color_init() -{ - char path[MAX_PATH]; - char current_line[256]; - sprintf(path, "%s/%s/%s", main_path, GUI_SOURCE_PATH, "uicolors.txt"); - FILE* fp = fopen(path, "r"); - if (fp != NULL) - { - while(fgets(current_line, 256, fp)) - { - char* colon = strchr(current_line, ':'); - if (colon) - { - *colon = '\0'; - u16* color = NULL; - if (strcasecmp(current_line, "Background") == 0) - color = &COLOR_BG; - else if (strcasecmp(current_line, "ActiveItem") == 0) - color = &COLOR_ACTIVE_ITEM; - else if (strcasecmp(current_line, "InactiveItem") == 0) - color = &COLOR_INACTIVE_ITEM; - else if (strcasecmp(current_line, "MessageText") == 0) - color = &COLOR_MSSG; - else if (strcasecmp(current_line, "ActiveMain") == 0) - color = &COLOR_ACTIVE_MAIN; - else if (strcasecmp(current_line, "InactiveMain") == 0) - color = &COLOR_INACTIVE_MAIN; - - if (color != NULL) - { - char* end = strchr(colon + 1, '\0') - 1; - while (*end && (*end == '\r' || *end == '\n')) - *end-- = '\0'; - char* ptr = colon + 1; - while (*ptr && *ptr == ' ') - ptr++; - u32 color32; - u8 r, g, b; - if (strlen(ptr) == 7 && *ptr == '#') - { - color32 = strtol(ptr + 1, NULL, 16); - r = (color32 >> 16) & 0xFF; - g = (color32 >> 8) & 0xFF; - b = color32 & 0xFF; - *color = COLOR16(r >> 3, g >> 3, b >> 3); - } - } - } - } - fclose(fp); - return 0; - } - else - return 1; -} - -/*************************************************************/ -void show_icon(void* screen, struct gui_iconlist* icon, u32 x, u32 y) -{ - u32 i, k; - unsigned short *src, *dst; - - src= (unsigned short*)icon->iconbuff; - dst = (unsigned short*)screen + y*NDS_SCREEN_WIDTH + x; - if(NULL == src) return; //The icon may initialized failure - - if (icon->x == NDS_SCREEN_WIDTH && icon->y == NDS_SCREEN_HEIGHT && x == 0 && y == 0) - { - // Don't support transparency for a background. - memcpy(dst, src, NDS_SCREEN_WIDTH * NDS_SCREEN_HEIGHT * sizeof(u16)); - } - else - { - for(i= 0; i < icon->y; i++) - { - for(k= 0; k < icon->x; k++) - { - if(0x03E0 != *src) dst[k]= *src; - src++; - } - - dst += NDS_SCREEN_WIDTH; - } - } -} - -/*************************************************************/ -void show_Vscrollbar(char *screen, u32 x, u32 y, u32 part, u32 total) -{ -// show_icon((u16*)screen, ICON_VSCROL_UPAROW, x+235, y+55); -// show_icon((u16*)screen, ICON_VSCROL_DWAROW, x+235, y+167); -// show_icon((u16*)screen, ICON_VSCROL_SLIDER, x+239, y+64); -// if(total <= 1) -// show_icon((u16*)screen, ICON_VSCROL_BAR, x+236, y+64); -// else -// show_icon((u16*)screen, ICON_VSCROL_BAR, x+236, y+64+(part*90)/(total-1)); -} - -/* -* display a log -*/ -void show_log(void* screen_addr) -{ - char tmp_path[MAX_PATH]; - char *buff; - int x, y; - unsigned short *dst; - unsigned int type; - int ret; - - sprintf(tmp_path, "%s/%s", main_path, BOOTLOGO); - buff= (char*)malloc(256*192*4); - - ret= BMP_read(tmp_path, buff, 256, 192, &type); - if(ret != BMP_OK) - { - free((void*)buff); - return; - } - - if(type ==2) //2 bytes per pixel - { - unsigned short *pt; - pt = (unsigned short*)buff; - dst=(unsigned short*)screen_addr; - for(y= 0; y< 192; y++) - { - for(x= 0; x< 256; x++) - { - *dst++= RGB16_15(pt); - pt += 1; - } - } - } - else if(type ==3) //3 bytes per pixel - { - unsigned char *pt; - pt = (unsigned char*)buff; - dst=(unsigned short*)screen_addr; - for(y= 0; y< 192; y++) - { - for(x= 0; x< 256; x++) - { - *dst++= RGB24_15(pt); - pt += 3; - } - } - } - - free((void*)buff); -} - -/*************************************************************/ -void err_msg(enum SCREEN_ID screen, char *msg) -{ - // A wild console appeared! - ConsoleInit(RGB15(31, 31, 31), RGB15(0, 0, 0), UP_SCREEN, 2); - printf(msg); -} - -/* -* Copy screen -*/ -void copy_screen(void* to, void *from, u32 x, u32 y, u32 w, u32 h) -{ - u32 yy; - unsigned short *src, *dst; - - //not check argument - src = (unsigned short*)from; - dst = (unsigned short*)to; - - src += y*256+x; - dst += y*256+x; - for(yy= 0; yy < h; yy++) - { - memcpy((void*)dst, (void*)src, w*2); - src += 256; - dst += 256; - } -} - -/* -* -*/ -void blit_to_screen(void* screen_addr, u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y) -{ - u32 x, y; - u16 *dst; - u16 *screenp; - - if(w > NDS_SCREEN_WIDTH) w= NDS_SCREEN_WIDTH; - if(h > NDS_SCREEN_HEIGHT) h= NDS_SCREEN_HEIGHT; - if(dest_x == -1) //align center - dest_x= (NDS_SCREEN_WIDTH - w)/2; - if(dest_y == -1) - dest_y= (NDS_SCREEN_HEIGHT - h)/2; - - screenp= (unsigned short*)screen_addr -16*256 -8; - for(y= 0; y < h; y++) - { - dst= screenp + (y+dest_y)*256 + dest_x; - for(x= 0; x < w; x++) - *dst++ = *src++; - } -} diff --git a/source/nds/draw.h b/source/nds/draw.h deleted file mode 100644 index 473fc30..0000000 --- a/source/nds/draw.h +++ /dev/null @@ -1,207 +0,0 @@ -/* draw.h - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __DRAW_H__ -#define __DRAW_H__ - -//#include "ds2_types.h" -//#include "ds2io.h" -#include <psptypes.h> - -#include "bdf_font.h" - -#define NDS_SCREEN_WIDTH 256 -#define NDS_SCREEN_HEIGHT 192 -#define NDS_SCREEN_SIZE (NDS_SCREEN_WIDTH*NDS_SCREEN_HEIGHT) - -#define COLOR16(red, green, blue) ((blue << 10) | (green << 5) | red) -#define GET_R16(color) (color & 0x1f) -#define GET_G16(color) ((color >> 5) & 0x1f) -#define GET_B16(color) ((color >> 10)& 0x1f) -#define COLOR32(red, green, blue) (0xff000000 | ((blue & 0xff) << 16) | ((green & 0xff) << 8) | (red & 0xff)) - -#define RGB24_15(pixel) ((((*pixel) & 0xF8) << 7) |\ - (((*(pixel+1)) & 0xF8) << 2) |\ - (((*(pixel+2)) & 0xF8)>>3)) - -#define RGB16_15(pixel) ((((*pixel)>>10) & 0x1F) |\ - (((*pixel) & 0x1F) << 10) |\ - ((*pixel) & 0x83E0)) - - -#define PRINT_STRING(screen, str, fg_color, x, y) \ - BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, COLOR_TRANS, fg_color, str) \ - -#define PRINT_STRING_SHADOW(screen, str, fg_color, x, y) \ - BDF_render_mix(screen, SCREEN_WIDTH, x+1, y+1, 0, 0, 0, str); \ - BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, 0, 0, str) \ - -#define PRINT_STRING_BG(screen, str, fg_color, bg_color, x, y) \ - BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, str) \ - -// #define PRINT_STRING_BG_UTF8(screen, utf8, fg_color, bg_color, x, y) \ -// BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, utf8) \ - - -//colors -#define COLOR_TRANS COLOR16(31, 31, 63) -#define COLOR_WHITE COLOR16(31, 31, 31) -#define COLOR_BLACK COLOR16( 0, 0, 0) -//#define COLOR_TEXT COLOR16(31, 31, 31) -//#define COLOR_PROGRESS_TEXT COLOR16( 0, 0, 0) -//#define COLOR_PROGRESS_BAR COLOR16(15, 15, 15) -//#define COLOR_ERROR COLOR16(31, 0, 0) -//#define COLOR_BG COLOR16(2, 4, 10) -//#define COLOR_BG32 COLOR32(2*8, 4*8, 10*8) -//#define COLOR_ROM_INFO COLOR16(22, 18, 26) -//#define COLOR_HELP_TEXT COLOR16(16, 20, 24) -//#define COLOR_DIALOG COLOR16(31, 31, 31) -//#define COLOR_DIALOG_SHADOW COLOR16( 0, 2, 8) -//#define COLOR_FRAME COLOR16( 0, 0, 0) -//#define COLOR_YESNO_TEXT COLOR16( 0, 0, 0) -//#define COLOR_GREEN COLOR16( 0, 31, 0 ) -//#define COLOR_GREEN1 COLOR16( 0, 24, 0 ) -//#define COLOR_GREEN2 COLOR16( 0, 18, 0 ) -//#define COLOR_GREEN3 COLOR16( 0, 12, 0 ) -//#define COLOR_GREEN4 COLOR16( 0, 6, 0 ) -//#define COLOR_RED COLOR16( 31, 0, 0 ) -//#define COLOR_MSSG COLOR16( 16, 8, 29) -/****************************************************************************** - * - ******************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif - -extern u16 COLOR_BG; -extern u16 COLOR_INACTIVE_ITEM; -extern u16 COLOR_ACTIVE_ITEM; -extern u16 COLOR_MSSG; -extern u16 COLOR_INACTIVE_MAIN; -extern u16 COLOR_ACTIVE_MAIN; - -struct background{ - char bgname[128]; - char bgbuffer[256*192*2]; -}; - -struct gui_iconlist{ - const char *iconname; //icon name - u32 x; //picture size - u32 y; - char *iconbuff; -}; - -//extern struct background back_ground; -extern struct gui_iconlist gui_icon_list[]; - -#define ICON_ZIPFILE gui_icon_list[0] -#define ICON_DIRECTORY gui_icon_list[1] -#define ICON_SFCFILE gui_icon_list[2] -#define ICON_TITLE gui_icon_list[3] - -#define ICON_AVO gui_icon_list[4] -#define ICON_SAVO gui_icon_list[5] -#define ICON_TOOL gui_icon_list[6] -#define ICON_CHEAT gui_icon_list[7] -#define ICON_OTHER gui_icon_list[8] -#define ICON_EXIT gui_icon_list[9] -#define ICON_MSEL gui_icon_list[10] -#define ICON_MNSEL gui_icon_list[11] -#define ICON_NAVO gui_icon_list[12] -#define ICON_NSAVO gui_icon_list[13] -#define ICON_NTOOL gui_icon_list[14] -#define ICON_NCHEAT gui_icon_list[15] -#define ICON_NOTHER gui_icon_list[16] -#define ICON_NEXIT gui_icon_list[17] - -#define ICON_UNKNOW gui_icon_list[18] -#define ICON_MAINITEM gui_icon_list[19] -#define ICON_NMAINITEM gui_icon_list[20] -#define ICON_MAINBG gui_icon_list[21] - -#define ICON_TITLEICON gui_icon_list[22] -#define ICON_SUBBG gui_icon_list[23] - -#define ICON_SUBSELA gui_icon_list[24] -#define ICON_STATEFULL gui_icon_list[25] -#define ICON_NSTATEFULL gui_icon_list[26] -#define ICON_STATEEMPTY gui_icon_list[27] -#define ICON_NSTATEEMPTY gui_icon_list[28] -#define ICON_DOTDIR gui_icon_list[29] -#define ICON_BACK gui_icon_list[30] -#define ICON_NBACK gui_icon_list[31] -#define ICON_CHTFILE gui_icon_list[32] -#define ICON_MSG gui_icon_list[33] -#define ICON_BUTTON gui_icon_list[34] - -/****************************************************************************** - * - ******************************************************************************/ -extern void print_string_center(void* screen_addr, u32 sy, u32 color, u32 bg_color, char *str); -extern void print_string_shadow_center(void* screen_addr, u32 sy, u32 color, char *str); -extern void hline(u32 sx, u32 ex, u32 y, u32 color); -extern void hline_alpha(u32 sx, u32 ex, u32 y, u32 color, u32 alpha); -extern void vline(u32 x, u32 sy, u32 ey, u32 color); -extern void vline_alpha(u32 x, u32 sy, u32 ey, u32 color, u32 alpha); -extern void drawbox(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color); -extern void drawboxfill(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color); -extern void draw_selitem(void* screen_address, u32 x, u32 y, u32 color, u32 active); -extern void draw_message(void* screen_address, u16 *screen_bg, u32 sx, u32 sy, u32 ex, u32 ey, - u32 color_fg); -extern void draw_string_vcenter(void* screen_address, u32 sx, u32 sy, u32 width, - u32 color_fg, char *string); - -#define MAX_SCROLL_STRING 16 -extern u32 hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width, - u32 color_bg, u32 color_fg, char *string); -extern u32 draw_hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width, - u32 color_bg, u32 color_fg, char *string); -extern u32 draw_hscroll(u32 index, s32 scroll_val); -extern void draw_hscroll_over(u32 index); -extern void boxfill_alpha(u32 sx, u32 sy, u32 ex, u32 ey, u32 color, u32 alpha); -extern void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now); -extern u32 yesno_dialog(char *text); -//extern u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no); -//extern u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel); -extern void msg_screen_init(const char *title); -extern void msg_screen_draw(); -extern void msg_printf(const char *text, ...); -extern void msg_screen_clear(void); -extern void msg_set_text_color(u32 color); - -extern int icon_init(u32 language_id); -extern int color_init(void); -extern int gui_change_icon(u32 language_id); -extern int show_background(void *screen, char *bgname); -extern void show_icon(void* screen, struct gui_iconlist *icon, u32 x, u32 y); -extern void show_Vscrollbar(char *screen, u32 x, u32 y, u32 part, u32 total); - -extern void show_log(void* screen_addr); -extern void err_msg(enum SCREEN_ID screen, char *msg); - -extern void copy_screen(void* to, void *from, u32 x, u32 y, u32 w, u32 h); -extern void blit_to_screen(void* screen_addr, u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y); - -#ifdef __cplusplus -} -#endif - -#endif //__DRAW_H__ - diff --git a/source/nds/ds2_main.c b/source/nds/ds2_main.c deleted file mode 100644 index af81df3..0000000 --- a/source/nds/ds2_main.c +++ /dev/null @@ -1,68 +0,0 @@ -/* ds2_main.c - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "port.h" - -#include <stdio.h> -#include "console.h" -#include "fs_api.h" -#include "ds2io.h" -#include "ds2_cpu.h" -#include "ds2_timer.h" -#include "ds2_malloc.h" -#include "ds2sound.h" -#include "gui.h" - -#define BLACK_COLOR RGB15(0, 0, 0) -#define WHITE_COLOR RGB15(31, 31, 31) - -extern int sfc_main (int argc, char **argv); - -#if 0 -void ddump_mem(unsigned char* addr, unsigned int len) -{ - unsigned int i; - - for(i= 0; i < len; i++) - { - if(i%16 == 0) cprintf("\n%08x: ", i); - cprintf("%02x ", addr[i]); - } -} -#endif - -void ds2_main(void) -{ - int err; - HighFrequencyCPU(); - //Initial video and audio and other input and output - err = ds2io_initb(DS2_BUFFER_SIZE, SND_SAMPLE_RATE, 0, 0); - if(err) goto _failure; - - //Initial file system - err = fat_init(); - if(err) goto _failure; - - //go to user main funtion - sfc_main (0, 0); - -_failure: - ds2_plug_exit(); -} - diff --git a/source/nds/ds2sound.h b/source/nds/ds2sound.h deleted file mode 100644 index 8c0e2bf..0000000 --- a/source/nds/ds2sound.h +++ /dev/null @@ -1,24 +0,0 @@ -// The sound buffer sizes used on the DS2's side, for each value of -// Settings.SoundPlaybackRate. -// * Don't buffer too much, otherwise audio is delayed from video. -// * Don't go below one frame (20 milliseconds). -// * Buffer sizes must be multiples of 128. -#define DS2_BUFFER_SIZE_4 512 /* tested working */ -#define DS2_BUFFER_SIZE_5 640 /* like the SNES! tested working */ -#define DS2_BUFFER_SIZE_6 896 /* tested working */ -#define DS2_BUFFER_SIZE_7 1024 /* tested working */ - -// The sampling rate for the sound, in Hz, for each value of -// Settings.SoundPlaybackRate. -#define SND_SAMPLE_RATE_1 8000 -#define SND_SAMPLE_RATE_2 11025 -#define SND_SAMPLE_RATE_3 16000 -#define SND_SAMPLE_RATE_4 22050 /* NDSSFC 1.06 - CATSFC 1.28 used this one */ -#define SND_SAMPLE_RATE_5 32000 /* like the SNES! */ -#define SND_SAMPLE_RATE_6 44100 -#define SND_SAMPLE_RATE_7 48000 /* CATSFC 1.25 made using this one possible */ - -// Settings in use. The number should match in all three settings. -#define DS2_BUFFER_SIZE DS2_BUFFER_SIZE_5 -#define SND_SAMPLE_RATE SND_SAMPLE_RATE_5 -#define SNES9X_SRATE_ID 5 diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp deleted file mode 100644 index a6c1f7d..0000000 --- a/source/nds/entry.cpp +++ /dev/null @@ -1,1595 +0,0 @@ -//entry.c -#include <stdio.h> - -//#include "ds2_types.h" -//#include "ds2_cpu.h" -//#include "ds2_timer.h" -//#include "ds2io.h" -//#include "fs_api.h" - -#include "snes9x.h" -#include "soundux.h" -#include "memmap.h" -#include "apu.h" -#include "cheats.h" -#include "snapshot.h" -#include "display.h" -#include "gfx.h" -#include "cpuexec.h" -#include "spc7110.h" - -#include "draw.h" -#include "gui.h" -#include "entry.h" -#include "ds2sound.h" - -#ifdef DS2_DMA -#include "ds2_dma.h" -#include "dma_adj.h" -#endif - -void S9xProcessSound (unsigned int); - -char *rom_filename = NULL; -char *SDD1_pack = NULL; - -/* - * It is only safe to manipulate saved states between frames. - */ -static bool8 LoadStateNeeded = FALSE; -static bool8 SaveStateNeeded = FALSE; - -static u8 Buf[MAX_BUFFER_SIZE]; - -#define FIXED_POINT 0x10000 -#define FIXED_POINT_SHIFT 16 -#define FIXED_POINT_REMAINDER 0xffff - -void S9xMessage (int /*type*/, int /*number*/, const char *message) -{ -#if 1 -#define MAX_MESSAGE_LEN (36 * 3) - - static char buffer [MAX_MESSAGE_LEN + 1]; - - printf ("%s\n", message); - strncpy (buffer, message, MAX_MESSAGE_LEN); - buffer [MAX_MESSAGE_LEN] = 0; - S9xSetInfoString (buffer); -#endif -} - -void S9xExtraUsage () -{ - /*empty*/ -} - -/* -* Release display device -*/ -void S9xDeinitDisplay (void) -{ -#ifdef DS2_DMA - if(GFX.Screen) AlignedFree(GFX.Screen, PtrAdj.GFXScreen); -#else - if(GFX.Screen) free(GFX.Screen); -#endif - if(GFX.SubScreen) free(GFX.SubScreen); - if(GFX.ZBuffer) free(GFX.ZBuffer); - if(GFX.SubZBuffer) free(GFX.SubZBuffer); -} - -void S9xInitDisplay (int, char **) -{ - int h = IMAGE_HEIGHT; - - GFX.Pitch = IMAGE_WIDTH * 2; -#ifdef DS2_DMA - GFX.Screen = (unsigned char*) AlignedMalloc (GFX.Pitch * h, 32, &PtrAdj.GFXScreen); -#else - GFX.Screen = (unsigned char*) malloc (GFX.Pitch * h); -#endif - GFX.SubScreen = (unsigned char*) malloc (GFX.Pitch * h); - GFX.ZBuffer = (unsigned char*) malloc ((GFX.Pitch >> 1) * h); - GFX.SubZBuffer =(unsigned char*) malloc ((GFX.Pitch >> 1) * h); - GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1; -} - -void S9xParseArg (char **argv, int &i, int argc) -{ -} - -void S9xParseDisplayArg (char **argv, int &ind, int) -{ -} - -void S9xExit () -{ - HighFrequencyCPU(); // Crank it up to exit quickly - if(Settings.SPC7110) - (*CleanUp7110)(); - - S9xSetSoundMute (TRUE); - S9xDeinitDisplay (); - Memory.SaveSRAM (S9xGetFilename (".srm")); - // S9xSaveCheatFile (S9xGetFilename (".chb")); // cheat binary file - // Do this when loading a cheat file! - Memory.Deinit (); - S9xDeinitAPU (); - -#ifdef _NETPLAY_SUPPORT - if (Settings.NetPlay) - S9xNetPlayDisconnect (); -#endif - - exit(0); -} - -const char *S9xBasename (const char *f) -{ - const char *p; - if ((p = strrchr (f, '/')) != NULL || (p = strrchr (f, '\\')) != NULL) - return (p + 1); - - return (f); -} - -bool8 S9xInitUpdate () -{ - return (TRUE); -} - - -extern void NDSSFCDrawFrameAntialiased(void* screen_addr); - - -bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) -{ - void* screen_addr = emu_config.BottomScreenGame - ? down_screen_addr - : up_screen_addr; - SCREEN_ID screen_num = emu_config.BottomScreenGame - ? DOWN_SCREEN - : UP_SCREEN; - - switch(game_config.graphic) - { - //Up - case 1: -#ifdef DS2_DMA - __dcache_writeback_all(); - ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen + 256 * 32 * 2, 256 * 192 * 2); - ds2_DMA_wait(1); - ds2_DMA_stop(1); -#else - memcpy(screen_addr, GFX.Screen+256*32*2, 256*192*2); -#endif - break; - - //Down - case 2: -#ifdef DS2_DMA - __dcache_writeback_all(); - ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen, 256 * 192 * 2); - ds2_DMA_wait(1); - ds2_DMA_stop(1); -#else - memcpy(screen_addr, GFX.Screen, 256*192*2); -#endif - break; - - //Both - case 3: -#ifdef DS2_DMA - __dcache_writeback_all(); - ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen + 256 * 16 * 2, 256 * 192 * 2); - ds2_DMA_wait(1); - ds2_DMA_stop(1); -#else - memcpy(screen_addr, GFX.Screen+256*16*2, 256*192*2); -#endif - break; - - case 4: - NDSSFCDrawFrameAntialiased (screen_addr); - break; - - - default: - { -#ifdef DS2_DMA - __dcache_writeback_all(); -#endif - register unsigned char *src, *dst; - register unsigned int m; - - src = GFX.Screen; - dst = (unsigned char*)screen_addr; - for(m = 0; m < 32; m++) - { -#ifdef DS2_DMA - ds2_DMAcopy_32Byte(1 /* channel: graphics */, dst, src, 256 * 6 * 2); - ds2_DMA_wait(1); - ds2_DMA_stop(1); -#else - memcpy(dst, src, 256*6*2); -#endif - dst += 256*6*2; - src += 256*7*2; - } - } - break; - } - - ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD); - // A problem with update method 1 (wait, double buffer) means that, after - // about 15 minutes of play time, the screen starts to half-redraw every - // frame. With update method 0, this is mitigated. (Method 2 is too slow.) - - return (TRUE); -} - -void _makepath (char *path, const char *, const char *dir, - const char *fname, const char *ext) -{ - if (dir && *dir) - { - strcpy (path, dir); - strcat (path, "/"); - } - else - *path = 0; - strcat (path, fname); - if (ext && *ext) - { - strcat (path, "."); - strcat (path, ext); - } -} - -void _splitpath (const char *path, char *drive, char *dir, char *fname, - char *ext) -{ - *drive = 0; - - char *slash = strrchr (path, '/'); - if (!slash) - slash = strrchr (path, '\\'); - - char *dot = strrchr (path, '.'); - - if (dot && slash && dot < slash) - dot = NULL; - - if (!slash) - { - strcpy (dir, ""); - strcpy (fname, path); - if (dot) - { - *(fname + (dot - path)) = 0; - strcpy (ext, dot + 1); - } - else - strcpy (ext, ""); - } - else - { - strcpy (dir, path); - *(dir + (slash - path)) = 0; - strcpy (fname, slash + 1); - if (dot) - { - *(fname + (dot - slash) - 1) = 0; - strcpy (ext, dot + 1); - } - else - strcpy (ext, ""); - } -} - -void S9xProcessEvents (bool8 block) -{ - -} - -void OutOfMemory () -{ -} - - -const char *S9xGetROMDirectory () -{ - return ((const char*)g_default_rom_dir); -} - - -const char *S9xGetSnapshotDirectory () -{ - return ((const char*)DEFAULT_RTS_DIR); -} - -const char *S9xGetFilename (const char *ex) -{ - static char filename [PATH_MAX + 1]; - char drive [_MAX_DRIVE + 1]; - char dir [_MAX_DIR + 1]; - char fname [_MAX_FNAME + 1]; - char ext [_MAX_EXT + 1]; - - _splitpath (Memory.ROMFilename, drive, dir, fname, ext); - strcpy (filename, S9xGetSnapshotDirectory ()); - strcat (filename, SLASH_STR); - strcat (filename, fname); - strcat (filename, ex); - - return (filename); -} - -const char *S9xGetFilenameInc (const char *e) -{ - return e; -#if 0 - static char filename [_MAX_PATH + 1]; - char drive [_MAX_DRIVE + 1]; - char dir [_MAX_DIR + 1]; - char fname [_MAX_FNAME + 1]; - char ext [_MAX_EXT + 1]; - char *ptr; - struct stat buf; - - if (strlen (S9xGetSnapshotDirectory())) - { - _splitpath (Memory.ROMFilename, drive, dir, fname, ext); - strcpy (filename, S9xGetSnapshotDirectory()); - strcat (filename, "/"); - strcat (filename, fname); - ptr = filename + strlen (filename); - strcat (filename, "00/"); - strcat (filename, e); - } - else - { - _splitpath (Memory.ROMFilename, drive, dir, fname, ext); - strcat (fname, "00/"); - _makepath (filename, drive, dir, fname, e); - ptr = strstr (filename, "00/"); - } - - do - { - if (++*(ptr + 2) > '9') - { - *(ptr + 2) = '0'; - if (++*(ptr + 1) > '9') - { - *(ptr + 1) = '0'; - if (++*ptr > '9') - break; - } - } - } while( stat(filename, &buf) == 0 ); - - return (filename); -#endif -} - -void S9xInitInputDevices () -{ -#ifdef JOYSTICK_SUPPORT - InitJoysticks (); -#endif -} - - - -void game_disableAudio() -{ - if( game_enable_audio == 1) - { - S9xSetSoundMute (FALSE); - } - else - { - S9xSetSoundMute (TRUE); - } -} - -void game_set_frameskip() -{ - if( game_config.frameskip_value == 0) - { - Settings.SkipFrames = AUTO_FRAMERATE; - } - else - { - Settings.SkipFrames = game_config.frameskip_value - 1 /* 1 -> 0 and so on */; - } -} - -void game_set_fluidity() -{ - if( game_config.SoundSync == 1) - { - Settings.SoundSync = TRUE; - } - else - { - Settings.SoundSync = FALSE; - } -} - -void game_set_retro(void) -{ - if (game_config.RetroSound == 1) - { - Settings.InterpolatedSound = FALSE; - S9xSetEightBitConsoleSound (TRUE); - } - else - { - Settings.InterpolatedSound = TRUE; - S9xSetEightBitConsoleSound (FALSE); - } -} - -void init_sfc_setting(void) -{ - ZeroMemory (&Settings, sizeof (Settings)); -#ifdef JOYSTICK_SUPPORT - Settings.JoystickEnabled = TRUE; -#else - Settings.JoystickEnabled = FALSE; -#endif - - Settings.SoundPlaybackRate = SNES9X_SRATE_ID; // -> ds2sound.h for defs -#ifndef FOREVER_STEREO - Settings.Stereo = TRUE; -#endif - Settings.SoundBufferSize = DS2_BUFFER_SIZE; - Settings.CyclesPercentage = 100; - Settings.DisableSoundEcho = FALSE; - //sound settings - Settings.APUEnabled = Settings.NextAPUEnabled = TRUE; - // Settings.FixFrequency = 1; - - Settings.H_Max = SNES_CYCLES_PER_SCANLINE; - Settings.SkipFrames = AUTO_FRAMERATE; - Settings.ShutdownMaster = TRUE; - Settings.FrameTimePAL = 20000; - Settings.FrameTimeNTSC = 16667; - Settings.DisableMasterVolume = FALSE; - Settings.Mouse = TRUE; - Settings.SuperScope = TRUE; - Settings.MultiPlayer5 = TRUE; - Settings.ControllerOption = SNES_JOYPAD; - - Settings.Transparency = TRUE; -#ifndef FOREVER_16_BIT - Settings.SixteenBit = TRUE; -#endif -#ifndef FOREVER_16_BIT_SOUND - Settings.SixteenBitSound = TRUE; -#endif - - Settings.SupportHiRes = FALSE; - Settings.ThreadSound = FALSE; - Settings.SoundSync = TRUE; - Settings.AutoSaveDelay = 0; -#ifdef _NETPLAY_SUPPORT - Settings.NetPlay = FALSE; - Settings.ServerName [0] = 0; - Settings.Port = NP_DEFAULT_PORT; -#endif - Settings.ApplyCheats = TRUE; - Settings.TurboMode = FALSE; - Settings.TurboSkipFrames = 10; - Settings.StretchScreenshots = 1; - - Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX; -} - -void S9xAutoSaveSRAM () -{ - Memory.SaveSRAM (S9xGetFilename (".srm")); -} - -int game_load_state(char* file) -{ - int flag; - - flag = 0; - if(S9xUnfreezeGame(file) == FALSE) - flag = -1; - - return flag; -} - -int game_save_state(char* file) -{ - int flag; - - flag = 0; - if(S9xFreezeGame(file) == FALSE) - flag = -1; - - S9xAutoSaveSRAM (); - - return flag; -} - -void game_restart(void) -{ - CPU.Flags = 0; - S9xReset (); -} - -int load_gamepak(const char* file) -{ - CPU.Flags = 0; - // mdelay(50); // Delete this delay - if (!Memory.LoadROM (file)) - return -1; - S9xReset (); - - Settings.FrameTime = (Settings.PAL ? Settings.FrameTimePAL : Settings.FrameTimeNTSC); - - Memory.LoadSRAM (S9xGetFilename (".srm")); - // mdelay(50); // Delete this delay - S9xLoadCheatFile (S9xGetFilename (".chb")); // cheat binary file, as opposed to text - -#ifdef _NETPLAY_SUPPORT - if (strlen (Settings.ServerName) == 0) - { - char *server = getenv ("S9XSERVER"); - if (server) - { - strncpy (Settings.ServerName, server, 127); - Settings.ServerName [127] = 0; - } - } - char *port = getenv ("S9XPORT"); - if (Settings.Port >= 0 && port) - Settings.Port = atoi (port); - else if (Settings.Port < 0) - Settings.Port = -Settings.Port; - - if (Settings.NetPlay) - { - int player; - - if (!S9xNetPlayConnectToServer (Settings.ServerName, Settings.Port, - Memory.ROMName, player)) - { - fprintf (stderr, "Failed to connected to Snes9x netplay" - " server \"%s\" on port %d.\n", - Settings.ServerName, Settings.Port); - S9xExit (); - } - fprintf (stderr, "Connected to \"%s\" on port %d as" - " player #%d playing \"%s\"\n", - Settings.ServerName, Settings.Port, player, Memory.ROMName); - } - -#endif -/* - if (snapshot_filename) - { - int Flags = CPU.Flags & (DEBUG_MODE_FLAG | TRACE_FLAG); - if (!S9xLoadSnapshot (snapshot_filename)) - exit (1); - CPU.Flags |= Flags; - } -*/ - - // mdelay(50); // Delete this delay - - return 0; -} - -extern "C" int sfc_main (int argc, char **argv); - -int sfc_main (int argc, char **argv) -{ - //Initialize GUI - gui_init(0); - - init_sfc_setting(); - - if (!Memory.Init () || !S9xInitAPU()) - OutOfMemory (); - - S9xInitDisplay (argc, argv); - if (!S9xGraphicsInit()) - OutOfMemory (); - - S9xInitSound (Settings.SoundPlaybackRate, -#ifndef FOREVER_STEREO - Settings.Stereo, -#else - TRUE, -#endif - Settings.SoundBufferSize); -#ifdef GFX_MULTI_FORMAT -// S9xSetRenderPixelFormat (RGB565); - S9xSetRenderPixelFormat (BGR555); -#endif - -#ifdef JOYSTICK_SUPPORT - uint32 JoypadSkip = 0; -#endif - - Settings.Paused = 1; - bool8 FirstInvocation = TRUE; - - while (1) - { - if (!Settings.Paused -#ifdef DEBUGGER - || (CPU.Flags & (DEBUG_MODE_FLAG | SINGLE_STEP_FLAG) -#endif - ) - S9xMainLoop (); - - -#ifdef DEBUGGER - if (CPU.Flags & DEBUG_MODE_FLAG) - { - S9xDoDebug (); - } - else -#endif - { - if (SaveStateNeeded) { - QuickSaveState (); - SaveStateNeeded = FALSE; - } - - if (LoadStateNeeded) { - QuickLoadState (); - LoadStateNeeded = FALSE; - } - - if (Settings.Paused) - { - S9xSetSoundMute (TRUE); - unsigned short screen[256*192]; - - if (FirstInvocation) { - memset(screen, 0, sizeof(screen)); - } - else { - S9xDeinitUpdate(256, 224, TRUE); - - void* screen_addr = emu_config.BottomScreenGame - ? down_screen_addr - : up_screen_addr; - - copy_screen((void*)screen, screen_addr, 0, 0, 256, 192); - } - - menu(screen, FirstInvocation); - FirstInvocation = FALSE; - game_disableAudio(); - Settings.Paused = 0; - } - } - -#ifdef JOYSTICK_SUPPORT - //if (Settings.JoystickEnabled && (JoypadSkip++ & 1) == 0) - if (Settings.JoystickEnabled) - ReadJoysticks (); -#endif - - } - - return (0); -} - -static unsigned int sync_last= 0; -static unsigned int sync_next = 0; - -static unsigned int skip_rate= 0; - -void S9xSyncSpeed () -{ - uint32 syncnow; - int32 syncdif; - -#if 0 - if (Settings.SoundSync == 2) - { - IPPU.RenderThisFrame = TRUE; - IPPU.SkippedFrames = 0; - return; - } -#endif - syncnow = getSysTime(); - - bool8 FastForward = game_fast_forward || temporary_fast_forward /* hotkey is held */; - - if (FastForward) - { - sync_last = syncnow; - sync_next = syncnow; - - if(++skip_rate < Settings.TurboSkipFrames) - IPPU.RenderThisFrame = false; - else - { - skip_rate = 0; - IPPU.RenderThisFrame = true; - } - } - else - { - // Manual or automatic frame skipping, no fast-forward. - if (Settings.SkipFrames == AUTO_FRAMERATE) - { - // frame_time is in getSysTime units: 42.667 microseconds. - int32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */; - if (sync_last > syncnow) // Overflow occurred! (every 50 hrs) - { - // Render this frame regardless, set the - // sync_next, and get the hell out. - IPPU.RenderThisFrame = TRUE; - sync_last = syncnow; - sync_next = syncnow + frame_time; - return; - } - sync_last = syncnow; - // If this is positive, we have syncdif*42.66 microseconds to - // spare. - // If this is negative, we're late by syncdif*42.66 - // microseconds. - syncdif = sync_next - syncnow; - if(skip_rate < 2 /* did not skip 2 frames yet */) - { - // Skip a minimum of 2 frames between rendered frames. - // This prevents the DSTwo-DS link from being too busy - // to return button statuses. - ++skip_rate; - IPPU.RenderThisFrame = FALSE; - sync_next += frame_time; - } - else if(syncdif < 0) - { - /* - * If we're consistently late, delay up to 8 frames. - * - * That really helps with certain games, such as - * Super Mario RPG and Yoshi's Island. - */ - if(++skip_rate < 10) - { - if(syncdif >= -11719 /* not more than 500.0 ms late */) - { - IPPU.RenderThisFrame = FALSE; - sync_next += frame_time; - } - else - { //lag more than 0.5s, maybe paused - IPPU.RenderThisFrame = TRUE; - sync_next = syncnow + frame_time; - } - } - else - { - skip_rate = 0; - IPPU.RenderThisFrame = TRUE; - sync_next = syncnow + frame_time; - } - } - else // Early - { - skip_rate = 0; - if (syncdif > 0) - { - do { - S9xProcessSound (0); -#ifdef ACCUMULATE_JOYPAD -/* - * This call allows NDSSFC to synchronise the DS controller more often. - * If porting a later version of Snes9x into NDSSFC, it is essential to - * preserve it. - */ - NDSSFCAccumulateJoypad (); -#endif - syncdif = sync_next - getSysTime(); - } while (syncdif > 0); - } - - IPPU.RenderThisFrame = TRUE; - sync_next += frame_time; - } -#if 0 - if(++framenum >= 60) - { - syncdif = syncnow - sync_last; - sync_last = syncnow; - framenum = 0; - //printf("T %d %d\n", syncdif*42667/1000, realframe); - realframe = 0; - } -#endif - } - else /* if (Settings.SkipFrames != AUTO_FRAMERATE) */ - { - // frame_time is in getSysTime units: 42.667 microseconds. - uint32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */; - sync_last = syncnow; - if (++skip_rate > Settings.SkipFrames) - { - skip_rate = 0; - IPPU.RenderThisFrame = TRUE; - // Are we early? - syncdif = sync_next - syncnow; - if (syncdif > 0) - { - do { - S9xProcessSound (0); -#ifdef ACCUMULATE_JOYPAD -/* - * This call allows NDSSFC to synchronise the DS controller more often. - * If porting a later version of Snes9x into NDSSFC, it is essential to - * preserve it. - */ - NDSSFCAccumulateJoypad (); -#endif - syncdif = sync_next - getSysTime(); - } while (syncdif > 0); - // After that little delay, what time is it? - syncnow = getSysTime(); - } - sync_next = syncnow + frame_time * (Settings.SkipFrames + 1); - } - else - { - IPPU.RenderThisFrame = FALSE; - } - } - } - -#ifdef __sgi - /* BS: saves on CPU usage */ - sginap(1); -#endif - -#if 0 - /* Check events */ - - static struct timeval next1 = {0, 0}; - struct timeval now; - - CHECK_SOUND(); -// S9xProcessEvents(FALSE); - - while (gettimeofday (&now, NULL) < 0) ; - - /* If there is no known "next" frame, initialize it now */ - if (next1.tv_sec == 0) { next1 = now; ++next1.tv_usec; } - - /* If we're on AUTO_FRAMERATE, we'll display frames always - * only if there's excess time. - * Otherwise we'll display the defined amount of frames. - */ - unsigned limit = Settings.SkipFrames == AUTO_FRAMERATE - ? (timercmp(&next1, &now, <) ? 10 : 1) - : Settings.SkipFrames; - - IPPU.RenderThisFrame = ++IPPU.SkippedFrames >= limit; - if(IPPU.RenderThisFrame) - { - IPPU.SkippedFrames = 0; - } - else - { - /* If we were behind the schedule, check how much it is */ - if(timercmp(&next1, &now, <)) - { - unsigned lag = - (now.tv_sec - next1.tv_sec) * 1000000 - + now.tv_usec - next1.tv_usec; - if(lag >= 1000000) - { - /* More than a second behind means probably - * pause. The next line prevents the magic - * fast-forward effect. - */ - next1 = now; - } - } - } - - /* Delay until we're completed this frame */ - - /* Can't use setitimer because the sound code already could - * be using it. We don't actually need it either. - */ - - while(timercmp(&next1, &now, >)) - { - /* If we're ahead of time, sleep a while */ - unsigned timeleft = - (next1.tv_sec - now.tv_sec) * 1000000 - + next1.tv_usec - now.tv_usec; - //fprintf(stderr, "<%u>", timeleft); - usleep(timeleft); - - CHECK_SOUND(); -// S9xProcessEvents(FALSE); - - while (gettimeofday (&now, NULL) < 0) ; - /* Continue with a while-loop because usleep() - * could be interrupted by a signal - */ - } - - /* Calculate the timestamp of the next frame. */ - next1.tv_usec += Settings.FrameTime; - if (next1.tv_usec >= 1000000) - { - next1.tv_sec += next1.tv_usec / 1000000; - next1.tv_usec %= 1000000; - } -#endif -} - -bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size) -{ -#ifndef FOREVER_16_BIT_SOUND - so.sixteen_bit = TRUE; -#endif -#ifndef FOREVER_STEREO - so.stereo = stereo; -#endif - so.playback_rate = SND_SAMPLE_RATE; - S9xSetPlaybackRate (so.playback_rate); - - if (buffer_size == 0) - buffer_size = DS2_BUFFER_SIZE; - - if (buffer_size > MAX_BUFFER_SIZE / 4) - buffer_size = MAX_BUFFER_SIZE / 4; -#ifndef FOREVER_16_BIT_SOUND - if (so.sixteen_bit) -#endif - buffer_size *= 2; -#ifndef FOREVER_STEREO - if (so.stereo) -#endif - buffer_size *= 2; - - so.buffer_size = buffer_size; - - return (TRUE); -} - -void S9xGenerateSound () -{ -#ifndef FOREVER_16_BIT_SOUND - int bytes_so_far = so.sixteen_bit ? (so.samples_mixed_so_far << 1) : - so.samples_mixed_so_far; -#else - int bytes_so_far = so.samples_mixed_so_far << 1; -#endif - - if (bytes_so_far >= so.buffer_size) - return; - - so.err_counter += so.err_rate; - if (so.err_counter >= FIXED_POINT) - { - // Write this many samples overall - int samples_to_write = so.err_counter >> FIXED_POINT_SHIFT; -#ifndef FOREVER_STEREO - if (so.stereo) -#endif - samples_to_write <<= 1; - int byte_offset = (bytes_so_far + so.play_position) & SOUND_BUFFER_SIZE_MASK; - - so.err_counter &= FIXED_POINT_REMAINDER; - - do - { - int bytes_this_run = samples_to_write; -#ifndef FOREVER_16_BIT_SOUND - if (so.sixteen_bit) -#endif - bytes_this_run <<= 1; - - if (byte_offset + bytes_this_run > SOUND_BUFFER_SIZE) - { - bytes_this_run = SOUND_BUFFER_SIZE - byte_offset; - } - - if (bytes_so_far + bytes_this_run > so.buffer_size) - { - bytes_this_run = so.buffer_size - bytes_so_far; - if (bytes_this_run == 0) - break; - } - - int samples_this_run = bytes_this_run; -#ifndef FOREVER_16_BIT_SOUND - if (so.sixteen_bit) -#endif - samples_this_run >>= 1; - - S9xMixSamples (Buf + byte_offset, samples_this_run); - so.samples_mixed_so_far += samples_this_run; - samples_to_write -= samples_this_run; -#ifndef FOREVER_16_BIT_SOUND - bytes_so_far += so.sixteen_bit ? (samples_this_run << 1) : - samples_this_run; -#else - bytes_so_far += samples_this_run << 1; -#endif - byte_offset = (byte_offset + bytes_this_run) & SOUND_BUFFER_SIZE_MASK; - } while (samples_to_write > 0); - } -} - -#define SOUND_EMISSION_INTERVAL ((unsigned int) ((((unsigned long long) DS2_BUFFER_SIZE * 1000000) / SND_SAMPLE_RATE) * 3 / 128)) -#define TRUE_SOUND_EMISSION_INTERVAL ((((double) DS2_BUFFER_SIZE * 1000000) / SND_SAMPLE_RATE) * 3 / 128) -#define SOUND_EMISSION_INTERVAL_ERROR ((int) ((TRUE_SOUND_EMISSION_INTERVAL - SOUND_EMISSION_INTERVAL) * FIXED_POINT)) -static unsigned int LastSoundEmissionTime = 0; - -/* - * Accumulated error in the sound emission time. The unit is as follows: - * FIXED_POINT = 42.667 microseconds. - * As the error goes past FIXED_POINT, the new target for sound emission - * becomes 42.667 microseconds LATER. This helps with sound buffer overruns, - * correctly dealing with the fact that 42.667 microseconds does not fit - * an integer number of times in 1/32000 second (or whatever sampling rate). - */ -static unsigned int SoundEmissionTimeError = 0; - -void S9xProcessSound (unsigned int) -{ - if (!game_enable_audio) - return; - - unsigned int Now = getSysTime(); - if (Now - LastSoundEmissionTime >= SOUND_EMISSION_INTERVAL) - { - if(ds2_checkAudiobuff() > AUDIO_BUFFER_COUNT - 1) - { - LastSoundEmissionTime++; - return; - } - - unsigned short *audiobuff; - - if (Now - LastSoundEmissionTime >= 11719 /* 500 milliseconds */) - { - LastSoundEmissionTime = Now; - // We were probably paused. Restart sending sound, - // synchronising from now. - } - else - { - LastSoundEmissionTime += SOUND_EMISSION_INTERVAL; - SoundEmissionTimeError += SOUND_EMISSION_INTERVAL_ERROR; - if (SoundEmissionTimeError >= FIXED_POINT) - { - LastSoundEmissionTime += SoundEmissionTimeError >> FIXED_POINT_SHIFT; - SoundEmissionTimeError &= FIXED_POINT_REMAINDER; - } - } - /* Number of samples to generate now */ - int sample_count = so.buffer_size; -#ifndef FOREVER_16_BIT_SOUND - if (so.sixteen_bit) - { -#endif - /* to prevent running out of buffer space, - * create less samples - */ - sample_count >>= 1; -#ifndef FOREVER_16_BIT_SOUND - } -#endif - - audiobuff = (unsigned short*)ds2_getAudiobuff(); - while (audiobuff == NULL) //There are audio queue in sending or wait to send - { -#ifdef ACCUMULATE_JOYPAD - NDSSFCAccumulateJoypad (); -#endif - audiobuff = (unsigned short*)ds2_getAudiobuff(); - } - - /* If we need more audio samples */ - if (so.samples_mixed_so_far < sample_count) - { - /* Where to put the samples to */ -#ifndef FOREVER_16_BIT_SOUND - unsigned byte_offset = (so.play_position + - (so.sixteen_bit ? (so.samples_mixed_so_far << 1) : so.samples_mixed_so_far)) & SOUND_BUFFER_SIZE_MASK; -#else - unsigned byte_offset = (so.play_position + - (so.samples_mixed_so_far << 1)) & SOUND_BUFFER_SIZE_MASK; -#endif - - if (Settings.SoundSync == 2) - { - /*memset (Buf + (byte_offset & SOUND_BUFFER_SIZE_MASK), 0, - sample_count - so.samples_mixed_so_far);*/ - } - else - { - /* Mix the missing samples */ -#ifndef FOREVER_16_BIT_SOUND - int bytes_so_far = so.sixteen_bit ? (so.samples_mixed_so_far << 1) : - so.samples_mixed_so_far; -#else - int bytes_so_far = so.samples_mixed_so_far << 1; -#endif - - uint32 samples_to_write = sample_count - so.samples_mixed_so_far; - do - { - int bytes_this_run = samples_to_write; -#ifndef FOREVER_16_BIT_SOUND - if (so.sixteen_bit) -#endif - bytes_this_run <<= 1; - - if (byte_offset + bytes_this_run > SOUND_BUFFER_SIZE) - { - bytes_this_run = SOUND_BUFFER_SIZE - byte_offset; - } - - if (bytes_so_far + bytes_this_run > so.buffer_size) - { - bytes_this_run = so.buffer_size - bytes_so_far; - if (bytes_this_run == 0) - break; - } - - int samples_this_run = bytes_this_run; -#ifndef FOREVER_16_BIT_SOUND - if (so.sixteen_bit) -#endif - samples_this_run >>= 1; - - S9xMixSamples (Buf + byte_offset, samples_this_run); - so.samples_mixed_so_far += samples_this_run; - samples_to_write -= samples_this_run; -#ifndef FOREVER_16_BIT_SOUND - bytes_so_far += so.sixteen_bit ? (samples_this_run << 1) : - samples_this_run; -#else - bytes_so_far += samples_this_run << 1; -#endif - byte_offset = (byte_offset + bytes_this_run) & SOUND_BUFFER_SIZE_MASK; - } while (samples_to_write > 0); - } - } - - // if (!so.mute_sound) - { - unsigned bytes_to_write = sample_count; -#ifndef FOREVER_16_BIT_SOUND - if(so.sixteen_bit) -#endif - bytes_to_write <<= 1; - - unsigned byte_offset = so.play_position; - so.play_position = (so.play_position + bytes_to_write) & SOUND_BUFFER_SIZE_MASK; /* wrap to beginning */ - - unsigned short *dst_pt = audiobuff; - unsigned short *dst_pt1 = dst_pt + DS2_BUFFER_SIZE; - - /* Feed the samples to the soundcard until nothing is left */ - for(;;) - { - int I = bytes_to_write; - if (byte_offset + I > SOUND_BUFFER_SIZE) - { - I = SOUND_BUFFER_SIZE - byte_offset; - } - if(I == 0) break; - - // memcpy(dst_pt, (char *) Buf + byte_offset, I); - // dst_pt += I; - - unsigned short *src_pt= (unsigned short*)(Buf + byte_offset); - for(int m= 0; m < I/4; m++) - { - *dst_pt++= *src_pt++;//(*src_pt++) <<1; - *dst_pt1++= *src_pt++;//(*src_pt++) <<1; - } - - bytes_to_write -= I; - byte_offset = (byte_offset + I) & SOUND_BUFFER_SIZE_MASK; /* wrap */ - } - - ds2_updateAudio(); - - /* All data sent. */ - } - - so.samples_mixed_so_far -= sample_count; - } -} - -/* -const unsigned int keymap[12] = { - 0x80, //KEY_A - 0x8000, //KEY_B - 0x2000, //KEY_SELECT - 0x1000, //KEY_START - 0x100, //KEY_RIGHT - 0x200, //KEY_LEFT - 0x800, //KEY_UP - 0x400, //KEY_DOWN - 0x10, //KEY_R - 0x20, //KEY_L - 0x40, //KEY_X - 0x4000 //KEY_Y - }; -*/ - -static bool8 SoundToggleWasHeld = FALSE; -static bool8 LoadStateWasHeld = FALSE; -static bool8 SaveStateWasHeld = FALSE; -static bool8 ToggleFullScreenWasHeld = FALSE; - -#ifdef ACCUMULATE_JOYPAD -// These are kept as DS key bitfields until it's time to send them to Snes9x. -static uint32 PreviousControls = 0x00000000; -static uint32 ControlsPressed = 0x00000000; -static uint32 ControlsReleased = 0x00000000; - -void NDSSFCAccumulateJoypad () -{ - struct key_buf inputdata; - ds2_getrawInput(&inputdata); - - ControlsPressed |= inputdata.key & ~PreviousControls; - ControlsReleased |= PreviousControls & ~inputdata.key; -} -#endif // ACCUMULATE_JOYPAD - -uint32 S9xReadJoypad (int which1) -{ - if(which1 < 1) - { - uint32 Controls; -#ifdef ACCUMULATE_JOYPAD - Controls = (PreviousControls | ControlsPressed) & ~ControlsReleased; - PreviousControls = Controls; - ControlsPressed = ControlsReleased = 0x00000000; -#else - { - struct key_buf inputdata; - ds2_getrawInput(&inputdata); - - Controls = inputdata.key; - } -#endif - - if (Controls & KEY_LID) - { - LowFrequencyCPU(); - ds2_setSupend(); - struct key_buf inputdata; - do { - ds2_getrawInput(&inputdata); - mdelay(1); - } while (inputdata.key & KEY_LID); - ds2_wakeup(); - // Before starting to emulate again, turn on only the - // game screen's backlight. - SCREEN_ID screen_num = emu_config.BottomScreenGame - ? DOWN_SCREEN - : UP_SCREEN; - mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(3 - screen_num); - GameFrequencyCPU(); - } - - u32 HotkeyReturnToMenu = game_config.HotkeyReturnToMenu != 0 ? game_config.HotkeyReturnToMenu : emu_config.HotkeyReturnToMenu; - u32 HotkeyTemporaryFastForward = game_config.HotkeyTemporaryFastForward != 0 ? game_config.HotkeyTemporaryFastForward : emu_config.HotkeyTemporaryFastForward; - u32 HotkeyToggleSound = game_config.HotkeyToggleSound != 0 ? game_config.HotkeyToggleSound : emu_config.HotkeyToggleSound; - u32 HotkeyQuickLoadState = game_config.HotkeyQuickLoadState != 0 ? game_config.HotkeyQuickLoadState : emu_config.HotkeyQuickLoadState; - u32 HotkeyQuickSaveState = game_config.HotkeyQuickSaveState != 0 ? game_config.HotkeyQuickSaveState : emu_config.HotkeyQuickSaveState; - u32 HotkeyToggleFullScreen = game_config.HotkeyToggleFullScreen != 0 ? game_config.HotkeyToggleFullScreen : emu_config.HotkeyToggleFullScreen; - - if(Controls & KEY_TOUCH || - (HotkeyReturnToMenu && ((Controls & HotkeyReturnToMenu) == HotkeyReturnToMenu)) - ) //Active menu - Settings.Paused = 1; - - temporary_fast_forward = - (HotkeyTemporaryFastForward && ((Controls & HotkeyTemporaryFastForward) == HotkeyTemporaryFastForward)) - ; - - bool8 SoundToggleIsHeld = - (HotkeyToggleSound && ((Controls & HotkeyToggleSound) == HotkeyToggleSound)) - ; - - if (SoundToggleIsHeld && !SoundToggleWasHeld) - { - game_enable_audio = !game_enable_audio; - game_disableAudio(); - } - - SoundToggleWasHeld = SoundToggleIsHeld; - - /* It is only safe to load/save a state between frames. - * entry.cpp:sfc_main will pick this up. */ - bool8 LoadStateIsHeld = - (HotkeyQuickLoadState && ((Controls & HotkeyQuickLoadState) == HotkeyQuickLoadState)) - ; - - if (LoadStateIsHeld && !LoadStateWasHeld) - LoadStateNeeded = TRUE; - - LoadStateWasHeld = LoadStateIsHeld; - - bool8 SaveStateIsHeld = - (HotkeyQuickSaveState && ((Controls & HotkeyQuickSaveState) == HotkeyQuickSaveState)) - ; - - if (SaveStateIsHeld && !SaveStateWasHeld) - SaveStateNeeded = TRUE; - - SaveStateWasHeld = SaveStateIsHeld; - - /* Full-screen toggle? */ - bool8 ToggleFullScreenIsHeld = - (HotkeyToggleFullScreen && ((Controls & HotkeyToggleFullScreen) == HotkeyToggleFullScreen)) - ; - - if (ToggleFullScreenIsHeld && !ToggleFullScreenWasHeld) { - ToggleFullScreen (); - } - - ToggleFullScreenWasHeld = ToggleFullScreenIsHeld; - - uint32 key = 0x80000000; // Required by Snes9x - - // DS -> SNES - key |= (Controls & KEY_A ) << 7; // 0x0001 -> 0x0080 - key |= (Controls & KEY_B ) << 14; // 0x0002 -> 0x8000 - key |= (Controls & KEY_SELECT) << 11; // 0x0004 -> 0x2000 - key |= (Controls & KEY_START ) << 9; // 0x0008 -> 0x1000 - key |= (Controls & KEY_UP ) << 5; // 0x0040 -> 0x0800 - // 0x0010 -> 0x0100; 0x0020 -> 0x0200 - // 0x0030 -> 0x0300 - key |= (Controls & (KEY_RIGHT | KEY_LEFT)) << 4; - // 0x0100 -> 0x0010; 0x0200 -> 0x0020; 0x0400 -> 0x0040 - // 0x0700 -> 0x0070 - key |= (Controls & (KEY_R | KEY_L | KEY_X)) >> 4; - // 0x0080 -> 0x0400; 0x0800 -> 0x4000 - // 0x0880 -> 0x4400 - key |= (Controls & (KEY_DOWN | KEY_Y)) << 3; -/* - for(i= 0; i < 12; i++) //remap key - { - key |= (inputdata.key & (1<<i)) ? keymap[i] : 0; - } -*/ - - return key; - } - else - return 0; -} - -static int S9xCompareSDD1IndexEntries (const void *p1, const void *p2) -{ - return (*(uint32 *) p1 - *(uint32 *) p2); -} - -void S9xLoadSDD1Data () -{ - char filename [_MAX_PATH + 1]; - char index [_MAX_PATH + 1]; - char data [_MAX_PATH + 1]; - char patch [_MAX_PATH + 1]; - - Memory.FreeSDD1Data (); - - strcpy (filename, S9xGetSnapshotDirectory ()); - - Settings.SDD1Pack=FALSE; - if (strncmp (Memory.ROMName, "Star Ocean", 10) == 0){ - if(SDD1_pack) strcpy (filename, SDD1_pack); -#ifdef SDD1_DECOMP - else Settings.SDD1Pack=TRUE; -#else - strcat (filename, "/socnsdd1"); -#endif - } else if(strncmp(Memory.ROMName, "STREET FIGHTER ALPHA2", 21)==0){ - if(SDD1_pack) strcpy (filename, SDD1_pack); -#ifdef SDD1_DECOMP - else Settings.SDD1Pack=TRUE; -#else - strcat (filename, "/sfa2sdd1"); -#endif - } else { - if(SDD1_pack) strcpy (filename, SDD1_pack); -#ifdef SDD1_DECOMP - else Settings.SDD1Pack=TRUE; -#else - S9xMessage(S9X_WARNING, S9X_ROM_INFO, "WARNING: No default SDD1 pack for this ROM"); -#endif - } - - if(Settings.SDD1Pack) return; - - DIR *dir = opendir (filename); - - index [0] = 0; - data [0] = 0; - patch [0] = 0; - - if (dir) - { -// struct dirent *d; - dirent *d; - - while ((d = readdir (dir))) - { - if (strcasecmp (d->d_name, "SDD1GFX.IDX") == 0) - { - strcpy (index, filename); - strcat (index, "/"); - strcat (index, d->d_name); - } - else - if (strcasecmp (d->d_name, "SDD1GFX.DAT") == 0) - { - strcpy (data, filename); - strcat (data, "/"); - strcat (data, d->d_name); - } - if (strcasecmp (d->d_name, "SDD1GFX.PAT") == 0) - { - strcpy (patch, filename); - strcat (patch, "/"); - strcat (patch, d->d_name); - } - } - closedir (dir); - - if (strlen (index) && strlen (data)) - { - FILE *fs = fopen (index, "rb"); - int len = 0; - - if (fs) - { - // Index is stored as a sequence of entries, each entry being - // 12 bytes consisting of: - // 4 byte key: (24bit address & 0xfffff * 16) | translated block - // 4 byte ROM offset - // 4 byte length - fseek (fs, 0, SEEK_END); - len = ftell (fs); - //rewind (fs); - fseek (fs, 0, SEEK_SET); - Memory.SDD1Index = (uint8 *) malloc (len); - fread (Memory.SDD1Index, 1, len, fs); - fclose (fs); - Memory.SDD1Entries = len / 12; - - if (!(fs = fopen (data, "rb"))) - { - free ((char *) Memory.SDD1Index); - Memory.SDD1Index = NULL; - Memory.SDD1Entries = 0; - } - else - { - fseek (fs, 0, SEEK_END); - len = ftell (fs); - //rewind (fs); - fseek (fs, 0, SEEK_SET); - Memory.SDD1Data = (uint8 *) malloc (len); - fread (Memory.SDD1Data, 1, len, fs); - fclose (fs); - - if (strlen (patch) > 0 && - (fs = fopen (patch, "rb"))) - { - fclose (fs); - } -#ifdef MSB_FIRST - // Swap the byte order of the 32-bit value triplets on - // MSBFirst machines. - uint8 *ptr = Memory.SDD1Index; - for (int i = 0; i < Memory.SDD1Entries; i++, ptr += 12) - { - SWAP_DWORD ((*(uint32 *) (ptr + 0))); - SWAP_DWORD ((*(uint32 *) (ptr + 4))); - SWAP_DWORD ((*(uint32 *) (ptr + 8))); - } -#endif - qsort (Memory.SDD1Index, Memory.SDD1Entries, 12, - S9xCompareSDD1IndexEntries); - } - } - } - else - { - fprintf (stderr, "Decompressed data pack not found in '%s'.\n", - filename); - } - } -} - -bool8 S9xReadMousePosition (int which1, int &x, int &y, uint32 &buttons) -{ - return (FALSE); -} - -bool8 S9xReadSuperScopePosition (int &x, int &y, uint32 &buttons) -{ - return (TRUE); -} - -bool JustifierOffscreen() -{ - return (FALSE); -} - -void JustifierButtons(uint32& justifiers) -{ -} - -START_EXTERN_C -char* osd_GetPackDir() -{ - static char filename[_MAX_PATH]; - memset(filename, 0, _MAX_PATH); - - if(strlen(S9xGetSnapshotDirectory())!=0) - strcpy (filename, S9xGetSnapshotDirectory()); - else - { - char dir [_MAX_DIR + 1]; - char drive [_MAX_DRIVE + 1]; - char name [_MAX_FNAME + 1]; - char ext [_MAX_EXT + 1]; - _splitpath(Memory.ROMFilename, drive, dir, name, ext); - _makepath(filename, drive, dir, NULL, NULL); - } - - if(!strncmp((char*)&Memory.ROM [0xffc0], "SUPER POWER LEAG 4 ", 21)) - { - if (getenv("SPL4PACK")) - return getenv("SPL4PACK"); - else - strcat(filename, "/SPL4-SP7"); - } - else if(!strncmp((char*)&Memory.ROM [0xffc0], "MOMOTETSU HAPPY ",21)) - { - if (getenv("MDHPACK")) - return getenv("MDHPACK"); - else - strcat(filename, "/SMHT-SP7"); - } - else if(!strncmp((char*)&Memory.ROM [0xffc0], "HU TENGAI MAKYO ZERO ", 21)) - { - if (getenv("FEOEZPACK")) - return getenv("FEOEZPACK"); - else - strcat(filename, "/FEOEZSP7"); - } - else if(!strncmp((char*)&Memory.ROM [0xffc0], "JUMP TENGAIMAKYO ZERO",21)) - { - if (getenv("SJNSPACK")) - return getenv("SJNSPACK"); - else - strcat(filename, "/SJUMPSP7"); - } else strcat(filename, "/MISC-SP7"); - return filename; -} -END_EXTERN_C - - diff --git a/source/nds/entry.h b/source/nds/entry.h deleted file mode 100644 index e1646fb..0000000 --- a/source/nds/entry.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - void game_disableAudio(); - void game_set_frameskip(); - void game_set_fluidity(); - void game_set_retro(); - - int game_load_state(char* file); - int game_save_state(char* file); - void S9xAutoSaveSRAM (); - - void game_restart(void); - - int load_gamepak(const char* file); -#ifdef __cplusplus -} -#endif - -const char *S9xGetFilename (const char *ex); diff --git a/source/nds/font_dot.h b/source/nds/font_dot.h deleted file mode 100644 index c3b534a..0000000 --- a/source/nds/font_dot.h +++ /dev/null @@ -1,93 +0,0 @@ -/* font_dot.h - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __FONT_DOT_H__ -#define __FONT_DOT_H__ - -//version 0.1 - -const unsigned char font_map[128][8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x08, 0x08, 0x08, - 0x00, 0x00, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x08, 0x08, 0x78, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, - 0x7c, 0x64, 0x44, 0x44, 0x64, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x70, 0x50, 0x50, 0x70, 0x00, - 0x24, 0x24, 0x1c, 0x08, 0x3f, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x16, 0x1a, 0x12, 0x12, 0x16, 0x34, 0x20, 0x00, 0x3c, 0x24, 0x24, 0x66, 0x24, 0x3c, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x1c, 0x3c, 0x3c, 0x1c, 0x0c, 0x04, 0x00, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x00, - 0x54, 0x54, 0x34, 0x14, 0x14, 0x14, 0x14, 0x14, 0x08, 0x08, 0x08, 0x7f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, - 0x00, 0x00, 0x08, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7c, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x7e, 0x28, 0x7e, 0x28, 0x28, 0x00, - 0x1c, 0x2c, 0x28, 0x18, 0x0c, 0x2c, 0x3c, 0x08, 0x64, 0x68, 0x68, 0x7c, 0x1c, 0x1c, 0x2c, 0x00, - 0x30, 0x30, 0x3c, 0x28, 0x58, 0x50, 0x3c, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x04, 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40, - 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, - 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, - 0x18, 0x24, 0x04, 0x08, 0x10, 0x20, 0x3c, 0x00, 0x18, 0x24, 0x04, 0x18, 0x04, 0x24, 0x18, 0x00, - 0x08, 0x18, 0x28, 0x48, 0x7c, 0x08, 0x08, 0x00, 0x3c, 0x20, 0x38, 0x04, 0x04, 0x24, 0x18, 0x00, - 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x3c, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, - 0x18, 0x24, 0x24, 0x18, 0x24, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x18, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, - 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00, - 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x10, 0x24, 0x24, 0x08, 0x10, 0x10, 0x00, 0x10, - 0x38, 0x4c, 0x54, 0x5c, 0x54, 0x44, 0x38, 0x00, 0x10, 0x10, 0x28, 0x28, 0x38, 0x28, 0x6c, 0x00, - 0x78, 0x24, 0x38, 0x24, 0x24, 0x24, 0x78, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, - 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x7c, 0x24, 0x20, 0x38, 0x20, 0x24, 0x7c, 0x00, - 0x7c, 0x24, 0x28, 0x38, 0x28, 0x20, 0x70, 0x00, 0x38, 0x40, 0x40, 0x40, 0x5c, 0x48, 0x30, 0x00, - 0x76, 0x24, 0x24, 0x3c, 0x24, 0x24, 0x76, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, - 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, 0x74, 0x28, 0x30, 0x30, 0x28, 0x28, 0x6c, 0x00, - 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x7c, 0x00, 0x66, 0x3c, 0x3c, 0x3c, 0x34, 0x24, 0x66, 0x00, - 0x6e, 0x24, 0x34, 0x34, 0x2c, 0x24, 0x74, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, - 0x78, 0x24, 0x24, 0x38, 0x20, 0x20, 0x70, 0x00, 0x38, 0x44, 0x44, 0x44, 0x74, 0x4c, 0x38, 0x0c, - 0x78, 0x24, 0x38, 0x28, 0x24, 0x24, 0x76, 0x00, 0x1c, 0x24, 0x20, 0x18, 0x04, 0x24, 0x38, 0x00, - 0x7c, 0x54, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x66, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, - 0x6c, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x7e, 0x52, 0x52, 0x2c, 0x2c, 0x24, 0x24, 0x00, - 0x6c, 0x28, 0x28, 0x10, 0x28, 0x28, 0x6c, 0x00, 0x6c, 0x28, 0x28, 0x10, 0x10, 0x10, 0x38, 0x00, - 0x7c, 0x48, 0x10, 0x10, 0x20, 0x24, 0x7c, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, - 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x04, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, - 0x10, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x38, 0x48, 0x3c, 0x00, - 0x60, 0x20, 0x38, 0x24, 0x24, 0x24, 0x38, 0x00, 0x00, 0x00, 0x1c, 0x24, 0x20, 0x20, 0x1c, 0x00, - 0x0c, 0x04, 0x1c, 0x24, 0x24, 0x24, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3c, 0x20, 0x1c, 0x00, - 0x0c, 0x10, 0x3c, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x28, 0x38, 0x20, 0x3c, 0x3c, - 0x60, 0x20, 0x38, 0x24, 0x24, 0x24, 0x76, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, - 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x38, 0x60, 0x20, 0x2c, 0x28, 0x30, 0x28, 0x6c, 0x00, - 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, - 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x76, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, - 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x38, 0x70, 0x00, 0x00, 0x1c, 0x24, 0x24, 0x24, 0x1c, 0x0e, - 0x00, 0x00, 0x34, 0x18, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x18, 0x04, 0x3c, 0x00, - 0x10, 0x10, 0x38, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x6c, 0x24, 0x24, 0x24, 0x1e, 0x00, - 0x00, 0x00, 0x6c, 0x28, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x6f, 0x2a, 0x2a, 0x36, 0x14, 0x00, - 0x00, 0x00, 0x7c, 0x28, 0x10, 0x28, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x10, 0x10, 0x20, 0x60, - 0x00, 0x00, 0x3c, 0x08, 0x08, 0x10, 0x3c, 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, - 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - -#endif //__FONT_DOT_H__ - diff --git a/source/nds/gcheat.c b/source/nds/gcheat.c deleted file mode 100644 index 93d89cc..0000000 --- a/source/nds/gcheat.c +++ /dev/null @@ -1,128 +0,0 @@ -/* gcheat.c - * - * Copyright (C) 2012 GBAtemp user Nebuleon. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "port.h" -#include "string.h" -#include "fs_api.h" -#include "ds2_malloc.h" -#include "gcheat.h" -#include "cheats.h" - -extern struct SCheatData Cheat; - -// Reads a cheat text file in BSNES's format. -int NDSSFCLoadCheatFile(const char* filename) -{ - FILE* fp = fopen(filename, "r"); - if (fp == NULL) - return -1; - - S9xDeleteCheats(); - - // The construction is "a","b","c" <newline>. - // a is ignored. In BSNES, it decides whether the code is enabled. - // b is a series of codes separated by +. Each of the codes is in the form - // accepted by the Game Genie, Pro Action Replay, or the GoldFinger. - // c is the cheat's description. - char line[256], code[24]; - char *description, *codes_ptr; - uint32 address; - uint8 byte; - uint8 bytes [3]; - bool8 sram; - uint8 num_bytes; - - while (fgets(line, sizeof(line), fp)) - { - char* ptr = &line[0]; - // Ignore a. - while (*ptr && *ptr != ',') - ptr++; - // If there was no comma, declare a bad file. - if (*ptr == '\0') { - fclose(fp); - return -2; - } - ptr++; // Past the comma - - if (*ptr && *ptr == '"') - ptr++; // Starting quote of b. - codes_ptr = ptr; // Save this for later. - while (*ptr && *ptr != ',') - ptr++; - // If there was no comma, declare a bad file. - if (*ptr == '\0') { - fclose(fp); - return -2; - } - *ptr = '\0'; // End the codes there - ptr++; // Past the comma - - uint32 i = 0; - description = ptr; // Skip starting " in description - while (*description && *description == '"') - description++; - ptr = description; - while (*ptr && !(*ptr == '\r' || *ptr == '\n' || *ptr == '"') && i < MAX_SFCCHEAT_NAME - 1) { - ptr++; // Remove trailing newline/quote in description - i++; // Clip the cheat name to MAX_SFCCHEAT_NAME chars - } - *ptr = '\0'; - - uint32 c; - // n is the number of cheat codes. Beware of MAX_CHEATS_T. - - // List of cheat codes having the same description. - ptr = codes_ptr; - while (*ptr && !(*ptr == ',' || *ptr == '"')) { - if (Cheat.num_cheats >= MAX_CHEATS_T) { - fclose(fp); - return 0; - } - i = 0; - while (*ptr && !(*ptr == '+' || *ptr == ',' || *ptr == '"') && i < sizeof(code) - 1) - code[i++] = *ptr++; - if (*ptr) - ptr++; // Go past the + , or " - code[i] = '\0'; - if (!S9xGameGenieToRaw (code, &address, &byte)) { - S9xAddCheat (FALSE, FALSE, address, byte); - strncpy (Cheat.c[Cheat.num_cheats - 1].name, description, MAX_SFCCHEAT_NAME); - } - else if (!S9xProActionReplayToRaw (code, &address, &byte)) { - S9xAddCheat (FALSE, FALSE, address, byte); - strncpy (Cheat.c[Cheat.num_cheats - 1].name, description, MAX_SFCCHEAT_NAME); - } - else if (!S9xGoldFingerToRaw (code, &address, &sram, &num_bytes, bytes)) - { - for (c = 0; c < num_bytes; c++) { - S9xAddCheat (FALSE, FALSE, address + c, bytes[c]); - strncpy (Cheat.c[Cheat.num_cheats - 1].name, description, MAX_SFCCHEAT_NAME); - } - } - else { - fclose(fp); - return -3; // Bad cheat format - } - } - } - - fclose(fp); - return 0; -} diff --git a/source/nds/gcheat.h b/source/nds/gcheat.h deleted file mode 100644 index 65d480e..0000000 --- a/source/nds/gcheat.h +++ /dev/null @@ -1,38 +0,0 @@ -/* gcheat.h - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __GCHEAT_H__ -#define __GCHEAT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "cheats.h" - -#define CHEATS_PER_PAGE 6 -#define MAX_CHEATS_PAGE (MAX_CHEATS_T / CHEATS_PER_PAGE) - -extern int NDSSFCLoadCheatFile(const char* filename); - -#ifdef __cplusplus -} -#endif - -#endif //__GCHEAT_H__ diff --git a/source/nds/gui.c b/source/nds/gui.c deleted file mode 100644 index 0d91d79..0000000 --- a/source/nds/gui.c +++ /dev/null @@ -1,4936 +0,0 @@ -/* gui.c - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "snes9x.h" - -#include <stdio.h> -#include <string.h> -#include <sys/stat.h> - -#include "port.h" -#include "ds2_types.h" -#include "ds2_timer.h" -#include "ds2io.h" -#include "ds2_malloc.h" -#include "ds2_cpu.h" -#include "fs_api.h" -#include "key.h" -#include "gui.h" -#include "entry.h" -#include "draw.h" -#include "message.h" -#include "bitmap.h" -#include "gcheat.h" -#include "cheatgrp.h" - -extern struct SCheatData Cheat; - -char main_path[MAX_PATH]; -char rom_path[MAX_PATH]; -char gamepak_name[MAX_PATH]; -char gcheat_filename[MAX_PATH]; - -//program arguments -char argv[2][MAX_PATH]; - -// If adding a language, make sure you update the size of the array in -// message.h too. -char *lang[8] = - { - "English", // 0 - "简体中文", // 1 - "Français", // 2 - "Deutsch", // 3 - "Nederlands", // 4 - "Español", // 5 - "Italiano", // 6 - "Português (Br.)", // 7 - }; - -char *language_options[] = { (char *) &lang[0], (char *) &lang[1], (char *) &lang[2], (char *) &lang[3], (char *) &lang[4], (char *) &lang[5], (char *) &lang[6], (char *) &lang[7] }; - -/****************************************************************************** -* Macro definition - ******************************************************************************/ -#define SUBMENU_ROW_NUM 8 -#define FILE_LIST_ROWS SUBMENU_ROW_NUM - -#define NDSSFC_VERSION "1.36" - -#define SAVE_STATE_SLOT_NUM 16 - -#define LANGUAGE_PACK "SYSTEM/language.msg" -#define EMU_CONFIG_FILENAME "SYSTEM/ndssfc.cfg" - -//emulator configure file's header -#define EMU_CONFIG_HEADER "NSFC1.0" -#define EMU_CONFIG_HEADER_SIZE 7 -EMU_CONFIG emu_config; - -//game configure file's header -#define GAME_CONFIG_HEADER "GSFC1.1" // 1.1 removed cheat names -#define GAME_CONFIG_HEADER_SIZE 7 -GAME_CONFIG game_config; - -//save state file map -static uint32 savestate_index; // current selection in the saved states menu -static int32 latest_save; // Slot number of the latest (in time) save for this game, or -1 if none -static bool8 SavedStateExistenceCached [SAVE_STATE_SLOT_NUM]; // [I] == TRUE if Cache[I] is meaningful -static bool8 SavedStateExistenceCache [SAVE_STATE_SLOT_NUM]; - -// These are U+05C8 and subsequent codepoints encoded in UTF-8. -const uint8 HOTKEY_A_DISPLAY[] = {0xD7, 0x88, 0x00}; -const uint8 HOTKEY_B_DISPLAY[] = {0xD7, 0x89, 0x00}; -const uint8 HOTKEY_X_DISPLAY[] = {0xD7, 0x8A, 0x00}; -const uint8 HOTKEY_Y_DISPLAY[] = {0xD7, 0x8B, 0x00}; -const uint8 HOTKEY_L_DISPLAY[] = {0xD7, 0x8C, 0x00}; -const uint8 HOTKEY_R_DISPLAY[] = {0xD7, 0x8D, 0x00}; -const uint8 HOTKEY_START_DISPLAY[] = {0xD7, 0x8E, 0x00}; -const uint8 HOTKEY_SELECT_DISPLAY[] = {0xD7, 0x8F, 0x00}; -// These are U+2190 and subsequent codepoints encoded in UTF-8. -const uint8 HOTKEY_LEFT_DISPLAY[] = {0xE2, 0x86, 0x90, 0x00}; -const uint8 HOTKEY_UP_DISPLAY[] = {0xE2, 0x86, 0x91, 0x00}; -const uint8 HOTKEY_RIGHT_DISPLAY[] = {0xE2, 0x86, 0x92, 0x00}; -const uint8 HOTKEY_DOWN_DISPLAY[] = {0xE2, 0x86, 0x93, 0x00}; - -#define MAKE_MENU(name, init_function, passive_function, key_function, end_function, \ - focus_option, screen_focus) \ - MENU_TYPE name##_menu = \ - { \ - init_function, \ - passive_function, \ - key_function, \ - end_function, \ - name##_options, \ - sizeof(name##_options) / sizeof(MENU_OPTION_TYPE), \ - focus_option, \ - screen_focus \ - } \ - -#define INIT_MENU(name, init_functions, passive_functions, key, end, focus, screen)\ - { \ - name##_menu.init_function = init_functions, \ - name##_menu.passive_function = passive_functions, \ - name##_menu.key_function = key, \ - name##_menu.end_function = end, \ - name##_menu.options = name##_options, \ - name##_menu.num_options = sizeof(name##_options) / sizeof(MENU_OPTION_TYPE),\ - name##_menu.focus_option = focus, \ - name##_menu.screen_focus = screen; \ - } \ - -#define CHEAT_OPTION(action_function, passive_function, number, line_number) \ -{ \ - action_function, \ - passive_function, \ - NULL, \ - &cheat_data_ptr[number], \ - NULL /* enable_disable_options */, \ - NULL, \ - 2, \ - NULL, \ - line_number, \ - ACTION_TYPE \ -} \ - -#define ACTION_OPTION(action_function, passive_function, display_string, \ - help_string, line_number) \ -{ \ - action_function, \ - passive_function, \ - NULL, \ - display_string, \ - NULL, \ - NULL, \ - 0, \ - help_string, \ - line_number, \ - ACTION_TYPE \ -} \ - -#define SUBMENU_OPTION(sub_menu, display_string, help_string, line_number) \ -{ \ - NULL, \ - NULL, \ - sub_menu, \ - display_string, \ - NULL, \ - NULL, \ - sizeof(sub_menu) / sizeof(MENU_OPTION_TYPE), \ - help_string, \ - line_number, \ - SUBMENU_TYPE \ -} \ - -#define SELECTION_OPTION(passive_function, display_string, options, \ - option_ptr, num_options, help_string, line_number, type) \ -{ \ - NULL, \ - passive_function, \ - NULL, \ - display_string, \ - options, \ - option_ptr, \ - num_options, \ - help_string, \ - line_number, \ - type \ -} \ - -#define ACTION_SELECTION_OPTION(action_function, passive_function, \ - display_string, options, option_ptr, num_options, help_string, line_number, \ - type) \ -{ \ - action_function, \ - passive_function, \ - NULL, \ - display_string, \ - options, \ - option_ptr, \ - num_options, \ - help_string, \ - line_number, \ - type | ACTION_TYPE \ -} \ - -#define STRING_SELECTION_OPTION(action_function, passive_function, \ - display_string, options, option_ptr, num_options, help_string, action, line_number)\ -{ \ - action_function, \ - passive_function, \ - NULL, \ - display_string, \ - options, \ - option_ptr, \ - num_options, \ - help_string, \ - line_number, \ - STRING_SELECTION_TYPE | action \ -} - -#define NUMERIC_SELECTION_OPTION(passive_function, display_string, \ - option_ptr, num_options, help_string, line_number) \ - SELECTION_OPTION(passive_function, display_string, NULL, option_ptr, \ - num_options, help_string, line_number, NUMBER_SELECTION_TYPE) \ - -#define STRING_SELECTION_HIDEN_OPTION(action_function, passive_function, \ - display_string, options, option_ptr, num_options, help_string, line_number) \ - ACTION_SELECTION_OPTION(action_function, passive_function, \ - display_string, options, option_ptr, num_options, help_string, \ - line_number, (STRING_SELECTION_TYPE | HIDEN_TYPE)) \ - -#define NUMERIC_SELECTION_ACTION_OPTION(action_function, passive_function, \ - display_string, option_ptr, num_options, help_string, line_number) \ - ACTION_SELECTION_OPTION(action_function, passive_function, \ - display_string, NULL, option_ptr, num_options, help_string, \ - line_number, NUMBER_SELECTION_TYPE) \ - -#define NUMERIC_SELECTION_HIDE_OPTION(action_function, passive_function, \ - display_string, option_ptr, num_options, help_string, line_number) \ - ACTION_SELECTION_OPTION(action_function, passive_function, \ - display_string, NULL, option_ptr, num_options, help_string, \ - line_number, NUMBER_SELECTION_TYPE) \ - - -typedef enum -{ - NUMBER_SELECTION_TYPE = 0x01, - STRING_SELECTION_TYPE = 0x02, - SUBMENU_TYPE = 0x04, - ACTION_TYPE = 0x08, - HIDEN_TYPE = 0x10, - PASSIVE_TYPE = 0x00, -} MENU_OPTION_TYPE_ENUM; - -struct _MENU_OPTION_TYPE -{ - void (* action_function)(); //Active option to process input - void (* passive_function)(); //Passive function to process this option - struct _MENU_TYPE *sub_menu; //Sub-menu of this option - char **display_string; //Name and other things of this option - void *options; //output value of this option - u32 *current_option; //output values - u32 num_options; //Total output values - char **help_string; //Help string - u32 line_number; //Order id of this option in it menu - MENU_OPTION_TYPE_ENUM option_type; //Option types -}; - -struct _MENU_TYPE -{ - void (* init_function)(); //Function to initialize this menu - void (* passive_function)(); //Function to draw this menu - void (* key_function)(); //Function to process input - void (* end_function)(); //End process of this menu - struct _MENU_OPTION_TYPE *options; //Options array - u32 num_options; //Total options of this menu - u32 focus_option; //Option which obtained focus - u32 screen_focus; //screen positon of the focus option -}; - -typedef struct _MENU_OPTION_TYPE MENU_OPTION_TYPE; -typedef struct _MENU_TYPE MENU_TYPE; - -/****************************************************************************** - ******************************************************************************/ -char g_default_rom_dir[MAX_PATH]; -char DEFAULT_RTS_DIR[MAX_PATH]; -char DEFAULT_CFG_DIR[MAX_PATH]; -char DEFAULT_SS_DIR[MAX_PATH]; -char DEFAULT_CHEAT_DIR[MAX_PATH]; -u32 game_fast_forward= 0; -u32 temporary_fast_forward = 0; -u32 game_enable_audio = 1; - - - - -/****************************************************************************** - ******************************************************************************/ -static u32 menu_cheat_page = 0; -u32 gamepad_config_menu; - -/****************************************************************************** - ******************************************************************************/ -static void get_savestate_filelist(void); -static void get_savestate_filename(u32 slot, char *name_buffer); -static uint8 SavedStateSquareX (u32 slot); -static bool8 SavedStateFileExists (u32 slot); -static void SavedStateCacheInvalidate (void); -void get_newest_savestate(char *name_buffer); -static u32 parse_line(char *current_line, char *current_str); -static void get_timestamp_string(char *buffer, u16 msg_id, u16 year, u16 mon, u16 day, u16 wday, u16 hour, u16 min, u16 sec, u32 msec); -static void get_time_string(char *buff, struct rtc *rtcp); -static u32 save_ss_bmp(u16 *image); -static u32 save_menu_ss_bmp(u16 *image); -static void init_game_config(void); -static void init_emulator_config(void); -static void load_game_config_file(void); -static int load_emu_config_file(void); -static int save_game_config_file(void); -static int save_emu_config_file(void); -static void reorder_latest_file(void); -static void quit(void); - -/*-------------------------------------------------------- - Get GUI input ---------------------------------------------------------*/ -#define BUTTON_REPEAT_START (21428 / 2) -#define BUTTON_REPEAT_CONTINUE (21428 / 20) - -u32 button_repeat_timestamp; - -typedef enum -{ - BUTTON_NOT_HELD, - BUTTON_HELD_INITIAL, - BUTTON_HELD_REPEAT -} button_repeat_state_type; - -button_repeat_state_type button_repeat_state = BUTTON_NOT_HELD; -unsigned int gui_button_repeat = 0; - -gui_action_type key_to_cursor(unsigned int key) -{ - switch (key) - { - case KEY_UP: return CURSOR_UP; - case KEY_DOWN: return CURSOR_DOWN; - case KEY_LEFT: return CURSOR_LEFT; - case KEY_RIGHT: return CURSOR_RIGHT; - case KEY_L: return CURSOR_LTRIGGER; - case KEY_R: return CURSOR_RTRIGGER; - case KEY_A: return CURSOR_SELECT; - case KEY_B: return CURSOR_BACK; - case KEY_X: return CURSOR_EXIT; - case KEY_TOUCH: return CURSOR_TOUCH; - default: return CURSOR_NONE; - } -} - -static unsigned int gui_keys[] = { - KEY_A, KEY_B, KEY_X, KEY_L, KEY_R, KEY_TOUCH, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT -}; - -gui_action_type get_gui_input(void) -{ - gui_action_type ret; - - struct key_buf inputdata; - ds2_getrawInput(&inputdata); - - if (inputdata.key & KEY_LID) - { - ds2_setSupend(); - do { - ds2_getrawInput(&inputdata); - mdelay(1); - } while (inputdata.key & KEY_LID); - ds2_wakeup(); - // In the menu, the lower screen's backlight needs to be on, - // and it is on right away after resuming from suspend. - // mdelay(100); // needed to avoid ds2_setBacklight crashing - // ds2_setBacklight(3); - } - - if ((inputdata.key & (KEY_L | KEY_R)) == (KEY_L | KEY_R)) - { - save_menu_ss_bmp(down_screen_addr); - do { - ds2_getrawInput(&inputdata); - mdelay(1); - } while ((inputdata.key & (KEY_L | KEY_R)) == (KEY_L | KEY_R)); - } - - unsigned int i; - while (1) - { - switch (button_repeat_state) - { - case BUTTON_NOT_HELD: - // Pick the first pressed button out of the gui_keys array. - for (i = 0; i < sizeof(gui_keys) / sizeof(gui_keys[0]); i++) - { - if (inputdata.key & gui_keys[i]) - { - button_repeat_state = BUTTON_HELD_INITIAL; - button_repeat_timestamp = getSysTime(); - gui_button_repeat = gui_keys[i]; - return key_to_cursor(gui_keys[i]); - } - } - return CURSOR_NONE; - case BUTTON_HELD_INITIAL: - case BUTTON_HELD_REPEAT: - // If the key that was being held isn't anymore... - if (!(inputdata.key & gui_button_repeat)) - { - button_repeat_state = BUTTON_NOT_HELD; - // Go see if another key is held (try #2) - break; - } - else - { - unsigned int IsRepeatReady = getSysTime() - button_repeat_timestamp >= (button_repeat_state == BUTTON_HELD_INITIAL ? BUTTON_REPEAT_START : BUTTON_REPEAT_CONTINUE); - if (!IsRepeatReady) - { - // Temporarily turn off the key. - // It's not its turn to be repeated. - inputdata.key &= ~gui_button_repeat; - } - - // Pick the first pressed button out of the gui_keys array. - for (i = 0; i < sizeof(gui_keys) / sizeof(gui_keys[0]); i++) - { - if (inputdata.key & gui_keys[i]) - { - // If it's the held key, - // it's now repeating quickly. - button_repeat_state = gui_keys[i] == gui_button_repeat ? BUTTON_HELD_REPEAT : BUTTON_HELD_INITIAL; - button_repeat_timestamp = getSysTime(); - gui_button_repeat = gui_keys[i]; - return key_to_cursor(gui_keys[i]); - } - } - // If it was time for the repeat but it - // didn't occur, stop repeating. - if (IsRepeatReady) button_repeat_state = BUTTON_NOT_HELD; - return CURSOR_NONE; - } - } - } -} - -/*-------------------------------------------------------- - Wait any key in [key_list] pressed - if key_list == NULL, return at any key pressed ---------------------------------------------------------*/ -unsigned int wait_Anykey_press(unsigned int key_list) -{ - unsigned int key; - - while(1) - { - key = getKey(); - if(key) { - if(0 == key_list) break; - else if(key & key_list) break; - } - } - - return key; -} - -/*-------------------------------------------------------- - Wait all key in [key_list] released - if key_list == NULL, return at all key released ---------------------------------------------------------*/ -void wait_Allkey_release(unsigned int key_list) -{ - unsigned int key; - struct key_buf inputdata; - - while(1) - { - ds2_getrawInput(&inputdata); - key = inputdata.key; - - if(0 == key) break; - else if(!key_list) continue; - else if(0 == (key_list & key)) break; - } -} - -void change_ext(char *src, char *buffer, char *extension) -{ - char *dot_position; - - strcpy(buffer, src); - dot_position = strrchr(buffer, '.'); - - if(dot_position) - strcpy(dot_position, extension); -} - -/*-------------------------------------------------------- - Sort function ---------------------------------------------------------*/ -static int nameSortFunction(char* a, char* b) -{ - // ".." sorts before everything except itself. - bool aIsParent = strcmp(a, "..") == 0; - bool bIsParent = strcmp(b, "..") == 0; - - if (aIsParent && bIsParent) - return 0; - else if (aIsParent) // Sorts before - return -1; - else if (bIsParent) // Sorts after - return 1; - else - return strcasecmp(a, b); -} - -/* - * Determines whether a portion of a vector is sorted. - * Input assertions: 'from' and 'to' are valid indices into data. 'to' can be - * the maximum value for the type 'unsigned int'. - * Input: 'data', data vector, possibly sorted. - * 'sortFunction', function determining the sort order of two elements. - * 'from', index of the first element in the range to test. - * 'to', index of the last element in the range to test. - * Output: true if, for any valid index 'i' such as from <= i < to, - * data[i] < data[i + 1]. - * true if the range is one or no elements, or if from > to. - * false otherwise. - */ -static bool isSorted(char** data, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to) -{ - if (from >= to) - return true; - - char** prev = &data[from]; - unsigned int i; - for (i = from + 1; i < to; i++) - { - if ((*sortFunction)(*prev, data[i]) > 0) - return false; - prev = &data[i]; - } - if ((*sortFunction)(*prev, data[to]) > 0) - return false; - - return true; -} - -/* - * Chooses a pivot for Quicksort. Uses the median-of-three search algorithm - * first proposed by Robert Sedgewick. - * Input assertions: 'from' and 'to' are valid indices into data. 'to' can be - * the maximum value for the type 'unsigned int'. - * Input: 'data', data vector. - * 'sortFunction', function determining the sort order of two elements. - * 'from', index of the first element in the range to be sorted. - * 'to', index of the last element in the range to be sorted. - * Output: a valid index into data, between 'from' and 'to' inclusive. - */ -static unsigned int choosePivot(char** data, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to) -{ - // The highest of the two extremities is calculated first. - unsigned int highest = ((*sortFunction)(data[from], data[to]) > 0) - ? from - : to; - // Then the lowest of that highest extremity and the middle - // becomes the pivot. - return ((*sortFunction)(data[from + (to - from) / 2], data[highest]) < 0) - ? (from + (to - from) / 2) - : highest; -} - -/* - * Partition function for Quicksort. Moves elements such that those that are - * less than the pivot end up before it in the data vector. - * Input assertions: 'from', 'to' and 'pivotIndex' are valid indices into data. - * 'to' can be the maximum value for the type 'unsigned int'. - * Input: 'data', data vector. - * 'metadata', data describing the values in 'data'. - * 'sortFunction', function determining the sort order of two elements. - * 'from', index of the first element in the range to sort. - * 'to', index of the last element in the range to sort. - * 'pivotIndex', index of the value chosen as the pivot. - * Output: the index of the value chosen as the pivot after it has been moved - * after all the values that are less than it. - */ -static unsigned int partition(char** data, u8* metadata, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to, unsigned int pivotIndex) -{ - char* pivotValue = data[pivotIndex]; - data[pivotIndex] = data[to]; - data[to] = pivotValue; - { - u8 tM = metadata[pivotIndex]; - metadata[pivotIndex] = metadata[to]; - metadata[to] = tM; - } - - unsigned int storeIndex = from; - unsigned int i; - for (i = from; i < to; i++) - { - if ((*sortFunction)(data[i], pivotValue) < 0) - { - char* tD = data[storeIndex]; - data[storeIndex] = data[i]; - data[i] = tD; - u8 tM = metadata[storeIndex]; - metadata[storeIndex] = metadata[i]; - metadata[i] = tM; - ++storeIndex; - } - } - - { - char* tD = data[to]; - data[to] = data[storeIndex]; - data[storeIndex] = tD; - u8 tM = metadata[to]; - metadata[to] = metadata[storeIndex]; - metadata[storeIndex] = tM; - } - return storeIndex; -} - -/* - * Sorts an array while keeping metadata in sync. - * This sort is unstable and its average performance is - * O(data.size() * log2(data.size()). - * Input assertions: for any valid index 'i' in data, index 'i' is valid in - * metadata. 'from' and 'to' are valid indices into data. 'to' can be - * the maximum value for the type 'unsigned int'. - * Invariant: index 'i' in metadata describes index 'i' in data. - * Input: 'data', data to sort. - * 'metadata', data describing the values in 'data'. - * 'sortFunction', function determining the sort order of two elements. - * 'from', index of the first element in the range to sort. - * 'to', index of the last element in the range to sort. - */ -static void quickSort(char** data, u8* metadata, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to) -{ - if (isSorted(data, sortFunction, from, to)) - return; - - unsigned int pivotIndex = choosePivot(data, sortFunction, from, to); - unsigned int newPivotIndex = partition(data, metadata, sortFunction, from, to, pivotIndex); - if (newPivotIndex > 0) - quickSort(data, metadata, sortFunction, from, newPivotIndex - 1); - if (newPivotIndex < to) - quickSort(data, metadata, sortFunction, newPivotIndex + 1, to); -} - -static void strupr(char *str) -{ - while(*str) - { - if(*str <= 0x7A && *str >= 0x61) *str -= 0x20; - str++; - } -} - -// ****************************************************************************** -// get file list -// ****************************************************************************** - -s32 load_file(char **wildcards, char *result, char *default_dir_name) -{ - if (default_dir_name == NULL || *default_dir_name == '\0') - return -4; - - char CurrentDirectory[MAX_PATH]; - u32 ContinueDirectoryRead = 1; - u32 ReturnValue; - u32 i; - - strcpy(CurrentDirectory, default_dir_name); - - while (ContinueDirectoryRead) - { - // Read the current directory. This loop is continued every time the - // current directory changes. - HighFrequencyCPU(); - - show_icon(down_screen_addr, &ICON_SUBBG, 0, 0); - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - PRINT_STRING_BG(down_screen_addr, msg[MSG_FILE_MENU_LOADING_LIST], COLOR_WHITE, COLOR_TRANS, 49, 10); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - u32 LastCountDisplayTime = getSysTime(); - - char** EntryNames = NULL; - u8* EntryDirectoryFlags = NULL; - DIR* CurrentDirHandle = NULL; - u32 EntryCount = 1, EntryCapacity = 4 /* initial */; - - EntryNames = (char**) malloc(EntryCapacity * sizeof(char*)); - if (EntryNames == NULL) - { - ReturnValue = -2; - ContinueDirectoryRead = 0; - goto cleanup; - } - - EntryDirectoryFlags = (u8*) malloc(EntryCapacity * sizeof(u8)); - if (EntryDirectoryFlags == NULL) - { - ReturnValue = -2; - ContinueDirectoryRead = 0; - goto cleanup; - } - - CurrentDirHandle = opendir(CurrentDirectory); - if(CurrentDirHandle == NULL) { - ReturnValue = -1; - ContinueDirectoryRead = 0; - goto cleanup; - } - - EntryNames[0] = ".."; - EntryDirectoryFlags[0] = 1; - - dirent* CurrentEntryHandle; - struct stat Stat; - - while((CurrentEntryHandle = readdir_ex(CurrentDirHandle, &Stat)) != NULL) - { - u32 Now = getSysTime(); - u32 AddEntry = 0; - char* Name = CurrentEntryHandle->d_name; - - if (Now >= LastCountDisplayTime + 5859 /* 250 ms */) - { - LastCountDisplayTime = Now; - - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - char Line[384], Element[128]; - strcpy(Line, msg[MSG_FILE_MENU_LOADING_LIST]); - sprintf(Element, " (%u)", EntryCount); - strcat(Line, Element); - PRINT_STRING_BG(down_screen_addr, Line, COLOR_WHITE, COLOR_TRANS, 49, 10); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - } - - if(S_ISDIR(Stat.st_mode)) - { - // Add directories no matter what, except for the special - // ones, "." and "..". - if (!(Name[0] == '.' && - (Name[1] == '\0' || (Name[1] == '.' && Name[2] == '\0')) - )) - { - AddEntry = 1; - } - } - else - { - if (wildcards[0] == NULL) // Show every file - AddEntry = 1; - else - { - // Add files only if their extension is in the list. - char* Extension = strrchr(Name, '.'); - if (Extension != NULL) - { - for(i = 0; wildcards[i] != NULL; i++) - { - if(strcasecmp(Extension, wildcards[i]) == 0) - { - AddEntry = 1; - break; - } - } - } - } - } - - if (AddEntry) - { - // Ensure we have enough capacity in the char* array first. - if (EntryCount == EntryCapacity) - { - void* NewEntryNames = realloc(EntryNames, EntryCapacity * 2 * sizeof(char*)); - if (NewEntryNames == NULL) - { - ReturnValue = -2; - ContinueDirectoryRead = 0; - goto cleanup; - } - else - EntryNames = NewEntryNames; - - void* NewEntryDirectoryFlags = realloc(EntryDirectoryFlags, EntryCapacity * 2 * sizeof(char*)); - if (NewEntryDirectoryFlags == NULL) - { - ReturnValue = -2; - ContinueDirectoryRead = 0; - goto cleanup; - } - else - EntryDirectoryFlags = NewEntryDirectoryFlags; - - EntryCapacity *= 2; - } - - // Then add the entry. - EntryNames[EntryCount] = malloc(strlen(Name) + 1); - if (EntryNames[EntryCount] == NULL) - { - ReturnValue = -2; - ContinueDirectoryRead = 0; - goto cleanup; - } - - strcpy(EntryNames[EntryCount], Name); - if (S_ISDIR(Stat.st_mode)) - EntryDirectoryFlags[EntryCount] = 1; - else - EntryDirectoryFlags[EntryCount] = 0; - - EntryCount++; - } - } - - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - PRINT_STRING_BG(down_screen_addr, msg[MSG_FILE_MENU_SORTING_LIST], COLOR_WHITE, COLOR_TRANS, 49, 10); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - quickSort(EntryNames, EntryDirectoryFlags, nameSortFunction, 1, EntryCount - 1); - LowFrequencyCPU(); - - u32 ContinueInput = 1; - s32 SelectedIndex = 0; - u32 DirectoryScrollDirection = 0x8000; // First scroll to the left - s32 EntryScrollValue = 0; - u32 ModifyScrollers = 1; - u32 ScrollerCount = 0; - - draw_hscroll_init(down_screen_addr, 49, 10, 199, COLOR_TRANS, - COLOR_WHITE, CurrentDirectory); - ScrollerCount++; - - // Show the current directory and get input. This loop is continued - // every frame, because the current directory scrolls atop the screen. - - while (ContinueDirectoryRead && ContinueInput) - { - // Try to use a row set such that the selected entry is in the - // middle of the screen. - s32 LastEntry = SelectedIndex + FILE_LIST_ROWS / 2; - - // If the last row is out of bounds, put it back in bounds. - // (In this case, the user has selected an entry in the last - // FILE_LIST_ROWS / 2.) - if (LastEntry >= EntryCount) - LastEntry = EntryCount - 1; - - s32 FirstEntry = LastEntry - (FILE_LIST_ROWS - 1); - - // If the first row is out of bounds, put it back in bounds. - // (In this case, the user has selected an entry in the first - // FILE_LIST_ROWS / 2, or there are fewer than FILE_LIST_ROWS - // entries.) - if (FirstEntry < 0) - { - FirstEntry = 0; - - // If there are more than FILE_LIST_ROWS / 2 files, - // we need to enlarge the first page. - LastEntry = FILE_LIST_ROWS - 1; - if (LastEntry >= EntryCount) // No... - LastEntry = EntryCount - 1; - } - - // Update scrollers. - // a) If a different item has been selected, remake entry - // scrollers, resetting the formerly selected entry to the - // start and updating the selection color. - if (ModifyScrollers) - { - // Preserve the directory scroller. - for (; ScrollerCount > 1; ScrollerCount--) - draw_hscroll_over(ScrollerCount - 1); - for (i = FirstEntry; i <= LastEntry; i++) - { - u16 color = (SelectedIndex == i) - ? COLOR_ACTIVE_ITEM - : COLOR_INACTIVE_ITEM; - if (hscroll_init(down_screen_addr, FILE_SELECTOR_NAME_X, GUI_ROW1_Y + (i - FirstEntry) * GUI_ROW_SY + TEXT_OFFSET_Y, FILE_SELECTOR_NAME_SX, - COLOR_TRANS, color, EntryNames[i]) < 0) - { - ReturnValue = -2; - ContinueDirectoryRead = 0; - goto cleanupScrollers; - } - else - { - ScrollerCount++; - } - } - - ModifyScrollers = 0; - } - - // b) Must we update the directory scroller? - if ((DirectoryScrollDirection & 0xFF) >= 0x20) - { - if(DirectoryScrollDirection & 0x8000) //scroll left - { - if(draw_hscroll(0, -1) == 0) DirectoryScrollDirection = 0; //scroll right - } - else - { - if(draw_hscroll(0, 1) == 0) DirectoryScrollDirection = 0x8000; //scroll left - } - } - else - { - // Wait one less frame before scrolling the directory again. - DirectoryScrollDirection++; - } - - // c) Must we scroll the current file as a result of user input? - if (EntryScrollValue != 0) - { - draw_hscroll(SelectedIndex - FirstEntry + 1, EntryScrollValue); - EntryScrollValue = 0; - } - - // Draw. - // a) The background. - show_icon(down_screen_addr, &ICON_SUBBG, 0, 0); - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - - // b) The selection background. - show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + (SelectedIndex - FirstEntry) * GUI_ROW_SY + SUBSELA_OFFSET_Y); - - // c) The scrollers. - for (i = 0; i < ScrollerCount; i++) - draw_hscroll(i, 0); - - // d) The icons. - for (i = FirstEntry; i <= LastEntry; i++) - { - struct gui_iconlist* icon; - if (i == 0) - icon = &ICON_DOTDIR; - else if (EntryDirectoryFlags[i]) - icon = &ICON_DIRECTORY; - else - { - char* Extension = strrchr(EntryNames[i], '.'); - if (Extension != NULL) - { - if (strcasecmp(Extension, ".smc") == 0 || strcasecmp(Extension, ".sfc") == 0) - icon = &ICON_SFCFILE; - else if (strcasecmp(Extension, ".zip") == 0) - icon = &ICON_ZIPFILE; - else if (strcasecmp(Extension, ".cht") == 0) - icon = &ICON_CHTFILE; - else - icon = &ICON_UNKNOW; - } - else - icon = &ICON_UNKNOW; - } - - show_icon(down_screen_addr, icon, FILE_SELECTOR_ICON_X, GUI_ROW1_Y + (i - FirstEntry) * GUI_ROW_SY + FILE_SELECTOR_ICON_Y); - } - - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - // Delay before getting the input. - mdelay(20); - - struct key_buf inputdata; - gui_action_type gui_action = get_gui_input(); - ds2_getrawInput(&inputdata); - - // Get KEY_RIGHT and KEY_LEFT separately to allow scrolling - // the selected file name faster. - if (inputdata.key & KEY_RIGHT) - EntryScrollValue = -3; - else if (inputdata.key & KEY_LEFT) - EntryScrollValue = 3; - - switch(gui_action) - { - case CURSOR_TOUCH: - { - wait_Allkey_release(0); - // ___ 33 This screen has 6 possible rows. Touches - // ___ 60 above or below these are ignored. - // . . . (+27) - // ___ 192 - if(inputdata.y <= GUI_ROW1_Y || inputdata.y > NDS_SCREEN_HEIGHT) - break; - - u32 mod = (inputdata.y - GUI_ROW1_Y) / GUI_ROW_SY; - - if(mod >= LastEntry - FirstEntry + 1) - break; - - SelectedIndex = FirstEntry + mod; - /* fall through */ - } - - case CURSOR_SELECT: - wait_Allkey_release(0); - if (SelectedIndex == 0) // The parent directory - { - char* SlashPos = strrchr(CurrentDirectory, '/'); - if (SlashPos != NULL) // There's a parent - { - *SlashPos = '\0'; - ContinueInput = 0; - } - else // We're at the root - { - ReturnValue = -1; - ContinueDirectoryRead = 0; - } - } - else if (EntryDirectoryFlags[SelectedIndex]) - { - strcat(CurrentDirectory, "/"); - strcat(CurrentDirectory, EntryNames[SelectedIndex]); - ContinueInput = 0; - } - else - { - strcpy(default_dir_name, CurrentDirectory); - strcpy(result, EntryNames[SelectedIndex]); - ReturnValue = 0; - ContinueDirectoryRead = 0; - } - break; - - case CURSOR_UP: - SelectedIndex--; - if (SelectedIndex < 0) - SelectedIndex++; - else - ModifyScrollers = 1; - break; - - case CURSOR_DOWN: - SelectedIndex++; - if (SelectedIndex >= EntryCount) - SelectedIndex--; - else - ModifyScrollers = 1; - break; - - //scroll page down - case CURSOR_RTRIGGER: - { - u32 OldIndex = SelectedIndex; - SelectedIndex += FILE_LIST_ROWS; - if (SelectedIndex >= EntryCount) - SelectedIndex = EntryCount - 1; - if (SelectedIndex != OldIndex) - ModifyScrollers = 1; - break; - } - - //scroll page up - case CURSOR_LTRIGGER: - { - u32 OldIndex = SelectedIndex; - SelectedIndex -= FILE_LIST_ROWS; - if (SelectedIndex < 0) - SelectedIndex = 0; - if (SelectedIndex != OldIndex) - ModifyScrollers = 1; - break; - } - - case CURSOR_BACK: - { - wait_Allkey_release(0); - char* SlashPos = strrchr(CurrentDirectory, '/'); - if (SlashPos != NULL) // There's a parent - { - *SlashPos = '\0'; - ContinueInput = 0; - } - else // We're at the root - { - ReturnValue = -1; - ContinueDirectoryRead = 0; - } - break; - } - - case CURSOR_EXIT: - wait_Allkey_release(0); - ReturnValue = -1; - ContinueDirectoryRead = 0; - break; - - default: - break; - } // end switch - } // end while - -cleanupScrollers: - for (; ScrollerCount > 0; ScrollerCount--) - draw_hscroll_over(ScrollerCount - 1); - -cleanup: - if (CurrentDirHandle != NULL) - closedir(CurrentDirHandle); - - if (EntryDirectoryFlags != NULL) - free(EntryDirectoryFlags); - if (EntryNames != NULL) - { - // EntryNames[0] is "..", a literal. Don't free it. - for (; EntryCount > 1; EntryCount--) - free(EntryNames[EntryCount - 1]); - free(EntryNames); - } - } // end while - - return ReturnValue; -} - -/*-------------------------------------------------------- - 放映幻灯片 ---------------------------------------------------------*/ - -u32 play_screen_snapshot(void) -{ - s32 flag; - u32 repeat, i; - u16 *screenp; - u32 color_bg; - - char** EntryNames = NULL; - DIR* CurrentDirHandle = NULL; - u32 EntryCount = 0, EntryCapacity = 4 /* initial */; - u32 Failed = 0; - - EntryNames = (char**) malloc(EntryCapacity * sizeof(char*)); - if (EntryNames == NULL) - { - Failed = 1; - goto cleanup; - } - - CurrentDirHandle = opendir(DEFAULT_SS_DIR); - if(CurrentDirHandle == NULL) { - Failed = 1; - goto cleanup; - } - - dirent* CurrentEntryHandle; - struct stat Stat; - - while((CurrentEntryHandle = readdir_ex(CurrentDirHandle, &Stat)) != NULL) - { - char* Name = CurrentEntryHandle->d_name; - if(!S_ISDIR(Stat.st_mode)) - { - // Add files only if their extension is in the list. - char* Extension = strrchr(Name, '.'); - if (Extension != NULL) - { - if(strcasecmp(Extension, ".bmp") == 0) - { - // Ensure we have enough capacity in the char* array first. - if (EntryCount == EntryCapacity) - { - void* NewEntryNames = realloc(EntryNames, EntryCapacity * 2 * sizeof(char*)); - if (NewEntryNames == NULL) - { - Failed = 1; - goto cleanup; - } - else - EntryNames = NewEntryNames; - - EntryCapacity *= 2; - } - - // Then add the entry. - EntryNames[EntryCount] = malloc(strlen(Name) + 1); - if (EntryNames[EntryCount] == NULL) - { - Failed = 1; - goto cleanup; - } - - strcpy(EntryNames[EntryCount], Name); - - EntryCount++; - } - } - } - } - -cleanup: - if (CurrentDirHandle != NULL) - closedir(CurrentDirHandle); - - screenp= (u16*)malloc(256*192*2); - if(screenp == NULL) - { - screenp = (u16*)down_screen_addr; - color_bg = COLOR_BG; - } - else - { - memcpy(screenp, down_screen_addr, 256*192*2); - color_bg = COLOR16(43, 11, 11); - } - - if(Failed || EntryCount == 0) - { - draw_message(down_screen_addr, screenp, 28, 31, 227, 165, color_bg); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_NO_SLIDE]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - if(screenp) free((void*)screenp); - - if (EntryNames != NULL) - { - for (; EntryCount > 0; EntryCount--) - free(EntryNames[EntryCount - 1]); - free(EntryNames); - } - - wait_Anykey_press(0); - wait_Allkey_release(0); - - return 0; - } - - char bmp_path[MAX_PATH]; - BMPINFO SbmpInfo; - - u32 buff[256*192]; - u32 time0= 10; - u32 pause= 0; - unsigned int type; - - draw_message(down_screen_addr, screenp, 28, 31, 227, 165, color_bg); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_SCREENSHOT_SLIDESHOW_KEYS]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - repeat= 1; - i= 0; - while(repeat) - { - sprintf(bmp_path, "%s/%s", DEFAULT_SS_DIR, EntryNames[i]); - - flag = openBMP(&SbmpInfo, (const char*)bmp_path); - if(flag == BMP_OK) - { - type = SbmpInfo.bmpHead.bfImghead.imBitpixel >>3; - if(2 == type || 3 == type) //2 bytes per pixel - { - u16 *dst, *dst0; - u32 w, h, x, y; - - w= SbmpInfo.bmpHead.bfImghead.imBitmapW; - h= SbmpInfo.bmpHead.bfImghead.imBitmapH; - if(w > 256) w = 256; - if(h > 192) h = 192; - - flag = readBMP(&SbmpInfo, 0, 0, w, h, (void*)buff); - if(0 == flag) - { - ds2_clearScreen(UP_SCREEN, 0); - - dst= (unsigned short*)up_screen_addr + (192-h)/2*256 +(256-w)/2; - dst0 = dst; - if(2 == type) { - unsigned short* pt; - - pt = (unsigned short*) buff; - for(y= 0; y<h; y++) { - for(x= 0; x < w; x++) { - *dst++ = RGB16_15(pt); - pt += 1; - } - dst0 += 256; - dst = dst0; - } - } - else { - unsigned char* pt; - - pt= (char*)buff; - for(y= 0; y< h; y++) { - for(x= 0; x < w; x++) { - *dst++ = RGB24_15(pt); - pt += 3; - } - dst0 += 256; - dst = dst0; - } - } - - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - - closeBMP(&SbmpInfo); - } - else - closeBMP(&SbmpInfo); - } - - if(i+1 < EntryCount) i++; - else i= 0; - - gui_action_type gui_action; - u32 ticks= 0; - u32 time1; - - time1= time0; - while(ticks < time1) - { - gui_action = get_gui_input(); - - switch(gui_action) - { - case CURSOR_UP: - if(!pause) - { - if(time0 > 1) time0 -= 1; - time1= time0; - } - break; - - case CURSOR_DOWN: - if(!pause) - { - time0 += 1; - time1= time0; - } - break; - - case CURSOR_LEFT: - time1 = ticks; - if(i > 1) i -= 2; - else if(i == 1) i= EntryCount -1; - else i= EntryCount -2; - break; - - case CURSOR_RIGHT: - time1 = ticks; - break; - - case CURSOR_SELECT: - if(!pause) - { - time1 = -1; - pause= 1; - } - else - { - time1 = ticks; - pause= 0; - } - break; - - case CURSOR_BACK: - repeat = 0; - break; - - default: gui_action= CURSOR_NONE; - break; - } - - if(gui_action != CURSOR_BACK) - mdelay(100); - if(!pause) - ticks ++; - } - } - - if(screenp) free((void*)screenp); - - if (EntryNames != NULL) - { - for (; EntryCount > 0; EntryCount--) - free(EntryNames[EntryCount - 1]); - free(EntryNames); - } - - return 0; -} - - -/* -* Function: search directory on directory_path -* directory: directory name will be searched -* directory_path: path, note that the buffer which hold directory_path should -* be large enough for nested -* return: 0= found, directory lay on directory_path -*/ -int search_dir(char *directory, char* directory_path) -{ - DIR *current_dir; - dirent *current_file; - struct stat st; - int directory_path_len; - - current_dir= opendir(directory_path); - if(current_dir == NULL) - return -1; - - directory_path_len = strlen(directory_path); - - //while((current_file = readdir(current_dir)) != NULL) - while((current_file = readdir_ex(current_dir, &st)) != NULL) - { - //Is directory - if(S_ISDIR(st.st_mode)) - { - if(strcmp(".", current_file->d_name) || strcmp("..", current_file->d_name)) - continue; - - strcpy(directory_path+directory_path_len, current_file->d_name); - - if(!strcasecmp(current_file->d_name, directory)) - {//dirctory find - closedir(current_dir); - return 0; - } - - if(search_dir(directory, directory_path) == 0) - {//dirctory find - closedir(current_dir); - return 0; - } - - directory_path[directory_path_len] = '\0'; - } - } - - closedir(current_dir); - return -1; -} - - -const u32 gamepad_config_map_init[MAX_GAMEPAD_MAP] = -{ - BUTTON_ID_A, /* 0 A */ - BUTTON_ID_B, /* 1 B */ - BUTTON_ID_SELECT, /* 2 [SELECT] */ - BUTTON_ID_START, /* 3 [START] */ - BUTTON_ID_RIGHT, /* 4 → */ - BUTTON_ID_LEFT, /* 5 ← */ - BUTTON_ID_UP, /* 6 ↑ */ - BUTTON_ID_DOWN, /* 7 ↓ */ - BUTTON_ID_R, /* 8 [R] */ - BUTTON_ID_L, /* 9 [L] */ - BUTTON_ID_NONE, /* 10 FA */ - BUTTON_ID_NONE, /* 11 FB */ - BUTTON_ID_TOUCH, /* 12 MENU */ - BUTTON_ID_NONE, /* 13 NONE */ - BUTTON_ID_NONE, /* 14 NONE */ - BUTTON_ID_NONE /* 15 NONE */ -}; - -u32 gamepad_config_map[MAX_GAMEPAD_MAP]; - -#define BUTTON_MAP_A gamepad_config_map[0] -#define BUTTON_MAP_B gamepad_config_map[1] -#define BUTTON_MAP_FA gamepad_config_map[10] -#define BUTTON_MAP_FB gamepad_config_map[11] -#define BUTTON_MAP_MENU gamepad_config_map[12] - -int load_state(char* file) -{ - int flag; - FILE* fp; - unsigned int n; - char tmp_path[MAX_PATH]; - - sprintf(tmp_path, "%s/%s", DEFAULT_RTS_DIR, file); - - flag = game_load_state(tmp_path); - if(0 != flag) - return -1; - - fp = fopen(tmp_path, "r"); - if(NULL == fp) - return -1; - - n = 0; - if(fread((void*)&n, 1, 4, fp) < 4) - { - fclose(fp); - return -1; - } - - fseek(fp, n+sizeof(struct rtc), SEEK_SET); - fread(up_screen_addr, 1, 256*192*2, fp); - fclose(fp); - - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - - return 0; -} - -int load_game_stat_snapshot(char* file) -{ - FILE* fp; - char tmp_path[MAX_PATH]; - unsigned int n, m; - - sprintf(tmp_path, "%s/%s", DEFAULT_RTS_DIR, file); - fp = fopen(tmp_path, "r"); - if(NULL == fp) - return -1; - - m = fread((void*)&n, 1, 4, fp); - if(m < 4) - { - fclose(fp); - return - 2; - } - - fseek(fp, n+sizeof(struct rtc), SEEK_SET); - - m = fread(up_screen_addr, 1, 256*192*2, fp); - if(m < 256*192*2) - { - fclose(fp); - return -4; - } - - fclose(fp); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - return 0; -} - -#if 0 -int bak_file(char* file) -{ - FILE *fp1, *fp2; - char tmp_path[MAX_PATH]; - char buff[512]; - int m; - - fp1= fopen(file, "r"); - if(NULL == fp1) - return -1; - - strcpy(tmp_path, file); - strcat(tmp_path, ".bak"); - fp2 = fopen(tmp_path, "w"); - if(NULL == fp2) - { - fclose(fp1); - return -2; - } - - while(1) - { - m= fread(buff, 1, 512, fp1); - if(m <= 0) break; - fwrite(buff, 1, m, fp2); - } - - fclose(fp1); - fclose(fp2); - return 0; -} -#endif - -int save_state(char* file, void* screen) -{ - int flag; - FILE *fp; - unsigned int n; - struct rtc time; - char str[64]; - char tmp_path[MAX_PATH]; - - sprintf(tmp_path, "%s/%s", DEFAULT_RTS_DIR, file); - - flag = game_save_state(tmp_path); - if(0 != flag) - return -1; - - fp = fopen(tmp_path, "r+"); - if(NULL == fp) - return -1; - - fseek(fp, 0, SEEK_END); - n = ftell(fp); - - ds2_getTime(&time); - sprintf(str, "%04d-%02d-%02d %02d:%02d:%02d", - time.year + 2000, time.month, time.day, time.hours, time.minutes, time.seconds); - - // A black outline in all four directions... - PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 0, 1); - PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 2, 1); - PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 1, 0); - PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 1, 2); - // ... and white text. - PRINT_STRING_BG(screen, str, COLOR_WHITE, 0x8000, 1, 1); - fwrite((void*)&time, 1, sizeof(struct rtc), fp); - fwrite(screen, 1, 256*192*2, fp); - - fseek(fp, 0, SEEK_SET); - fwrite((void*)&n, 1, 4, fp); - - fclose(fp); - - return 0; -} - -void LowFrequencyCPU() -{ - ds2_setCPUclocklevel(0); // 60 MHz -} - -void HighFrequencyCPU() -{ - ds2_setCPUclocklevel(13); // 396 MHz -} - -void GameFrequencyCPU() -{ - u32 clock_speed_table[6] = {6, 9, 10, 11, 12, 13}; //240, 300, 336, 360, 384, 396 - - if(game_config.clock_speed_number <= 5) - ds2_setCPUclocklevel(clock_speed_table[game_config.clock_speed_number]); -} - -void savefast_int(void) -{ - -} - -#if 1 -void dump_mem(unsigned char* addr, unsigned int len) -{ - unsigned int i; - - for(i= 0; i < len; i++) - { - cprintf("%02x ", addr[i]); - if((i+1)%16 == 0) cprintf("\n"); - } -} -#endif - -/*-------------------------------------------------------- - Main Menu ---------------------------------------------------------*/ -u32 menu(u16 *screen, bool8 FirstInvocation) -{ - gui_action_type gui_action; - u32 i; - u32 repeat; - u32 return_value = 0; - u32 first_load = 0; - char tmp_filename[MAX_FILE]; - char line_buffer[512]; - char cheat_data_str[MAX_CHEATS_T][5]; - // ^ Holds the index inside Cheat, as a number in an ASCIIZ string - char* cheat_data_ptr[MAX_CHEATS_T]; - - // For cheat groups - char* cheat_group_name_ptr[MAX_CHEATS_T + 1]; - char cheat_group_names[MAX_CHEATS_T * MAX_SFCCHEAT_NAME]; - - MENU_TYPE *current_menu = NULL; - MENU_OPTION_TYPE *current_option = NULL; - MENU_OPTION_TYPE *display_option = NULL; - - u32 current_option_num; -// u32 parent_option_num; - u32 string_select; - - u16 *bg_screenp; - u32 bg_screenp_color; - - GAME_CONFIG PreviousGameConfig; // Compared with current settings to - EMU_CONFIG PreviousEmuConfig; // determine if they need to be saved - - auto void choose_menu(); - auto void menu_return(); - auto void menu_exit(); - auto void menu_load(); - auto void menu_restart(); - auto void menu_save_state(); - auto void menu_load_state(); - auto void menu_load_cheat_file(); - auto void others_menu_init(); - auto void main_menu_passive(); - auto void main_menu_key(); - auto void delette_savestate(); - auto void save_screen_snapshot(); - auto void browse_screen_snapshot(); - auto void tools_menu_init(); - auto void obtain_hotkey (u32 *HotkeyBitfield); - auto void set_global_hotkey_return_to_menu(); - auto void set_global_hotkey_temporary_fast_forward(); - auto void set_global_hotkey_toggle_sound(); - auto void set_global_hotkey_quick_load_state(); - auto void set_global_hotkey_quick_save_state(); - auto void set_global_hotkey_toggle_full_screen(); - auto void set_game_specific_hotkey_return_to_menu(); - auto void set_game_specific_hotkey_temporary_fast_forward(); - auto void set_game_specific_hotkey_toggle_sound(); - auto void set_game_specific_hotkey_quick_load_state(); - auto void set_game_specific_hotkey_quick_save_state(); - auto void set_game_specific_hotkey_toggle_full_screen(); - auto void global_hotkey_return_to_menu_passive(); - auto void global_hotkey_temporary_fast_forward_passive(); - auto void global_hotkey_toggle_sound_passive(); - auto void global_hotkey_quick_load_state_passive(); - auto void global_hotkey_quick_save_state_passive(); - auto void global_hotkey_toggle_full_screen_passive(); - auto void game_specific_hotkey_return_to_menu_passive(); - auto void game_specific_hotkey_temporary_fast_forward_passive(); - auto void game_specific_hotkey_toggle_sound_passive(); - auto void game_specific_hotkey_quick_load_state_passive(); - auto void game_specific_hotkey_quick_save_state_passive(); - auto void game_specific_hotkey_toggle_full_screen_passive(); - auto void load_default_setting(); - auto void check_gbaemu_version(); - auto void load_lastest_played(); - auto void latest_game_menu_passive(); - auto void latest_game_menu_init(); - auto void latest_game_menu_key(); - auto void latest_game_menu_end(); - auto void language_set(); - auto void game_fastforward(); -#ifdef ENABLE_FREE_SPACE - auto void show_card_space(); -#endif - auto void savestate_selitem(u32 sel, u32 y_pos); - auto void game_state_menu_init(); - auto void game_state_menu_passive(); - auto void game_state_menu_end(); - auto void gamestate_delette_menu_init(); - auto void gamestate_delette_menu_passive(); - auto void gamestate_delette_menu_end(); - auto void cheat_menu_init(); - auto void cheat_menu_end(); - auto void reload_cheats_page(); - auto void cheat_option_action(); - auto void cheat_option_passive(); - -//Local function definition - - void menu_exit() - { - HighFrequencyCPU(); // Crank it up, leave quickly - if(gamepak_name[0] != 0) - { - S9xAutoSaveSRAM (); - } - quit(); - } - - void SaveConfigsIfNeeded() - { - if (memcmp(&PreviousGameConfig, &game_config, sizeof(GAME_CONFIG)) != 0) - save_game_config_file(); - if (memcmp(&PreviousEmuConfig, &emu_config, sizeof(EMU_CONFIG)) != 0) - save_emu_config_file(); - } - - void PreserveConfigs() - { - memcpy(&PreviousGameConfig, &game_config, sizeof(GAME_CONFIG)); - memcpy(&PreviousEmuConfig, &emu_config, sizeof(EMU_CONFIG)); - } - - int LoadGameAndItsData(char *filename){ - if (gamepak_name[0] != '\0') { - S9xAutoSaveSRAM(); - } - - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_LOADING_GAME]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - HighFrequencyCPU(); - int load_result = load_gamepak(filename); - LowFrequencyCPU(); - - if(load_result == -1) - { - first_load = 1; - gamepak_name[0] = '\0'; - return 0; - } - - char tempPath[MAX_PATH]; - strcpy(tempPath, filename); - - //update folders and names for settings/config uses - char *dirEnd = strrchr(tempPath, '/'); - //make sure a valid path was provided - if(!dirEnd) - return 0; - - //copy file name as gamepak_name - strcpy(gamepak_name, dirEnd+1); - //then strip filename from directory path and set it - *dirEnd = '\0'; - strcpy(g_default_rom_dir, tempPath); - - first_load = 0; - load_game_config_file(); - PreserveConfigs(); // Make the emulator not save what we've JUST read - // but it will save the emulator configuration below for latest files - - return_value = 1; - repeat = 0; - - reorder_latest_file(); - get_savestate_filelist(); - - game_fast_forward= 0; - return 1; - } - - void menu_load() - { - char *file_ext[] = { ".smc", ".sfc", ".zip", NULL }; - - if(load_file(file_ext, tmp_filename, g_default_rom_dir) != -1) - { - strcpy(line_buffer, g_default_rom_dir); - strcat(line_buffer, "/"); - strcat(line_buffer, tmp_filename); - - LoadGameAndItsData(line_buffer); - } - else - { - choose_menu(current_menu); - } - } - - void menu_restart() - { - if(!first_load) - { - game_restart(); - return_value = 1; - repeat = 0; - } - } - - void menu_return() - { - if(!first_load) - repeat = 0; - } - - void clear_savestate_slot(u32 slot_index) - { - get_savestate_filename(slot_index, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - remove(line_buffer); - SavedStateCacheInvalidate (); - } - - void savestate_selitem(u32 selected, u32 y_pos) - { - u32 k; - - for(k= 0; k < SAVE_STATE_SLOT_NUM; k++) - { - struct gui_iconlist *icon; - bool8 Exists = SavedStateFileExists (k); - uint8 X = SavedStateSquareX (k); - - if (selected == k && Exists) - icon = &ICON_STATEFULL; - else if (selected == k && !Exists) - icon = &ICON_STATEEMPTY; - else if (selected != k && Exists) - icon = &ICON_NSTATEFULL; - else if (selected != k && !Exists) - icon = &ICON_NSTATEEMPTY; - - show_icon((unsigned short *) down_screen_addr, icon, X, y_pos); - } - } - - void game_state_menu_init() - { - if(first_load) - { - ds2_clearScreen(UP_SCREEN, 0); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - else if(SavedStateFileExists(savestate_index)) - { - get_savestate_filename(savestate_index, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - load_game_stat_snapshot(tmp_filename); - } - else - { - ds2_clearScreen(UP_SCREEN, COLOR_BLACK); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - - void game_state_menu_end() - { - if (!first_load) - { - copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - else - { - ds2_clearScreen(UP_SCREEN, 0); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - - void game_state_menu_passive() - { - unsigned int line[3] = {0, 2, 4}; - - //draw background - show_icon(down_screen_addr, &ICON_SUBBG, 0, 0); - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - - if(current_option_num == 0) - show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y); - else - show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y); - - strcpy(line_buffer, *(display_option->display_string)); - draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer); - - display_option += 1; - for(i= 0; i < 3; i++, display_option++) - { - unsigned short color; - - if(display_option == current_option) - show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + SUBSELA_OFFSET_Y); - - if(display_option->option_type & NUMBER_SELECTION_TYPE) - { - sprintf(line_buffer, *(display_option->display_string), - *(display_option->current_option)+1); //ADD 1 here - } - else if(display_option->option_type & STRING_SELECTION_TYPE) - { - sprintf(line_buffer, *(display_option->display_string), - *((u32*)(((u32 *)display_option->options)[*(display_option->current_option)]))); - } - else - { - strcpy(line_buffer, *(display_option->display_string)); - } - - if(display_option == current_option) - color= COLOR_ACTIVE_ITEM; - else - color= COLOR_INACTIVE_ITEM; - - PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + TEXT_OFFSET_Y); - } - - unsigned int selected_write, selected_read; - - selected_write = -1; - selected_read = -1; - - if(current_option_num == 1 /* write */) - selected_write = savestate_index; - if(current_option_num == 2 /* read */) - selected_read = savestate_index; - - savestate_selitem(selected_write, GUI_ROW1_Y + 1 * GUI_ROW_SY + (GUI_ROW_SY - ICON_STATEFULL.y) / 2); - savestate_selitem(selected_read, GUI_ROW1_Y + 3 * GUI_ROW_SY + (GUI_ROW_SY - ICON_STATEFULL.y) / 2); - } - - u32 delette_savestate_num= 0; - - void gamestate_delette_menu_init() - { - if(first_load) - { - ds2_clearScreen(UP_SCREEN, 0); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - else if(SavedStateFileExists(delette_savestate_num)) - { - get_savestate_filename(delette_savestate_num, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - load_game_stat_snapshot(tmp_filename); - } - else - { - ds2_clearScreen(UP_SCREEN, COLOR_BLACK); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - - void gamestate_delette_menu_end() - { - if (!first_load) - { - copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - else - { - ds2_clearScreen(UP_SCREEN, 0); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - - void gamestate_delette_menu_passive() - { - unsigned int line[2] = {0, 2}; - - //draw background - show_icon(down_screen_addr, &ICON_SUBBG, 0, 0); - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - - if(current_option_num == 0) - show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y); - else - show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y); - - strcpy(line_buffer, *(display_option->display_string)); - draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer); - - display_option += 1; - for(i= 0; i < 2; i++, display_option++) - { - unsigned short color; - - if(display_option == current_option) - show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + SUBSELA_OFFSET_Y); - - if(display_option->option_type & NUMBER_SELECTION_TYPE) - { - sprintf(line_buffer, *(display_option->display_string), - *(display_option->current_option)+1); - } - else if(display_option->option_type & STRING_SELECTION_TYPE) - { - sprintf(line_buffer, *(display_option->display_string), - *((u32*)(((u32 *)display_option->options)[*(display_option->current_option)]))); - } - else - { - strcpy(line_buffer, *(display_option->display_string)); - } - - if(display_option == current_option) - color= COLOR_ACTIVE_ITEM; - else - color= COLOR_INACTIVE_ITEM; - - PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + TEXT_OFFSET_Y); - } - - if(current_option_num == 1) - savestate_selitem(delette_savestate_num, GUI_ROW1_Y + 1 * GUI_ROW_SY+ (GUI_ROW_SY - ICON_STATEFULL.y) / 2); - else - savestate_selitem(-1, GUI_ROW1_Y + 1 * GUI_ROW_SY + (GUI_ROW_SY - ICON_STATEFULL.y) / 2); - } - - void menu_save_state() - { - if(!first_load) - { - if(gui_action == CURSOR_SELECT) - { - if (SavedStateFileExists (savestate_index)) - { - draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_SAVESTATE_FULL]); - if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B]) == 0) - return; - - clear_savestate_slot(savestate_index); - } - - get_savestate_filename(savestate_index, tmp_filename); - - draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - HighFrequencyCPU(); - int flag = save_state(tmp_filename, (void*)screen); - LowFrequencyCPU(); - //clear message - draw_message(down_screen_addr, NULL, 28, 31, 227, 96, 0); - if(flag < 0) - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]); - } - else - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED]); - } - - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - SavedStateCacheInvalidate (); - - mdelay(500); // let the progress message linger - - // Now show the screen of what we just wrote. - get_savestate_filename(savestate_index, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - HighFrequencyCPU(); - load_game_stat_snapshot(tmp_filename); - LowFrequencyCPU(); - } - else //load screen snapshot - { - if(SavedStateFileExists(savestate_index)) - { - get_savestate_filename(savestate_index, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - HighFrequencyCPU(); - load_game_stat_snapshot(tmp_filename); - LowFrequencyCPU(); - } - else - { - ds2_clearScreen(UP_SCREEN, COLOR_BLACK); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - } - } - - void menu_load_state() - { - if(!first_load) - { - FILE *fp= NULL; - - if(bg_screenp != NULL) - { - bg_screenp_color = COLOR16(43, 11, 11); - memcpy(bg_screenp, down_screen_addr, 256*192*2); - } - else - bg_screenp_color = COLOR_BG; - - if(SavedStateFileExists(savestate_index)) - { - get_savestate_filename(savestate_index, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - - //right - if(gui_action == CURSOR_SELECT) - { - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(up_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]); - - HighFrequencyCPU(); - int flag = load_state(tmp_filename); - LowFrequencyCPU(); - if(0 == flag) - { - return_value = 1; - repeat = 0; - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED]); - } - else - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]); - mdelay(500); // let the failure show - } - } - else //load screen snapshot - { - HighFrequencyCPU(); - load_game_stat_snapshot(tmp_filename); - LowFrequencyCPU(); - } - } - else - { - ds2_clearScreen(UP_SCREEN, COLOR_BLACK); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - } - - void delette_savestate() - { - if(!first_load) - { - if (gui_action == CURSOR_SELECT) - { - if(bg_screenp != NULL) - { - bg_screenp_color = COLOR16(43, 11, 11); - memcpy(bg_screenp, down_screen_addr, 256*192*2); - } - else - bg_screenp_color = COLOR_BG; - - wait_Allkey_release(0); - if(current_option_num == 2) //delette all - { - u32 i, flag; - - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_DIALOG_SAVED_STATE_DELETE_ALL]); - - flag= 0; - for(i= 0; i < SAVE_STATE_SLOT_NUM; i++) - if (SavedStateFileExists (i)) - {flag= 1; break;} - - if(flag) - { - if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B])) - { - wait_Allkey_release(0); - for(i= 0; i < SAVE_STATE_SLOT_NUM; i++) - { - get_savestate_filename(i, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - remove(line_buffer); - SavedStateCacheInvalidate (); - } - savestate_index= 0; - } - } - else - { - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - mdelay(500); - } - } - else if(current_option_num == 1) //delette single - { - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - - if(SavedStateFileExists(delette_savestate_num)) - { - sprintf(line_buffer, msg[FMT_DIALOG_SAVED_STATE_DELETE_ONE], delette_savestate_num + 1); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, line_buffer); - - if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B])) { - wait_Allkey_release(0); - clear_savestate_slot(delette_savestate_num); - } - } - else - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - mdelay(500); - } - } - } - else //load screen snapshot - { - if(SavedStateFileExists(delette_savestate_num)) - { - get_savestate_filename(delette_savestate_num, tmp_filename); - sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename); - HighFrequencyCPU(); - load_game_stat_snapshot(tmp_filename); - LowFrequencyCPU(); - } - else - { - ds2_clearScreen(UP_SCREEN, COLOR_BLACK); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - } - } - - MENU_TYPE cheats_menu; - MENU_TYPE *dynamic_cheat_menu = NULL; - MENU_OPTION_TYPE *dynamic_cheat_options = NULL; - unsigned char *dynamic_cheat_msg = NULL; - unsigned char **dynamic_cheat_pt = NULL; - unsigned int dynamic_cheat_active; - int dynamic_cheat_scroll_value= 0; - - void cheat_menu_init() - { - for(i = 0; i < MAX_CHEATS_T; i++) - { - sprintf(cheat_data_str[i], "%d", i); - cheat_data_ptr[i] = &cheat_data_str[i][0]; - } - - NDSSFCGetCheatGroups(cheat_group_name_ptr, cheat_group_names); - - reload_cheats_page(); - } - - void cheat_menu_end() - { - // Honour current cheat selections. - uint32 i; - for (i = 0; i < Cheat.num_cheats; i++) { - if (Cheat.c[i].enabled) - S9xApplyCheat(i); - else - S9xRemoveCheat(i); - } - // Save current cheat selections to the cheat binary file. - S9xSaveCheatFile (S9xGetFilename (".chb")); - } - - void cheat_option_action() - { - char tmp_buf[512]; - strcpy(tmp_buf, *(current_option->display_string)); - int i = atoi(tmp_buf); - // 'i' is the cheat group index. - if (cheat_group_name_ptr[i] == NULL) - return; - if (NDSSFCIsCheatGroupEnabled (cheat_group_name_ptr[i])) - NDSSFCDisableCheatGroup (cheat_group_name_ptr[i]); - else - NDSSFCEnableCheatGroup (cheat_group_name_ptr[i]); - } - - void cheat_option_passive() - { - unsigned short color; - char tmp_buf[512]; - unsigned int len; - - if(display_option == current_option) - color= COLOR_ACTIVE_ITEM; - else - color= COLOR_INACTIVE_ITEM; - - //sprintf("%A") will have problem ? - strcpy(tmp_buf, *(display_option->display_string)); - // This is the number of the cheat to display - - int i = atoi(tmp_buf); - - sprintf(line_buffer, "%d.", i + 1); - PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, CHEAT_NUMBER_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y); - - if (cheat_group_name_ptr[i] == NULL) { - PRINT_STRING_BG(down_screen_addr, msg[MSG_CHEAT_ELEMENT_NOT_LOADED], color, COLOR_TRANS, CHEAT_DESC_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y); - } - else { - strcpy(line_buffer, cheat_group_name_ptr[i]); - len = BDF_cut_string(line_buffer, 0, 2); - if(len > CHEAT_DESC_SX) - { - len = BDF_cut_string(line_buffer, CHEAT_DESC_SX, 1); - line_buffer[len] = '\0'; - strcat(line_buffer, "..."); - } - PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, CHEAT_DESC_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y); - - if (NDSSFCIsCheatGroupEnabled (cheat_group_name_ptr[i])) - strcpy(line_buffer, "+"); - else - strcpy(line_buffer, "-"); - PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, CHEAT_ACTIVE_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y); - } - } - - void menu_load_cheat_file() - { - if (!first_load) - { - char *file_ext[] = { ".cht", NULL }; - int flag; - - if(load_file(file_ext, tmp_filename, DEFAULT_CHEAT_DIR) != -1) - { - sprintf(line_buffer, "%s/%s", DEFAULT_CHEAT_DIR, tmp_filename); - flag = NDSSFCLoadCheatFile(line_buffer); - - S9xSaveCheatFile (S9xGetFilename (".chb")); // cheat binary - - if(0 != flag) - { //load cheat file failure - S9xDeleteCheats(); - - cheat_menu_init(); - return; - } - - menu_cheat_page = 0; - cheat_menu_init(); - - } - } - } - - void save_screen_snapshot() - { - if(bg_screenp != NULL) - { - bg_screenp_color = COLOR16(43, 11, 11); - memcpy(bg_screenp, down_screen_addr, 256*192*2); - } - else - bg_screenp_color = COLOR_BG; - - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - if(!first_load) - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATING]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - if(save_ss_bmp(screen)) { - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED]); - } - else { - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_FAILED]); - } - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - mdelay(500); - } - else - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - mdelay(500); - } - } - - void browse_screen_snapshot() - { - play_screen_snapshot(); - } - - MENU_TYPE latest_game_menu; - - void load_default_setting() - { - if(bg_screenp != NULL) - { - bg_screenp_color = COLOR16(43, 11, 11); - memcpy(bg_screenp, down_screen_addr, 256*192*2); - } - else - bg_screenp_color = COLOR_BG; - - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_DIALOG_RESET]); - - if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B])) - { - wait_Allkey_release(0); - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_RESETTING]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - sprintf(line_buffer, "%s/%s", main_path, EMU_CONFIG_FILENAME); - remove(line_buffer); - - first_load= 1; - latest_game_menu.focus_option = latest_game_menu.screen_focus = 0; - init_emulator_config(); - init_game_config(); - - ds2_clearScreen(UP_SCREEN, 0); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - - // mdelay(500); // Delete this delay - } - } - - void check_gbaemu_version() - { - if(bg_screenp != NULL) - { - bg_screenp_color = COLOR16(43, 11, 11); - memcpy(bg_screenp, down_screen_addr, 256*192*2); - } - else - bg_screenp_color = COLOR_BG; - - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - sprintf(line_buffer, "%s\n%s %s", msg[MSG_EMULATOR_NAME], msg[MSG_WORD_EMULATOR_VERSION], NDSSFC_VERSION); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, line_buffer); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - wait_Allkey_release(0); // invoked from the menu - wait_Anykey_press(0); // wait until the user presses something - wait_Allkey_release(0); // don't give that button to the menu - } - - void language_set() - { - if(gui_action == CURSOR_LEFT || gui_action == CURSOR_RIGHT) - { - HighFrequencyCPU(); // crank it up - - load_language_msg(LANGUAGE_PACK, emu_config.language); - - if(first_load) - { - ds2_clearScreen(UP_SCREEN, 0); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - - LowFrequencyCPU(); // and back down - } - } - -#ifdef ENABLE_FREE_SPACE - unsigned int freespace; - void show_card_space () - { - u32 line_num; - u32 num_byte; - - strcpy(line_buffer, *(display_option->display_string)); - line_num= display_option-> line_number; - PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, OPTION_TEXT_X, - GUI_ROW1_Y + (display_option->line_number) * GUI_ROW_SY + TEXT_OFFSET_Y); - - num_byte = freespace; - - if(num_byte <= 9999*2) - { /* < 9999KB */ - sprintf(line_buffer, "%d", num_byte/2); - if(num_byte & 1) - strcat(line_buffer, ".5 KB"); - else - strcat(line_buffer, ".0 KB"); - } - else if(num_byte <= 9999*1024*2) - { /* < 9999MB */ - num_byte /= 1024; - sprintf(line_buffer, "%d", num_byte/2); - if(num_byte & 1) - strcat(line_buffer, ".5 MB"); - else - strcat(line_buffer, ".0 MB"); - } - else - { - num_byte /= 1024*1024; - sprintf(line_buffer, "%d", num_byte/2); - if(num_byte & 1) - strcat(line_buffer, ".5 GB"); - else - strcat(line_buffer, ".0 GB"); - } - - PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 147, - GUI_ROW1_Y + (display_option->line_number) * GUI_ROW_SY + TEXT_OFFSET_Y); - } -#endif - - char *screen_ratio_options[] = { (char*)&msg[MSG_VIDEO_ASPECT_RATIO_0], - (char*)&msg[MSG_VIDEO_ASPECT_RATIO_1], - (char*)&msg[MSG_VIDEO_ASPECT_RATIO_2], - (char*)&msg[MSG_VIDEO_ASPECT_RATIO_3], - (char*)&msg[MSG_VIDEO_ASPECT_RATIO_4]}; - - char *frameskip_options[] = { (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_0], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_1], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_2], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_3], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_4], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_5], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_6], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_7], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_8], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_9], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_10] }; - - char *cpu_frequency_options[] = { (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_0], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_1], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_2], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_3], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_4], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_5] }; - - char *fluidity_options[] = { (char*)&msg[MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO], (char*)&msg[MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO] }; - - char *on_off_options[] = { (char*)&msg[MSG_GENERAL_OFF], (char*)&msg[MSG_GENERAL_ON] }; - - char *sound_seletion[] = { (char*)&msg[MSG_AUDIO_MUTED], (char*)&msg[MSG_AUDIO_ENABLED] }; - - char *game_screen_options[] = { (char*)&msg[MSG_VIDEO_GAME_SCREEN_TOP], (char*)&msg[MSG_VIDEO_GAME_SCREEN_BOTTOM] }; - - -// char *snap_frame_options[] = { (char*)&msg[MSG_SNAP_FRAME_0], (char*)&msg[MSG_SNAP_FRAME_1] }; - -// char *enable_disable_options[] = { (char*)&msg[MSG_EN_DIS_ABLE_0], (char*)&msg[MSG_EN_DIS_ABLE_1] }; - - /*-------------------------------------------------------- - Video & Audio - --------------------------------------------------------*/ - MENU_OPTION_TYPE graphics_options[] = - { - /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_VIDEO_AUDIO], NULL, 0), - - /* 01 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_VIDEO_ASPECT_RATIO], screen_ratio_options, - &game_config.graphic, 5, NULL, PASSIVE_TYPE, 1), - - /* 02 */ STRING_SELECTION_OPTION(game_fastforward, NULL, &msg[FMT_VIDEO_FAST_FORWARD], on_off_options, - &game_fast_forward, 2, NULL, ACTION_TYPE, 2), - - /* 03 */ STRING_SELECTION_OPTION(game_disableAudio, NULL, &msg[FMT_AUDIO_SOUND], sound_seletion, - &game_enable_audio, 2, NULL, ACTION_TYPE, 3), - - /* 04 */ STRING_SELECTION_OPTION(game_set_fluidity, NULL, &msg[FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE], fluidity_options, - &game_config.SoundSync, 2, NULL, ACTION_TYPE, 4), - - /* 05 */ STRING_SELECTION_OPTION(game_set_frameskip, NULL, &msg[FMT_VIDEO_FRAME_SKIPPING], frameskip_options, - &game_config.frameskip_value, 12 /* auto (0) and 0..10 (1..11) make 12 option values */, NULL, ACTION_TYPE, 5), - - /* 06 */ STRING_SELECTION_OPTION(game_set_retro, NULL, &msg[FMT_AUDIO_RETRO_SOUND], on_off_options, - &game_config.RetroSound, 2, NULL, ACTION_TYPE, 6), - - /* 07 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_VIDEO_GAME_SCREEN], game_screen_options, - &emu_config.BottomScreenGame, 2, NULL, PASSIVE_TYPE, 7) - - }; - - MAKE_MENU(graphics, NULL, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Game state -- delette - --------------------------------------------------------*/ - MENU_TYPE game_state_menu; - - MENU_OPTION_TYPE gamestate_delette_options[] = - { - /* 00 */ SUBMENU_OPTION(&game_state_menu, &msg[MSG_SAVED_STATE_DELETE_GENERAL], NULL, 0), - - /* 01 */ NUMERIC_SELECTION_ACTION_OPTION(delette_savestate, NULL, - &msg[FMT_SAVED_STATE_DELETE_ONE], &delette_savestate_num, SAVE_STATE_SLOT_NUM, NULL, 1), - - /* 02 */ ACTION_OPTION(delette_savestate, NULL, &msg[MSG_SAVED_STATE_DELETE_ALL], NULL, 2) - }; - - MAKE_MENU(gamestate_delette, gamestate_delette_menu_init, gamestate_delette_menu_passive, NULL, gamestate_delette_menu_end, 1, 1); - - /*-------------------------------------------------------- - Game state - --------------------------------------------------------*/ - MENU_OPTION_TYPE game_state_options[] = - { - /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_SAVED_STATES], NULL, 0), - - // savestate_index is still a signed int - /* 01 */ NUMERIC_SELECTION_ACTION_OPTION(menu_save_state, NULL, &msg[FMT_SAVED_STATE_CREATE], (u32*) &savestate_index, SAVE_STATE_SLOT_NUM, NULL, 1), - - // savestate_index is still a signed int - /* 02 */ NUMERIC_SELECTION_ACTION_OPTION(menu_load_state, NULL, - &msg[FMT_SAVED_STATE_LOAD], (u32*) &savestate_index, SAVE_STATE_SLOT_NUM, NULL, 2), - - /* 03 */ SUBMENU_OPTION(&gamestate_delette_menu, &msg[MSG_SAVED_STATE_DELETE_GENERAL], NULL, 5), - }; - - INIT_MENU(game_state, game_state_menu_init, game_state_menu_passive, NULL, game_state_menu_end, 1, 1); - - /*-------------------------------------------------------- - Cheat options - --------------------------------------------------------*/ - MENU_OPTION_TYPE cheats_options[] = - { - /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_CHEATS], NULL,0), - - /* 01 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive, - ((CHEATS_PER_PAGE * menu_cheat_page) + 0), 1), - /* 02 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive, - ((CHEATS_PER_PAGE * menu_cheat_page) + 1), 2), - /* 03 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive, - ((CHEATS_PER_PAGE * menu_cheat_page) + 2), 3), - /* 04 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive, - ((CHEATS_PER_PAGE * menu_cheat_page) + 3), 4), - /* 03 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive, - ((CHEATS_PER_PAGE * menu_cheat_page) + 4), 5), - /* 04 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive, - ((CHEATS_PER_PAGE * menu_cheat_page) + 5), 6), - - /* 05 */ NUMERIC_SELECTION_ACTION_OPTION(reload_cheats_page, NULL, &msg[FMT_CHEAT_PAGE], - &menu_cheat_page, MAX_CHEATS_PAGE, NULL, 7), - - /* 06 */ ACTION_OPTION(menu_load_cheat_file, NULL, &msg[MSG_CHEAT_LOAD_FROM_FILE], - NULL, 8) - }; - - INIT_MENU(cheats, cheat_menu_init, NULL, NULL, cheat_menu_end, 1, 1); - - /*-------------------------------------------------------- - Tools-screensanp - --------------------------------------------------------*/ - MENU_TYPE tools_menu; - - MENU_OPTION_TYPE tools_screensnap_options[] = - { - /* 00 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_TOOLS_SCREENSHOT_GENERAL], NULL, 0), - - /* 01 */ ACTION_OPTION(save_screen_snapshot, NULL, &msg[MSG_SCREENSHOT_CREATE], NULL, 1), - - /* 02 */ ACTION_OPTION(browse_screen_snapshot, NULL, &msg[MSG_SCREENSHOT_BROWSE], NULL, 2) - }; - - MAKE_MENU(tools_screensnap, NULL, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Tools - Global hotkeys - --------------------------------------------------------*/ - MENU_OPTION_TYPE tools_global_hotkeys_options[] = - { - /* 00 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_TOOLS_GLOBAL_HOTKEY_GENERAL], NULL, 0), - - /* 01 */ ACTION_OPTION(set_global_hotkey_return_to_menu, global_hotkey_return_to_menu_passive, &msg[MSG_HOTKEY_MAIN_MENU], NULL, 1), - - /* 02 */ ACTION_OPTION(set_global_hotkey_temporary_fast_forward, global_hotkey_temporary_fast_forward_passive, &msg[MSG_HOTKEY_TEMPORARY_FAST_FORWARD], NULL, 2), - - /* 03 */ ACTION_OPTION(set_global_hotkey_toggle_sound, global_hotkey_toggle_sound_passive, &msg[MSG_HOTKEY_SOUND_TOGGLE], NULL, 3), - - /* 04 */ ACTION_OPTION(set_global_hotkey_quick_save_state, global_hotkey_quick_save_state_passive, &msg[MSG_HOTKEY_QUICK_SAVE_STATE], NULL, 4), - - /* 05 */ ACTION_OPTION(set_global_hotkey_quick_load_state, global_hotkey_quick_load_state_passive, &msg[MSG_HOTKEY_QUICK_LOAD_STATE], NULL, 5), - - /* 06 */ ACTION_OPTION(set_global_hotkey_toggle_full_screen, global_hotkey_toggle_full_screen_passive, &msg[MSG_HOTKEY_FULL_SCREEN_TOGGLE], NULL, 6) - }; - - MAKE_MENU(tools_global_hotkeys, NULL, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Tools - Game-specific hotkey overrides - --------------------------------------------------------*/ - MENU_OPTION_TYPE tools_game_specific_hotkeys_options[] = - { - /* 00 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_TOOLS_GAME_HOTKEY_GENERAL], NULL, 0), - - /* 01 */ ACTION_OPTION(set_game_specific_hotkey_return_to_menu, game_specific_hotkey_return_to_menu_passive, &msg[MSG_HOTKEY_MAIN_MENU], NULL, 1), - - /* 02 */ ACTION_OPTION(set_game_specific_hotkey_temporary_fast_forward, game_specific_hotkey_temporary_fast_forward_passive, &msg[MSG_HOTKEY_TEMPORARY_FAST_FORWARD], NULL, 2), - - /* 03 */ ACTION_OPTION(set_game_specific_hotkey_toggle_sound, game_specific_hotkey_toggle_sound_passive, &msg[MSG_HOTKEY_SOUND_TOGGLE], NULL, 3), - - /* 04 */ ACTION_OPTION(set_game_specific_hotkey_quick_save_state, game_specific_hotkey_quick_save_state_passive, &msg[MSG_HOTKEY_QUICK_SAVE_STATE], NULL, 4), - - /* 05 */ ACTION_OPTION(set_game_specific_hotkey_quick_load_state, game_specific_hotkey_quick_load_state_passive, &msg[MSG_HOTKEY_QUICK_LOAD_STATE], NULL, 5), - - /* 06 */ ACTION_OPTION(set_game_specific_hotkey_toggle_full_screen, game_specific_hotkey_toggle_full_screen_passive, &msg[MSG_HOTKEY_FULL_SCREEN_TOGGLE], NULL, 6) - }; - - MAKE_MENU(tools_game_specific_hotkeys, NULL, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Tools - --------------------------------------------------------*/ - MENU_OPTION_TYPE tools_options[] = - { - /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_TOOLS], NULL, 0), - - /* 01 */ SUBMENU_OPTION(&tools_screensnap_menu, &msg[MSG_TOOLS_SCREENSHOT_GENERAL], NULL, 1), - - /* 02 */ SUBMENU_OPTION(&tools_global_hotkeys_menu, &msg[MSG_TOOLS_GLOBAL_HOTKEY_GENERAL], NULL, 2), - - /* 03 */ SUBMENU_OPTION(&tools_game_specific_hotkeys_menu, &msg[MSG_TOOLS_GAME_HOTKEY_GENERAL], NULL, 3) - }; - - INIT_MENU(tools, tools_menu_init, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Others - --------------------------------------------------------*/ - u32 desert= 0; - MENU_OPTION_TYPE others_options[] = - { - /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_OPTIONS], NULL, 0), - - //CPU speed (string: shows MHz) - /* 01 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_OPTIONS_CPU_FREQUENCY], cpu_frequency_options, - &game_config.clock_speed_number, 6, NULL, PASSIVE_TYPE, 1), - - /* 02 */ STRING_SELECTION_OPTION(language_set, NULL, &msg[FMT_OPTIONS_LANGUAGE], language_options, - &emu_config.language, sizeof(language_options) / sizeof(language_options[0]) /* number of possible languages */, NULL, ACTION_TYPE, 2), - -#ifdef ENABLE_FREE_SPACE - /* 03 */ STRING_SELECTION_OPTION(NULL, show_card_space, &msg[MSG_OPTIONS_CARD_CAPACITY], NULL, - &desert, 2, NULL, PASSIVE_TYPE | HIDEN_TYPE, 3), -#endif - - /* 04 */ ACTION_OPTION(load_default_setting, NULL, &msg[MSG_OPTIONS_RESET], NULL, -#ifdef ENABLE_FREE_SPACE - 4 -#else - 3 -#endif - ), - - /* 05 */ ACTION_OPTION(check_gbaemu_version, NULL, &msg[MSG_OPTIONS_VERSION], NULL, -#ifdef ENABLE_FREE_SPACE - 5 -#else - 4 -#endif - ), - }; - - MAKE_MENU(others, others_menu_init, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Load_game - --------------------------------------------------------*/ - - MENU_OPTION_TYPE load_game_options[] = - { - /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_LOAD_GAME_MENU_TITLE], NULL, 0), - - /* 01 */ ACTION_OPTION(menu_load, NULL, &msg[MSG_LOAD_GAME_FROM_CARD], NULL, 1), - - /* 02 */ SUBMENU_OPTION(&latest_game_menu, &msg[MSG_LOAD_GAME_RECENTLY_PLAYED], NULL, 2) - }; - - MAKE_MENU(load_game, NULL, NULL, NULL, NULL, 1, 1); - - /*-------------------------------------------------------- - Latest game - --------------------------------------------------------*/ - MENU_OPTION_TYPE latest_game_options[] = - { - /* 00 */ SUBMENU_OPTION(&load_game_menu, &msg[MSG_LOAD_GAME_RECENTLY_PLAYED], NULL, 0), - - /* 01 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 1), - - /* 02 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 2), - - /* 03 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 3), - - /* 04 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 4), - - /* 05 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 5) - }; - - INIT_MENU(latest_game, latest_game_menu_init, latest_game_menu_passive, - latest_game_menu_key, latest_game_menu_end, 0, 0); - - /*-------------------------------------------------------- - MAIN MENU - --------------------------------------------------------*/ - MENU_OPTION_TYPE main_options[] = - { - /* 00 */ SUBMENU_OPTION(&graphics_menu, &msg[MSG_MAIN_MENU_VIDEO_AUDIO], NULL, 0), - - /* 01 */ SUBMENU_OPTION(&game_state_menu, &msg[MSG_MAIN_MENU_SAVED_STATES], NULL, 1), - - /* 02 */ SUBMENU_OPTION(&cheats_menu, &msg[MSG_MAIN_MENU_CHEATS], NULL, 2), - - /* 03 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_MAIN_MENU_TOOLS], NULL, 3), - - /* 04 */ SUBMENU_OPTION(&others_menu, &msg[MSG_MAIN_MENU_OPTIONS], NULL, 4), - - /* 05 */ ACTION_OPTION(menu_exit, NULL, &msg[MSG_MAIN_MENU_EXIT], NULL, 5), - - /* 06 */ SUBMENU_OPTION(&load_game_menu, NULL, NULL, 6), - - /* 07 */ ACTION_OPTION(menu_return, NULL, NULL, NULL, 7), - - /* 08 */ ACTION_OPTION(menu_restart, NULL, NULL, NULL, 8) - }; - - MAKE_MENU(main, NULL, main_menu_passive, main_menu_key, NULL, 6, 0); - - void main_menu_passive() - { - u16 color; - show_icon(down_screen_addr, &ICON_MAINBG, 0, 0); - - //Audio/Video - strcpy(line_buffer, *(display_option->display_string)); - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_AVO, 19, 2); - show_icon(down_screen_addr, &ICON_MSEL, 5, 57); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NAVO, 19, 2); - show_icon(down_screen_addr, &ICON_MNSEL, 5, 57); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 7, 57, 75, color, line_buffer); - - //Save - strcpy(line_buffer, *(display_option->display_string)); - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_SAVO, 103, 2); - show_icon(down_screen_addr, &ICON_MSEL, 89, 57); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NSAVO, 103, 2); - show_icon(down_screen_addr, &ICON_MNSEL, 89, 57); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 91, 57, 75, color, line_buffer); - - //Cheat - strcpy(line_buffer, *(display_option->display_string)); - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_CHEAT, 187, 2); - show_icon(down_screen_addr, &ICON_MSEL, 173, 57); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NCHEAT, 187, 2); - show_icon(down_screen_addr, &ICON_MNSEL, 173, 57); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 175, 57, 75, color, line_buffer); - - //Tools - strcpy(line_buffer, *(display_option->display_string)); - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_TOOL, 19, 75); - show_icon(down_screen_addr, &ICON_MSEL, 5, 131); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NTOOL, 19, 75); - show_icon(down_screen_addr, &ICON_MNSEL, 5, 131); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 7, 131, 75, color, line_buffer); - - //Other - strcpy(line_buffer, *(display_option->display_string)); - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_OTHER, 103, 75); - show_icon(down_screen_addr, &ICON_MSEL, 89, 131); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NOTHER, 103, 75); - show_icon(down_screen_addr, &ICON_MNSEL, 89, 131); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 91, 131, 75, color, line_buffer); - - //Exit - strcpy(line_buffer, *(display_option->display_string)); - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_EXIT, 187, 75); - show_icon(down_screen_addr, &ICON_MSEL, 173, 131); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NEXIT, 187, 75); - show_icon(down_screen_addr, &ICON_MNSEL, 173, 131); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 175, 131, 75, color, line_buffer); - - //New - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_MAINITEM, 0, 154); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NMAINITEM, 0, 154); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 0, 165, 85, color, msg[MSG_MAIN_MENU_NEW_GAME]); - - //Restart - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_MAINITEM, 85, 154); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NMAINITEM, 85, 154); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 85, 165, 85, color, msg[MSG_MAIN_MENU_RETURN_TO_GAME]); - - //Return - if(display_option++ == current_option) { - show_icon(down_screen_addr, &ICON_MAINITEM, 170, 154); - color = COLOR_ACTIVE_MAIN; - } - else { - show_icon(down_screen_addr, &ICON_NMAINITEM, 170, 154); - color = COLOR_INACTIVE_MAIN; - } - draw_string_vcenter(down_screen_addr, 170, 165, 85, color, msg[MSG_MAIN_MENU_RESET_GAME]); - } - - void main_menu_key() - { - switch(gui_action) - { - case CURSOR_DOWN: - if(current_option_num < 6) current_option_num += 3; - else current_option_num -= 6; - - current_option = current_menu->options + current_option_num; - break; - - case CURSOR_UP: - if(current_option_num < 3) current_option_num += 6; - else current_option_num -= 3; - - current_option = current_menu->options + current_option_num; - break; - - case CURSOR_RIGHT: - if(current_option_num == 2) current_option_num -= 2; - else if(current_option_num == 5) current_option_num -= 2; - else if(current_option_num == 8) current_option_num -= 2; - else current_option_num += 1; - - current_option = main_menu.options + current_option_num; - break; - - case CURSOR_LEFT: - if(current_option_num == 0) current_option_num += 2; - else if(current_option_num == 3) current_option_num += 2; - else if(current_option_num == 6) current_option_num += 2; - else current_option_num -= 1; - - current_option = main_menu.options + current_option_num; - break; - - default: - break; - }// end swith - } - - void tools_menu_init() - { - /* if(game_config.backward) - tools_options[4].option_type &= ~HIDEN_TYPE; - else - tools_options[4].option_type |= HIDEN_TYPE; */ - // OUT OF BOUNDS MEMORY ACCESS, REENABLE IF NEEDED [NEB] - if (first_load) - tools_options[3] /* game hotkeys */.option_type |= HIDEN_TYPE; - else - tools_options[3] /* game hotkeys */.option_type &= ~HIDEN_TYPE; - } - - void obtain_hotkey (u32 *HotkeyBitfield) - { - draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS]); - - u32 Keys = draw_hotkey_dialog(DOWN_SCREEN, 115, msg[MSG_HOTKEY_DELETE_WITH_A], msg[MSG_HOTKEY_CANCEL_WITH_B]); - if (Keys == KEY_B) - ; // unmodified - else if (Keys == KEY_A) - *HotkeyBitfield = 0; // clear - else - *HotkeyBitfield = Keys; // set - } - - void set_global_hotkey_return_to_menu() - { - obtain_hotkey(&emu_config.HotkeyReturnToMenu); - } - - void set_global_hotkey_temporary_fast_forward() - { - obtain_hotkey(&emu_config.HotkeyTemporaryFastForward); - } - - void set_global_hotkey_toggle_sound() - { - obtain_hotkey(&emu_config.HotkeyToggleSound); - } - - void set_global_hotkey_quick_load_state() - { - obtain_hotkey(&emu_config.HotkeyQuickLoadState); - } - - void set_global_hotkey_quick_save_state() - { - obtain_hotkey(&emu_config.HotkeyQuickSaveState); - } - - void set_global_hotkey_toggle_full_screen() - { - obtain_hotkey(&emu_config.HotkeyToggleFullScreen); - } - - void set_game_specific_hotkey_return_to_menu() - { - obtain_hotkey(&game_config.HotkeyReturnToMenu); - } - - void set_game_specific_hotkey_temporary_fast_forward() - { - obtain_hotkey(&game_config.HotkeyTemporaryFastForward); - } - - void set_game_specific_hotkey_toggle_sound() - { - obtain_hotkey(&game_config.HotkeyToggleSound); - } - - void set_game_specific_hotkey_quick_load_state() - { - obtain_hotkey(&game_config.HotkeyQuickLoadState); - } - - void set_game_specific_hotkey_quick_save_state() - { - obtain_hotkey(&game_config.HotkeyQuickSaveState); - } - - void set_game_specific_hotkey_toggle_full_screen() - { - obtain_hotkey(&game_config.HotkeyToggleFullScreen); - } - -#define HOTKEY_CONTENT_X 156 - void hotkey_option_passive_common(u32 HotkeyBitfield) - { - unsigned short color; - char tmp_buf[512]; - unsigned int len; - - if(display_option == current_option) - color= COLOR_ACTIVE_ITEM; - else - color= COLOR_INACTIVE_ITEM; - - strcpy(tmp_buf, *(display_option->display_string)); - PRINT_STRING_BG(down_screen_addr, tmp_buf, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y); - - // Construct a UTF-8 string showing the buttons in the - // bitfield. - tmp_buf[0] = '\0'; - if (HotkeyBitfield & KEY_L) strcpy(tmp_buf, HOTKEY_L_DISPLAY); - if (HotkeyBitfield & KEY_R) strcat(tmp_buf, HOTKEY_R_DISPLAY); - if (HotkeyBitfield & KEY_A) strcat(tmp_buf, HOTKEY_A_DISPLAY); - if (HotkeyBitfield & KEY_B) strcat(tmp_buf, HOTKEY_B_DISPLAY); - if (HotkeyBitfield & KEY_Y) strcat(tmp_buf, HOTKEY_Y_DISPLAY); - if (HotkeyBitfield & KEY_X) strcat(tmp_buf, HOTKEY_X_DISPLAY); - if (HotkeyBitfield & KEY_START) strcat(tmp_buf, HOTKEY_START_DISPLAY); - if (HotkeyBitfield & KEY_SELECT) strcat(tmp_buf, HOTKEY_SELECT_DISPLAY); - if (HotkeyBitfield & KEY_UP) strcat(tmp_buf, HOTKEY_UP_DISPLAY); - if (HotkeyBitfield & KEY_DOWN) strcat(tmp_buf, HOTKEY_DOWN_DISPLAY); - if (HotkeyBitfield & KEY_LEFT) strcat(tmp_buf, HOTKEY_LEFT_DISPLAY); - if (HotkeyBitfield & KEY_RIGHT) strcat(tmp_buf, HOTKEY_RIGHT_DISPLAY); - - PRINT_STRING_BG(down_screen_addr, tmp_buf, color, COLOR_TRANS, HOTKEY_CONTENT_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y); - } - - void global_hotkey_return_to_menu_passive() - { - hotkey_option_passive_common(emu_config.HotkeyReturnToMenu); - } - - void global_hotkey_temporary_fast_forward_passive() - { - hotkey_option_passive_common(emu_config.HotkeyTemporaryFastForward); - } - - void global_hotkey_toggle_sound_passive() - { - hotkey_option_passive_common(emu_config.HotkeyToggleSound); - } - - void global_hotkey_quick_load_state_passive() - { - hotkey_option_passive_common(emu_config.HotkeyQuickLoadState); - } - - void global_hotkey_quick_save_state_passive() - { - hotkey_option_passive_common(emu_config.HotkeyQuickSaveState); - } - - void global_hotkey_toggle_full_screen_passive() - { - hotkey_option_passive_common(emu_config.HotkeyToggleFullScreen); - } - - void game_specific_hotkey_return_to_menu_passive() - { - hotkey_option_passive_common(game_config.HotkeyReturnToMenu); - } - - void game_specific_hotkey_temporary_fast_forward_passive() - { - hotkey_option_passive_common(game_config.HotkeyTemporaryFastForward); - } - - void game_specific_hotkey_toggle_sound_passive() - { - hotkey_option_passive_common(game_config.HotkeyToggleSound); - } - - void game_specific_hotkey_quick_load_state_passive() - { - hotkey_option_passive_common(game_config.HotkeyQuickLoadState); - } - - void game_specific_hotkey_quick_save_state_passive() - { - hotkey_option_passive_common(game_config.HotkeyQuickSaveState); - } - - void game_specific_hotkey_toggle_full_screen_passive() - { - hotkey_option_passive_common(game_config.HotkeyToggleFullScreen); - } - - int lastest_game_menu_scroll_value; - void latest_game_menu_init() - { - u32 k; - char *ext_pos; - - for(k= 0; k < 5; k++) - { - ext_pos= strrchr(emu_config.latest_file[k], '/'); - if(ext_pos != NULL) - hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + k * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX, - COLOR_TRANS, k + 1 == latest_game_menu.focus_option ? COLOR_ACTIVE_ITEM : COLOR_INACTIVE_ITEM, ext_pos+1); - else - break; - } - - if(k < 5) - { - latest_game_menu.num_options = k+1; - } - else - latest_game_menu.num_options = 6; - - latest_game_menu.num_options = k+1; - - for(; k < 5; k++) - { - latest_game_options[k+1].option_type |= HIDEN_TYPE; - } - - lastest_game_menu_scroll_value = 0; - } - - void latest_game_menu_passive() - { - u32 k; - //draw background - show_icon(down_screen_addr, &ICON_SUBBG, 0, 0); - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - - if(current_option_num == 0) - show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y); - else - { - show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y); - show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + SUBSELA_OFFSET_Y); - } - - strcpy(line_buffer, *(display_option->display_string)); - draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer); - - for(k= 0; k<5; k++) - if(emu_config.latest_file[k][0] != '\0') - { - if(current_option_num != k+1) - draw_hscroll(k, 0); - else - { - draw_hscroll(k, lastest_game_menu_scroll_value); - lastest_game_menu_scroll_value = 0; - } - } - } - - void latest_game_menu_end() - { - u32 k; - - for(k= 0; k < 5; k++) - { - if(emu_config.latest_file[k][0] != '\0') - draw_hscroll_over(k); - } - } - - void latest_game_menu_key() - { - char *ext_pos; - - switch(gui_action) - { - case CURSOR_DOWN: - //clear last option's bg - if(current_option_num != 0) - { - draw_hscroll_over(current_option_num-1); - ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX, - COLOR_TRANS, COLOR_INACTIVE_ITEM, ext_pos+1); - } - - current_option_num += 1; - if(current_option_num >= latest_game_menu.num_options) - current_option_num = 0; - current_option = current_menu->options + current_option_num; - - //Set current bg - if(current_option_num != 0) - { - draw_hscroll_over(current_option_num-1); - ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX, - COLOR_TRANS, COLOR_ACTIVE_ITEM, ext_pos+1); - } - - break; - - case CURSOR_UP: - //clear last option's bg - if(current_option_num != 0) - { - draw_hscroll_over(current_option_num-1); - ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX, - COLOR_TRANS, COLOR_INACTIVE_ITEM, ext_pos+1); - } - - if(current_option_num > 0) current_option_num -= 1; - else current_option_num = latest_game_menu.num_options -1; - current_option = current_menu->options + current_option_num; - - //Set current bg - if(current_option_num != 0) - { - draw_hscroll_over(current_option_num-1); - ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX, - COLOR_TRANS, COLOR_ACTIVE_ITEM, ext_pos+1); - } - - break; - - case CURSOR_RIGHT: - lastest_game_menu_scroll_value = -5; - break; - - case CURSOR_LEFT: - lastest_game_menu_scroll_value = 5; - break; - - default: - break; - }// end swith - } - - void load_lastest_played() - { - char *ext_pos; - - if(bg_screenp != NULL) { - bg_screenp_color = COLOR16(43, 11, 11); - } - else - bg_screenp_color = COLOR_BG; - - ext_pos= strrchr(emu_config.latest_file[current_option_num -1], '/'); - *ext_pos= '\0'; - strcpy(rom_path, emu_config.latest_file[current_option_num -1]); - *ext_pos= '/'; - - ext_pos = emu_config.latest_file[current_option_num -1]; - - LoadGameAndItsData(ext_pos); - - get_newest_savestate(tmp_filename); - if(tmp_filename[0] != '\0') - { - load_state(tmp_filename); - } - } - - void game_fastforward() - { - } - - - - void reload_cheats_page() - { - for(i = 0; i < CHEATS_PER_PAGE; i++) - { - cheats_options[i+1].display_string = &cheat_data_ptr[(CHEATS_PER_PAGE * menu_cheat_page) + i]; - } - } - - void others_menu_init() - { -#ifdef ENABLE_FREE_SPACE - unsigned int total, used; - - //get card space info - freespace = 0; - fat_getDiskSpaceInfo("fat:", &total, &used, &freespace); -#endif - } - - void choose_menu(MENU_TYPE *new_menu) - { - if(new_menu == NULL) - new_menu = &main_menu; - - if(NULL != current_menu) { - if(current_menu->end_function) - current_menu->end_function(); - SaveConfigsIfNeeded(); - current_menu->focus_option = current_menu->screen_focus = current_option_num; - } - - current_menu = new_menu; - current_option_num= current_menu -> focus_option; - current_option = new_menu->options + current_option_num; - PreserveConfigs(); - if(current_menu->init_function) - current_menu->init_function(); - } - -//----------------------------------------------------------------------------// -// Menu Start - LowFrequencyCPU(); - if (!FirstInvocation) - { // assume that the backlight is already at 3 when the emulator starts - mdelay(100); // to prevent ds2_setBacklight() from crashing - ds2_setBacklight(3); - // also allow the user to press A for New Game right away - wait_Allkey_release(0); - } - - bg_screenp= (u16*)malloc(256*192*2); - - repeat = 1; - - if(gamepak_name[0] == 0) - { - first_load = 1; - //try auto loading games passed through argv first - if(strlen(argv[1]) > 0 && LoadGameAndItsData(argv[1])) - repeat = 0; - else - { - ds2_clearScreen(UP_SCREEN, COLOR_BLACK); - draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); - } - } - else - { - copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(UP_SCREEN, 1); - copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(UP_SCREEN, 1); - } - - choose_menu(&main_menu); - -// Menu loop - - while(repeat) - { - display_option = current_menu->options; - string_select= 0; - - if(current_menu -> passive_function) - current_menu -> passive_function(); - else - { - u32 line_num, screen_focus, focus_option; - - //draw background - show_icon(down_screen_addr, &ICON_SUBBG, 0, 0); - show_icon(down_screen_addr, &ICON_TITLE, 0, 0); - show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y); - - strcpy(line_buffer, *(display_option->display_string)); - draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer); - - line_num = current_option_num; - screen_focus = current_menu -> screen_focus; - focus_option = current_menu -> focus_option; - - if(focus_option < line_num) //focus next option - { - focus_option = line_num - focus_option; - screen_focus += focus_option; - if(screen_focus > SUBMENU_ROW_NUM) //Reach max row numbers can display - screen_focus = SUBMENU_ROW_NUM; - - current_menu -> screen_focus = screen_focus; - focus_option = line_num; - } - else if(focus_option > line_num) //focus last option - { - focus_option = focus_option - line_num; - if(screen_focus > focus_option) - screen_focus -= focus_option; - else - screen_focus = 0; - - if(screen_focus == 0 && line_num > 0) - screen_focus = 1; - - current_menu -> screen_focus = screen_focus; - focus_option = line_num; - } - current_menu -> focus_option = focus_option; - - i = focus_option - screen_focus; - display_option += i +1; - - line_num = current_menu->num_options-1; - if(line_num > SUBMENU_ROW_NUM) - line_num = SUBMENU_ROW_NUM; - - if(focus_option == 0) - show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y); - else - show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y); - - for(i= 0; i < line_num; i++, display_option++) - { - unsigned short color; - - if(display_option == current_option) - show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + i * GUI_ROW_SY + SUBSELA_OFFSET_Y); - - if(display_option->passive_function) - { - display_option->line_number = i; - display_option->passive_function(); - } - else if(display_option->option_type & NUMBER_SELECTION_TYPE) - { - sprintf(line_buffer, *(display_option->display_string), - *(display_option->current_option)); - } - else if(display_option->option_type & STRING_SELECTION_TYPE) - { - sprintf(line_buffer, *(display_option->display_string), - *((u32*)(((u32 *)display_option->options)[*(display_option->current_option)]))); - } - else - { - strcpy(line_buffer, *(display_option->display_string)); - } - - if(display_option->passive_function == NULL) - { - if(display_option == current_option) - color= COLOR_ACTIVE_ITEM; - else - color= COLOR_INACTIVE_ITEM; - - PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + i * GUI_ROW_SY + TEXT_OFFSET_Y); - } - } - } - - mdelay(20); // to prevent the DSTwo-DS link from being too clogged - // to return button statuses - - struct key_buf inputdata; - gui_action = get_gui_input(); - - switch(gui_action) - { - case CURSOR_TOUCH: - ds2_getrawInput(&inputdata); - wait_Allkey_release(0); - /* Back button at the top of every menu but the main one */ - if(current_menu != &main_menu && inputdata.x >= BACK_BUTTON_X && inputdata.y < BACK_BUTTON_Y + ICON_BACK.y) - { - choose_menu(current_menu->options->sub_menu); - break; - } - /* Main menu */ - if(current_menu == &main_menu) - { - // 0 86 172 256 - // _____ _____ _____ 0 - // |0VID_|1SAV_|2CHT_| 80 - // |3TLS_|4OPT_|5EXI_| 160 - // |6NEW_|7RET_|8RST_| 192 - - current_option_num = (inputdata.y / 80) * 3 + (inputdata.x / 86); - current_option = current_menu->options + current_option_num; - - if(current_option -> option_type & HIDEN_TYPE) - break; - else if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - } - /* This is the majority case, covering all menus except save states (and deletion thereof) */ - else if(current_menu != (main_menu.options + 1)->sub_menu - && current_menu != ((main_menu.options +1)->sub_menu->options + 3)->sub_menu) - { - if (inputdata.y < GUI_ROW1_Y || inputdata.y >= GUI_ROW1_Y + SUBMENU_ROW_NUM * GUI_ROW_SY) - break; - // ___ 33 This screen has 6 possible rows. Touches - // ___ 60 above or below these are ignored. - // . . . (+27) The row between 33 and 60 is [1], though! - // ___ 192 - u32 next_option_num = (inputdata.y - GUI_ROW1_Y) / GUI_ROW_SY + 1; - struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num; - - if (next_option_num >= current_menu->num_options) - break; - - if(!next_option) - break; - - if(next_option -> option_type & HIDEN_TYPE) - break; - - current_option_num = next_option_num; - current_option = current_menu->options + current_option_num; - - if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE)) - { - gui_action = CURSOR_RIGHT; - u32 current_option_val = *(current_option->current_option); - - if(current_option_val < current_option->num_options -1) - current_option_val++; - else - current_option_val= 0; - *(current_option->current_option) = current_option_val; - - if(current_option->action_function) - current_option->action_function(); - } - else if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_menu->key_function) - { - gui_action = CURSOR_RIGHT; - current_menu->key_function(); - } - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - } - /* Save states */ - else if(current_menu == (main_menu.options + 1)->sub_menu) - { - u32 next_option_num; - if(inputdata.y < GUI_ROW1_Y + 1 * GUI_ROW_SY) - break; // "Create saved state" - else if(inputdata.y < GUI_ROW1_Y + 2 * GUI_ROW_SY) // Save cell - next_option_num = 1; - else if(inputdata.y < GUI_ROW1_Y + 3 * GUI_ROW_SY) - break; // "Load saved state" - else if(inputdata.y < GUI_ROW1_Y + 4 * GUI_ROW_SY) // Load cell - next_option_num = 2; - else if(inputdata.y < GUI_ROW1_Y + 5 * GUI_ROW_SY) // Del... - next_option_num = 3; - else - break; - - struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num; - - if(next_option_num == 1 /* write */ || next_option_num == 2 /* read */) - { - u32 current_option_val = *(next_option->current_option); - u32 old_option_val = current_option_val; - - // This row has SAVE_STATE_SLOT_NUM cells for save states, each ICON_STATEFULL.x pixels wide. - // The left side of a square is at SavedStateSquareX(slot). - bool8 found_state = FALSE; - int i; - for (i = 0; i < SAVE_STATE_SLOT_NUM; i++) - { - uint8 StartX = SavedStateSquareX (i); - if (inputdata.x >= StartX && inputdata.x < StartX + ICON_STATEFULL.x) - { - current_option_val = i; - found_state = TRUE; - break; - } - } - if(!found_state) - break; - - current_option_num = next_option_num; - current_option = next_option; - - *(current_option->current_option) = current_option_val; - - if(current_option_val == old_option_val) - { - gui_action = CURSOR_SELECT; - if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - } - else - { - // Initial selection of a saved state - // needs to show its screenshot - if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - } - break; - } - - gui_action = CURSOR_SELECT; - if(next_option -> option_type & HIDEN_TYPE) - break; - - current_option_num = next_option_num; - current_option = next_option; - - if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - } - /* Delete state sub menu */ - else if(current_menu == ((main_menu.options + 1)->sub_menu->options + 3)->sub_menu) - { - u32 next_option_num; - if(inputdata.y < GUI_ROW1_Y + 1 * GUI_ROW_SY) - break; - else if(inputdata.y < GUI_ROW1_Y + 2 * GUI_ROW_SY) - next_option_num = 1; - else if(inputdata.y < GUI_ROW1_Y + 3 * GUI_ROW_SY) - next_option_num = 2; - else - break; - - struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num; - - if(next_option_num == 1) - { - u32 current_option_val = *(next_option->current_option); - u32 old_option_val = current_option_val; - - // This row has SAVE_STATE_SLOT_NUM cells for save states, each ICON_STATEFULL.x pixels wide. - // The left side of a square is at SavedStateSquareX(slot). - bool8 found_state = FALSE; - int i; - for (i = 0; i < SAVE_STATE_SLOT_NUM; i++) - { - uint8 StartX = SavedStateSquareX (i); - if (inputdata.x >= StartX && inputdata.x < StartX + ICON_STATEFULL.x) - { - current_option_val = i; - found_state = TRUE; - break; - } - } - if(!found_state) - break; - - current_option_num = next_option_num; - current_option = next_option; - - *(current_option->current_option) = current_option_val; - - if(current_option_val == old_option_val) - { - gui_action = CURSOR_SELECT; - if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - } - break; - } - - gui_action = CURSOR_SELECT; - if(next_option -> option_type & HIDEN_TYPE) - break; - - current_option_num = next_option_num; - current_option = next_option; - - if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - } - break; - case CURSOR_DOWN: - if(current_menu->key_function) - current_menu->key_function(); - else - { - current_option_num = (current_option_num + 1) % current_menu->num_options; - current_option = current_menu->options + current_option_num; - - while(current_option -> option_type & HIDEN_TYPE) - { - current_option_num = (current_option_num + 1) % current_menu->num_options; - current_option = current_menu->options + current_option_num; - } - } - break; - - case CURSOR_UP: - if(current_menu->key_function) - current_menu->key_function(); - else - { - if(current_option_num) - current_option_num--; - else - current_option_num = current_menu->num_options - 1; - current_option = current_menu->options + current_option_num; - - while(current_option -> option_type & HIDEN_TYPE) - { - if(current_option_num) - current_option_num--; - else - current_option_num = current_menu->num_options - 1; - current_option = current_menu->options + current_option_num; - } - } - break; - - case CURSOR_RIGHT: - if(current_menu->key_function) - current_menu->key_function(); - else - { - if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE)) - { - u32 current_option_val = *(current_option->current_option); - - if(current_option_val < current_option->num_options -1) - current_option_val++; - else - current_option_val= 0; - *(current_option->current_option) = current_option_val; - - if(current_option->action_function) - current_option->action_function(); - } - } - break; - - case CURSOR_LEFT: - if(current_menu->key_function) - current_menu->key_function(); - else - { - if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE)) - { - u32 current_option_val = *(current_option->current_option); - - if(current_option_val) - current_option_val--; - else - current_option_val = current_option->num_options - 1; - *(current_option->current_option) = current_option_val; - - if(current_option->action_function) - current_option->action_function(); - } - } - break; - - case CURSOR_EXIT: - wait_Allkey_release(0); - break; - - case CURSOR_SELECT: - wait_Allkey_release(0); - if(current_option->option_type & ACTION_TYPE) - current_option->action_function(); - else if(current_option->option_type & SUBMENU_TYPE) - choose_menu(current_option->sub_menu); - break; - - case CURSOR_BACK: - wait_Allkey_release(0); - if(current_menu != &main_menu) - choose_menu(current_menu->options->sub_menu); - else - menu_return(); - break; - - default: - break; - } // end swith - - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - } // end while - - if (current_menu && current_menu->end_function) - current_menu->end_function(); - SaveConfigsIfNeeded(); - - if(bg_screenp != NULL) free((void*)bg_screenp); - - void* screen_addr; - SCREEN_ID screen_num; - if (emu_config.BottomScreenGame) - { - screen_addr = down_screen_addr; - screen_num = DOWN_SCREEN; - ds2_clearScreen(UP_SCREEN, 0); - ds2_flipScreen(UP_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - } - else - { - screen_addr = up_screen_addr; - screen_num = UP_SCREEN; - ds2_clearScreen(DOWN_SCREEN, 0); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - } - - copy_screen(screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD); - copy_screen(screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD); - wait_Allkey_release(0); - - mdelay(100); // to prevent ds2_setBacklight() from crashing - ds2_setBacklight(3 - screen_num); - - GameFrequencyCPU(); - - return return_value; -} - -/*-------------------------------------------------------- - Initialize default path ---------------------------------------------------------*/ -void initial_path_config(void) -{ - //Initial directory path - sprintf(g_default_rom_dir, "%s/gamepak", main_path); - sprintf(DEFAULT_RTS_DIR, "%s/gamerts", main_path); - sprintf(DEFAULT_CFG_DIR, "%s/gamerts", main_path); - sprintf(DEFAULT_SS_DIR, "%s/gamepic", main_path); - sprintf(DEFAULT_CHEAT_DIR, "%s/gamecht", main_path); -} - -/*-------------------------------------------------------- - Load language message ---------------------------------------------------------*/ -int load_language_msg(char *filename, u32 language) -{ - FILE *fp; - char msg_path[MAX_PATH]; - char string[256]; - char start[32]; - char end[32]; - char *pt, *dst; - u32 loop, offset, len; - int ret; - - sprintf(msg_path, "%s/%s", main_path, filename); - fp = fopen(msg_path, "rb"); - if(fp == NULL) - return -1; - - switch(language) - { - case ENGLISH: - default: - strcpy(start, "STARTENGLISH"); - strcpy(end, "ENDENGLISH"); - break; - case CHINESE_SIMPLIFIED: - strcpy(start, "STARTCHINESESIM"); - strcpy(end, "ENDCHINESESIM"); - break; - case FRENCH: - strcpy(start, "STARTFRENCH"); - strcpy(end, "ENDFRENCH"); - break; - case GERMAN: - strcpy(start, "STARTGERMAN"); - strcpy(end, "ENDGERMAN"); - break; - case DUTCH: - strcpy(start, "STARTDUTCH"); - strcpy(end, "ENDDUTCH"); - break; - case SPANISH: - strcpy(start, "STARTSPANISH"); - strcpy(end, "ENDSPANISH"); - break; - case ITALIAN: - strcpy(start, "STARTITALIAN"); - strcpy(end, "ENDITALIAN"); - break; - case PORTUGUESE_BRAZILIAN: - strcpy(start, "STARTPORTUGUESEBR"); - strcpy(end, "ENDPORTUGUESEBR"); - break; - } - u32 cmplen = strlen(start); - - //find the start flag - ret= 0; - while(1) - { - pt= fgets(string, 256, fp); - if(pt == NULL) - { - ret= -2; - goto load_language_msg_error; - } - - if(!strncmp(pt, start, cmplen)) - break; - } - - loop= 0; - offset= 0; - dst= msg_data; - msg[0]= dst; - - while(loop != MSG_END) - { - while(1) - { - pt = fgets(string, 256, fp); - if(pt[0] == '#' || pt[0] == '\r' || pt[0] == '\n') - continue; - if(pt != NULL) - break; - else - { - ret = -3; - goto load_language_msg_error; - } - } - - if(!strncmp(pt, end, cmplen-2)) - break; - - len= strlen(pt); - // memcpy(dst, pt, len); - - // Replace key definitions (*letter) with Pictochat icons - // while copying. - unsigned int srcChar, dstLen = 0; - for (srcChar = 0; srcChar < len; srcChar++) - { - if (pt[srcChar] == '*') - { - switch (pt[srcChar + 1]) - { - case 'A': - memcpy(&dst[dstLen], HOTKEY_A_DISPLAY, sizeof (HOTKEY_A_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_A_DISPLAY) - 1; - break; - case 'B': - memcpy(&dst[dstLen], HOTKEY_B_DISPLAY, sizeof (HOTKEY_B_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_B_DISPLAY) - 1; - break; - case 'X': - memcpy(&dst[dstLen], HOTKEY_X_DISPLAY, sizeof (HOTKEY_X_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_X_DISPLAY) - 1; - break; - case 'Y': - memcpy(&dst[dstLen], HOTKEY_Y_DISPLAY, sizeof (HOTKEY_Y_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_Y_DISPLAY) - 1; - break; - case 'L': - memcpy(&dst[dstLen], HOTKEY_L_DISPLAY, sizeof (HOTKEY_L_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_L_DISPLAY) - 1; - break; - case 'R': - memcpy(&dst[dstLen], HOTKEY_R_DISPLAY, sizeof (HOTKEY_R_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_R_DISPLAY) - 1; - break; - case 'S': - memcpy(&dst[dstLen], HOTKEY_START_DISPLAY, sizeof (HOTKEY_START_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_START_DISPLAY) - 1; - break; - case 's': - memcpy(&dst[dstLen], HOTKEY_SELECT_DISPLAY, sizeof (HOTKEY_SELECT_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_SELECT_DISPLAY) - 1; - break; - case 'u': - memcpy(&dst[dstLen], HOTKEY_UP_DISPLAY, sizeof (HOTKEY_UP_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_UP_DISPLAY) - 1; - break; - case 'd': - memcpy(&dst[dstLen], HOTKEY_DOWN_DISPLAY, sizeof (HOTKEY_DOWN_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_DOWN_DISPLAY) - 1; - break; - case 'l': - memcpy(&dst[dstLen], HOTKEY_LEFT_DISPLAY, sizeof (HOTKEY_LEFT_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_LEFT_DISPLAY) - 1; - break; - case 'r': - memcpy(&dst[dstLen], HOTKEY_RIGHT_DISPLAY, sizeof (HOTKEY_RIGHT_DISPLAY) - 1); - srcChar++; - dstLen += sizeof (HOTKEY_RIGHT_DISPLAY) - 1; - break; - case '\0': - dst[dstLen] = pt[srcChar]; - dstLen++; - break; - default: - memcpy(&dst[dstLen], &pt[srcChar], 2); - srcChar++; - dstLen += 2; - break; - } - } - else - { - dst[dstLen] = pt[srcChar]; - dstLen++; - } - } - - dst += dstLen; - //at a line return, when "\n" paded, this message not end - if(*(dst-1) == 0x0A) - { - pt = strrchr(pt, '\\'); - if((pt != NULL) && (*(pt+1) == 'n')) - { - if(*(dst-2) == 0x0D) - { - *(dst-4)= '\n'; - dst -= 3; - } - else - { - *(dst-3)= '\n'; - dst -= 2; - } - } - else//a message end - { - if(*(dst-2) == 0x0D) - dst -= 1; - *(dst-1) = '\0'; - msg[++loop] = dst; - } - } - } - - #if 0 - loop= 0; - printf("------\n"); - while(loop != MSG_END) - printf("%d: %s\n",loop, msg[loop++]); - #endif - -load_language_msg_error: - fclose(fp); - return ret; -} - -/*-------------------------------------------------------- ---------------------------------------------------------*/ - - -/*-------------------------------------------------------- - Load font library ---------------------------------------------------------*/ -u32 load_font() -{ - return (u32)BDF_font_init(); -} - -/*-------------------------------------------------------- - Game configure initialize ---------------------------------------------------------*/ -void init_game_config(void) -{ - game_config.clock_speed_number = 5; // 396 MHz by default - game_config.graphic = 3; // By default, have a good-looking aspect ratio - game_config.frameskip_value = 0; // Automatic frame skipping - game_config.SoundSync = 0; // Prefer fluid images by default - game_config.RetroSound = 0; // Correct sound by default (else 8-bit) - - game_config.backward = 0; //time backward disable - game_config.backward_time = 2; //time backward granularity 1s - - savestate_index= 0; -} - -/*-------------------------------------------------------- - Emulator configure initialize ---------------------------------------------------------*/ -void init_emulator_config(void) -{ - emu_config.language = 0; //defalut language= English - - emu_config.rom_file[0]= 0; - emu_config.rom_path[0]= 0; - memset(emu_config.latest_file, 0, sizeof(emu_config.latest_file)); - - gamepak_name[0] = '\0'; -} - -/*-------------------------------------------------------- - Load game configure file ---------------------------------------------------------*/ -void load_game_config_file(void) -{ - char game_config_filename[MAX_PATH]; - FILE* fp; - char *pt; - - //Set default - init_game_config(); - - sprintf(game_config_filename, "%s/%s", DEFAULT_CFG_DIR, gamepak_name); - pt= strrchr(game_config_filename, '.'); - if(NULL == pt) - goto finalise; - *pt= 0; - strcat(game_config_filename, "_0.rts"); - - fp = fopen(game_config_filename, "r"); - if(NULL == fp) - goto finalise; - - //Check file header - pt= game_config_filename; - fread(pt, 1, GAME_CONFIG_HEADER_SIZE, fp); - - if (!strncmp(pt, GAME_CONFIG_HEADER, GAME_CONFIG_HEADER_SIZE)) - { - fread(&game_config, 1, sizeof(GAME_CONFIG), fp); - } - - fclose(fp); - -finalise: ; - game_set_frameskip(); - game_set_fluidity(); - game_set_retro(); -} - -/*-------------------------------------------------------- - Load emulator configure file ---------------------------------------------------------*/ -int load_emu_config_file(void) -{ - char tmp_path[MAX_PATH]; - FILE* fp; - char *pt; - - sprintf(tmp_path, "%s/%s", main_path, EMU_CONFIG_FILENAME); - - fp = fopen(tmp_path, "r"); - if(NULL != fp) - { - // check the file header - pt= tmp_path; - fread(pt, 1, EMU_CONFIG_HEADER_SIZE, fp); - pt[EMU_CONFIG_HEADER_SIZE]= 0; - if(!strcmp(pt, EMU_CONFIG_HEADER)) - { - memset(&emu_config, 0, sizeof(emu_config)); - fread(&emu_config, 1, sizeof(emu_config), fp); - fclose(fp); - return 0; - } - else - { - fclose(fp); - } - } - - //have no confiure file, set default - init_emulator_config(); - return -1; -} - -/*-------------------------------------------------------- - Save game configure file ---------------------------------------------------------*/ -int save_game_config_file(void) -{ - char game_config_filename[MAX_PATH]; - FILE* fp; - char *pt; - - if(gamepak_name[0] == 0) return -1; - - sprintf(game_config_filename, "%s/%s", DEFAULT_CFG_DIR, gamepak_name); - pt = strrchr(game_config_filename, '.'); - if(NULL == pt) - return -1; - - *pt = '\0'; - strcat(pt, "_0.rts"); - - fp = fopen(game_config_filename, "w"); - if(NULL != fp) - { - fwrite(GAME_CONFIG_HEADER, 1, GAME_CONFIG_HEADER_SIZE, fp); - fwrite(&game_config, 1, sizeof(game_config), fp); - fclose(fp); - return 0; - } - - return -1; -} - -/*-------------------------------------------------------- - Save emulator confiure file ---------------------------------------------------------*/ -int save_emu_config_file() -{ - char tmp_path[MAX_PATH]; - FILE* fp; - - sprintf(tmp_path, "%s/%s", main_path, EMU_CONFIG_FILENAME); - fp = fopen(tmp_path, "w"); - if(NULL != fp) - { - fwrite(EMU_CONFIG_HEADER, 1, EMU_CONFIG_HEADER_SIZE, fp); - fwrite(&emu_config, 1, sizeof(emu_config), fp); - fclose(fp); - return 0; - } - - return -1; -} - -/*-------------------------------------------------------- - Reorder latest player game recorder ---------------------------------------------------------*/ -void reorder_latest_file(void) -{ - s32 i, FoundIndex = -1; - - if(gamepak_name[0] == '\0') - return; - - // Is the file's name already here? - for (i = 0; i < 5; i++) - { - char* RecentFileName = strrchr(emu_config.latest_file[i], '/'); - if (RecentFileName) - { - if (strcasecmp(RecentFileName + 1, gamepak_name) == 0) - { - FoundIndex = i; // Yes. - break; - } - } - } - - if (FoundIndex > -1) - { - // Already here, move all of those until the existing one 1 down - memmove(emu_config.latest_file[1], - emu_config.latest_file[0], - FoundIndex * sizeof(emu_config.latest_file[0])); - } - else - { - // Not here, move everything down - memmove(emu_config.latest_file[1], - emu_config.latest_file[0], - 4 * sizeof(emu_config.latest_file[0])); - } - - //Removing rom_path due to confusion, replacing with g_default_rom_dir - sprintf(emu_config.latest_file[0], "%s/%s", g_default_rom_dir, gamepak_name); -} - -/*-------------------------------------------------------- - Save state related ---------------------------------------------------------*/ -static int rtc_time_cmp(struct rtc *t1, struct rtc *t2) -{ - int result; - - result= (int)((unsigned int)(t1 -> year) - (unsigned int)(t2 -> year)); - if(result != 0) - return result; - result= (int)((unsigned int)(t1 -> month) - (unsigned int)(t2 -> month)); - if(result != 0) - return result; - result= (int)((unsigned int)(t1 -> day) - (unsigned int)(t2 -> day)); - if(result != 0) - return result; - result= (int)((unsigned int)(t1 -> weekday) - (unsigned int)(t2 -> weekday)); - if(result != 0) - return result; - result= (int)((unsigned int)(t1 -> hours) - (unsigned int)(t2 -> hours)); - if(result != 0) - return result; - result= (int)((unsigned int)(t1 -> minutes) - (unsigned int)(t2 -> minutes)); - if(result != 0) - return result; - result= (int)((unsigned int)(t1 -> seconds) - (unsigned int)(t2 -> seconds)); -// if(result != 0) - return result; -} - -static void get_savestate_filelist(void) -{ - int i; - char savestate_path[MAX_PATH]; - char postdrix[8]; - char *pt; - FILE *fp; - unsigned int n, m; - // Which is the latest? - /* global */ latest_save = -1; - struct rtc latest_save_time, current_time; - memset(&latest_save_time, 0, sizeof (struct rtc)); - - sprintf(savestate_path, "%s/%s", DEFAULT_RTS_DIR, gamepak_name); - pt= strrchr(savestate_path, '.'); - for(i= 0; i < SAVE_STATE_SLOT_NUM; i++) - { - sprintf(postdrix, "_%d.rts", i+1); - strcpy(pt, postdrix); - - fp= fopen(savestate_path, "r"); - if (fp != NULL) - { - SavedStateExistenceCache [i] = TRUE; - m = fread((void*)&n, 1, 4, fp); - if(m < 4) { - fclose(fp); - continue; - } - - fseek(fp, n, SEEK_SET); - /* Read back the time stamp */ - fread((char*)¤t_time, 1, sizeof(struct rtc), fp); - if (rtc_time_cmp (¤t_time, &latest_save_time) > 0) - { - latest_save = i; - latest_save_time = current_time; - } - fclose(fp); - } - else - SavedStateExistenceCache [i] = FALSE; - - SavedStateExistenceCached [i] = TRUE; - } - - if(latest_save < 0) - savestate_index = 0; - else - savestate_index = latest_save; -} - -static void get_savestate_filename(u32 slot, char *name_buffer) -{ - char savestate_ext[16]; - char *pt; - - sprintf(savestate_ext, "_%d.rts", slot+1); - pt = strrchr(gamepak_name, '/'); - if(NULL == pt) - pt = gamepak_name; - else - pt += 1; - - change_ext(pt, name_buffer, savestate_ext); -} - -uint8 SavedStateSquareX (u32 slot) -{ - return (SCREEN_WIDTH * (slot + 1) / (SAVE_STATE_SLOT_NUM + 1)) - - ICON_STATEFULL.x / 2; -} - -bool8 SavedStateFileExists (u32 slot) -{ - if (SavedStateExistenceCached [slot]) - return SavedStateExistenceCache [slot]; - - char BaseName [_MAX_PATH + 1]; - char FullName [_MAX_PATH + 1]; - get_savestate_filename(slot, BaseName); - sprintf(FullName, "%s/%s", DEFAULT_RTS_DIR, BaseName); - FILE *SavedStateFile = fopen(FullName, "r"); - bool8 Result = SavedStateFile != NULL; - if (Result) - { - fclose(SavedStateFile); - } - SavedStateExistenceCache [slot] = Result; - SavedStateExistenceCached [slot] = TRUE; - return Result; -} - -void SavedStateCacheInvalidate (void) -{ - int i; - for (i = 0; i < SAVE_STATE_SLOT_NUM; i++) - SavedStateExistenceCached [i] = FALSE; -} - -void QuickLoadState (void) -{ - char BaseName[MAX_PATH + 1]; - get_savestate_filename(0, BaseName); - SCREEN_ID screen_num = emu_config.BottomScreenGame - ? DOWN_SCREEN - : UP_SCREEN; - - mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight((3 - DOWN_SCREEN) | (3 - screen_num)); - - ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0)); - draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - HighFrequencyCPU(); - int flag = load_state(BaseName); - GameFrequencyCPU(); - if(0 != flag) - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]); - mdelay(500); // let the failure show - } - - SavedStateCacheInvalidate (); - - ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0)); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(3 - screen_num); -} - -void QuickSaveState (void) -{ - char BaseName[MAX_PATH + 1]; - get_savestate_filename(0, BaseName); - void* screen_addr = emu_config.BottomScreenGame - ? down_screen_addr - : up_screen_addr; - SCREEN_ID screen_num = emu_config.BottomScreenGame - ? DOWN_SCREEN - : UP_SCREEN; - - S9xDeinitUpdate(256, 224, TRUE); - unsigned short screen[256*192]; - copy_screen((void*)screen, screen_addr, 0, 0, 256, 192); - - mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight((3 - DOWN_SCREEN) | (3 - screen_num)); - - ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0)); - draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0); - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - HighFrequencyCPU(); - int flag = save_state(BaseName, screen); - GameFrequencyCPU(); - if(flag < 0) - { - draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]); - mdelay(500); // let the failure show - } - - SavedStateCacheInvalidate (); - - ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0)); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(3 - screen_num); -} - -void ToggleFullScreen (void) -{ - if (game_config.graphic == 0 /* full-screen ugly */ - || game_config.graphic == 4 /* full-screen smoothed */) - game_config.graphic = 3 /* middle of the screen */; - else - game_config.graphic = 4 /* full-screen smoothed */; - save_game_config_file(); -} - -void get_newest_savestate(char *name_buffer) -{ - if (latest_save < 0) - { - name_buffer[0]= '\0'; - return; - } - - get_savestate_filename(latest_save, name_buffer); -} - -static void get_timestamp_string(char *buffer, u16 msg_id, u16 year, u16 mon, - u16 day, u16 wday, u16 hour, u16 min, u16 sec, u32 msec) -{ - char *weekday_strings[] = - { - "SUN", "MON", "TUE", "WED", "TUR", "FRI", "SAT" - }; - - sprintf(buffer, "%s %02d/%02d/%04d %02d:%02d:%02d", weekday_strings[wday], - day, mon, year, hour, min, sec); -} - -static u32 save_ss_bmp(u16 *image) -{ - static unsigned char header[] ={ 'B', 'M', 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0, 0x01, 0x00, - 0x00, 192, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00}; - - char ss_filename[MAX_FILE]; - char save_ss_path[MAX_PATH]; - struct rtc current_time; - char rgb_data[256*192*3]; - unsigned int x,y; - unsigned short col; - unsigned char r,g,b; - - change_ext(gamepak_name, ss_filename, "_"); - ds2_getTime(¤t_time); - sprintf(save_ss_path, "%s/%s%02d%02d%02d%02d%02d.bmp", DEFAULT_SS_DIR, ss_filename, - current_time.month, current_time.day, current_time.hours, current_time.minutes, current_time.seconds); - - for(y = 0; y < 192; y++) - { - for(x = 0; x < 256; x++) - { - col = image[x + y * 256]; - r = (col >> 10) & 0x1F; - g = (col >> 5) & 0x1F; - b = (col) & 0x1F; - - rgb_data[(191-y)*256*3+x*3+2] = b << 3; - rgb_data[(191-y)*256*3+x*3+1] = g << 3; - rgb_data[(191-y)*256*3+x*3+0] = r << 3; - } - } - - FILE *ss = fopen( save_ss_path, "wb" ); - if( ss == NULL ) return 0; - fwrite( header, sizeof(header), 1, ss ); - fwrite( rgb_data, 1, 256*192*3, ss); - fclose( ss ); - - return 1; -} - -u32 save_menu_ss_bmp(u16 *image) -{ - static unsigned char header[] ={ 'B', 'M', 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 1, 0x00, /* <00 01> == 256 */ - 0x00, 192, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00}; - - char save_ss_path[MAX_PATH]; - struct rtc current_time; - unsigned char rgb_data[NDS_SCREEN_WIDTH*NDS_SCREEN_HEIGHT*3]; - int x,y; - unsigned short col; - unsigned char r,g,b; - - ds2_getTime(¤t_time); - sprintf(save_ss_path, "%s/%s%02d%02d%02d%02d%02d.bmp", DEFAULT_SS_DIR, "gui_", - current_time.month, current_time.day, - current_time.hours, current_time.minutes, current_time.seconds); - - for(y = 0; y < NDS_SCREEN_HEIGHT; y++) - { - for(x = 0; x < NDS_SCREEN_WIDTH; x++) - { - col = image[y * NDS_SCREEN_WIDTH + x]; - r = (col >> 10) & 0x1F; - g = (col >> 5) & 0x1F; - b = (col) & 0x1F; - - rgb_data[(NDS_SCREEN_HEIGHT-y-1)*NDS_SCREEN_WIDTH*3+x*3+2] = b << 3; - rgb_data[(NDS_SCREEN_HEIGHT-y-1)*NDS_SCREEN_WIDTH*3+x*3+1] = g << 3; - rgb_data[(NDS_SCREEN_HEIGHT-y-1)*NDS_SCREEN_WIDTH*3+x*3+0] = r << 3; - } - } - - FILE *ss = fopen( save_ss_path, "wb" ); - if( ss == NULL ) return 0; - fwrite( header, sizeof(header), 1, ss ); - fwrite( rgb_data, 1, sizeof(rgb_data), ss); - fclose( ss ); - - return 1; -} - -void quit(void) -{ -/* - u32 reg_ra; - - __asm__ __volatile__("or %0, $0, $ra" - : "=r" (reg_ra) - :); - - dbg_printf("return address= %08x\n", reg_ra); -*/ - -#ifdef USE_DEBUG - fclose(g_dbg_file); -#endif - - ds2_plug_exit(); - while(1); -} - -u32 file_length(FILE* file) -{ - u32 pos, size; - pos= ftell(file); - fseek(file, 0, SEEK_END); - size= ftell(file); - fseek(file, pos, SEEK_SET); - - return size; -} - -/* -* GUI Initialize -*/ -static bool Get_Args(char *file, char **filebuf){ - FILE* dat = fat_fopen(file, "rb"); - if(dat){ - int i = 0; - while(!fat_feof (dat)){ - fat_fgets(filebuf[i], 512, dat); - int len = strlen(filebuf[i]); - if(filebuf[i][len - 1] == '\n') - filebuf[i][len - 1] = '\0'; - i++; - } - - fat_fclose(dat); - fat_remove(file); - return i; - } - return 0; -} - -int CheckLoad_Arg(){ - argv[0][0] = '\0'; // Initialise the first byte to be a NULL in case - argv[1][0] = '\0'; // there are no arguments to avoid uninit. memory - char *argarray[2]; - argarray[0] = argv[0]; - argarray[1] = argv[1]; - - if(!Get_Args("/plgargs.dat", argarray)) - return 0; - - fat_remove("plgargs.dat"); - return 1; -} - -void gui_init(u32 lang_id) -{ - int flag; - - HighFrequencyCPU(); // Crank it up. When the menu starts, -> 0. - - // Start with no saved state existing, as no game is loaded yet. - int i; - for (i = 0; i < SAVE_STATE_SLOT_NUM; i++) - { - SavedStateExistenceCached [i] = TRUE; - SavedStateExistenceCached [i] = FALSE; - } - - //Find the "CATSFC" system directory - DIR *current_dir; - - if(CheckLoad_Arg()){ - //copy new folder location - strcpy(main_path, "fat:"); - strcat(main_path, argv[0]); - //strip off the binary name - char *endStr = strrchr(main_path, '/'); - *endStr = '\0'; - - //do a check to make sure the folder is a valid CATSFC folder - char tempPath[MAX_PATH]; - strcpy(tempPath, main_path); - strcat(tempPath, "/system/gui"); - DIR *testDir = opendir(tempPath); - if(!testDir) - //not a valid CATSFC install - strcpy(main_path, "fat:/CATSFC"); - else //test was successful, do nothing - closedir(testDir); - } - else - strcpy(main_path, "fat:/CATSFC"); - - current_dir = opendir(main_path); - if(current_dir) - closedir(current_dir); - else - { - strcpy(main_path, "fat:/_SYSTEM/PLUGINS/CATSFC"); - current_dir = opendir(main_path); - if(current_dir) - closedir(current_dir); - else - { - strcpy(main_path, "fat:"); - if(search_dir("CATSFC", main_path) == 0) - { - printf("Found CATSFC directory\nDossier CATSFC trouve\n\n%s\n", main_path); - } - else - { - err_msg(DOWN_SCREEN, "/CATSFC: Directory missing\nPress any key to return to\nthe menu\n\n/CATSFC: Dossier manquant\nAppuyer sur une touche pour\nretourner au menu"); - goto gui_init_err; - } - } - } - - show_log(down_screen_addr); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - - flag = icon_init(lang_id); - if(0 != flag) - { - err_msg(DOWN_SCREEN, "Some icons are missing\nLoad them onto your card\nPress any key to return to\nthe menu\n\nDes icones sont manquantes\nChargez-les sur votre carte\nAppuyer sur une touche pour\nretourner au menu"); - goto gui_init_err; - } - - flag = color_init(); - if(0 != flag) - { - char message[512]; - sprintf(message, "SYSTEM/GUI/uicolors.txt\nis missing\nPress any key to return to\nthe menu\n\nSYSTEM/GUI/uicolors.txt\nest manquant\nAppuyer sur une touche pour\nretourner au menu"); - err_msg(DOWN_SCREEN, message); - goto gui_init_err; - } - - flag = load_font(); - if(0 != flag) - { - char message[512]; - sprintf(message, "Font library initialisation\nerror (%d)\nPress any key to return to\nthe menu\n\nErreur d'initalisation de la\npolice de caracteres (%d)\nAppuyer sur une touche pour\nretourner au menu", flag, flag); - err_msg(DOWN_SCREEN, message); - goto gui_init_err; - } - - load_emu_config_file(); - lang_id = emu_config.language; - - flag = load_language_msg(LANGUAGE_PACK, lang_id); - if(0 != flag) - { - char message[512]; - sprintf(message, "Language pack initialisation\nerror (%d)\nPress any key to return to\nthe menu\n\nErreur d'initalisation du\npack de langue (%d)\nAppuyer sur une touche pour\nretourner au menu", flag, flag); - err_msg(DOWN_SCREEN, message); - goto gui_init_err; - } - - initial_path_config(); - - return; - -gui_init_err: - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - wait_Anykey_press(0); - quit(); -} diff --git a/source/nds/gui.h b/source/nds/gui.h deleted file mode 100644 index 92dc81d..0000000 --- a/source/nds/gui.h +++ /dev/null @@ -1,202 +0,0 @@ -/* gui.h - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __GUI_H__ -#define __GUI_H__ - -//#include "ds2_types.h" -//#include "fs_api.h" -#include "gcheat.h" - -#define UP_SCREEN_UPDATE_METHOD 0 -#define DOWN_SCREEN_UPDATE_METHOD 2 - -// For general option text -#define OPTION_TEXT_X 10 -#define OPTION_TEXT_SX 236 - -// For option rows -#define GUI_ROW1_Y 36 -#define GUI_ROW_SY 19 -// The following offset is added to the row's Y coordinate to provide -// the Y coordinate for its text. -#define TEXT_OFFSET_Y 2 -// The following offset is added to the row's Y coordinate to provide -// the Y coordinate for its ICON_SUBSELA (sub-screen selection type A). -#define SUBSELA_OFFSET_Y -2 -#define SUBSELA_X ((NDS_SCREEN_WIDTH - ICON_SUBSELA.x) / 2) - -// For message boxes -#define MESSAGE_BOX_TEXT_X ((NDS_SCREEN_WIDTH - ICON_MSG.x) / 2 + 3) -#define MESSAGE_BOX_TEXT_SX (ICON_MSG.x - 6) -// Y is brought down by the "window title" that's part of ICON_MSG -#define MESSAGE_BOX_TEXT_Y ((NDS_SCREEN_HEIGHT - ICON_MSG.y) / 2 + 24) - -// For cheats [ NUM. DESC . . . . . +/- ] -#define CHEAT_NUMBER_X 10 -#define CHEAT_DESC_X 34 -#define CHEAT_DESC_SX 197 -#define CHEAT_ACTIVE_X 241 - -// For the file selector -#define FILE_SELECTOR_ICON_X 10 -#define FILE_SELECTOR_ICON_Y (TEXT_OFFSET_Y - 1) -#define FILE_SELECTOR_NAME_X 32 -#define FILE_SELECTOR_NAME_SX 214 - -// Back button -#define BACK_BUTTON_X 229 -#define BACK_BUTTON_Y 10 -// Title icon -#define TITLE_ICON_X 12 -#define TITLE_ICON_Y 9 - -#define MAX_GAMEPAD_MAP 16 - -#ifdef __cplusplus -extern "C" { -#endif - -// -struct _EMU_CONFIG -{ - u32 language; - char rom_file[256]; - char rom_path[256]; - char latest_file[5][512]; - u32 HotkeyReturnToMenu; - u32 HotkeyTemporaryFastForward; - u32 HotkeyToggleSound; - u32 HotkeyQuickLoadState; - u32 HotkeyQuickSaveState; - u32 HotkeyToggleFullScreen; - u32 BottomScreenGame; - u32 Reserved[57]; -}; - -struct _GAME_CONFIG -{ - u32 clock_speed_number; - u32 Reserved0; - u32 frameskip_value; - u32 graphic; - u32 enable_audio; - u32 Reserved1; - u32 backward; - u32 backward_time; - u32 HotkeyReturnToMenu; - u32 HotkeyTemporaryFastForward; - u32 HotkeyToggleSound; - u32 SoundSync; - /* - * PreviouslyUsed_20130206_1 was for a second meaning of - * frameskip_value that is now dropped. - * THIS VALUE IS NOT GUARANTEED TO BE RESERVED AND SET TO 0. - */ - u32 PreviouslyUsed_20130206_1; - /* - * PreviouslyUsed_20130206_2 was for a second meaning of - * clock_speed_number that is now dropped. - * THIS VALUE IS NOT GUARANTEED TO BE RESERVED AND SET TO 0. - */ - u32 PreviouslyUsed_20130206_2; - u32 RetroSound; - u32 HotkeyQuickLoadState; - u32 HotkeyQuickSaveState; - u32 HotkeyToggleFullScreen; - u32 Reserved2[38]; -}; - -typedef enum -{ - CURSOR_NONE = 0, - CURSOR_UP, - CURSOR_DOWN, - CURSOR_LEFT, - CURSOR_RIGHT, - CURSOR_SELECT, - CURSOR_BACK, - CURSOR_EXIT, - CURSOR_RTRIGGER, - CURSOR_LTRIGGER, - CURSOR_KEY_SELECT, - CURSOR_TOUCH -} gui_action_type; - -typedef enum -{ - BUTTON_ID_A = 0x01, - BUTTON_ID_B = 0x02, - BUTTON_ID_SELECT = 0x04, - BUTTON_ID_START = 0x08, - BUTTON_ID_RIGHT = 0x10, - BUTTON_ID_LEFT = 0x20, - BUTTON_ID_UP = 0x40, - BUTTON_ID_DOWN = 0x80, - BUTTON_ID_R = 0x100, - BUTTON_ID_L = 0x200, - BUTTON_ID_X = 0x400, - BUTTON_ID_Y = 0x800, - BUTTON_ID_TOUCH = 0x1000, - BUTTON_ID_LID = 0x2000, - BUTTON_ID_FA = 0x4000, - BUTTON_ID_FB = 0x8000, - BUTTON_ID_NONE = 0 -} input_buttons_id_type; - -extern char main_path[MAX_PATH]; -extern char rom_path[MAX_PATH]; - -extern u32 game_enable_audio; -extern u32 game_fast_forward; -extern u32 temporary_fast_forward; - -/****************************************************************************** - ******************************************************************************/ -extern char g_default_rom_dir[MAX_PATH]; -extern char DEFAULT_RTS_DIR[MAX_PATH]; -extern char DEFAULT_CFG_DIR[MAX_PATH]; -extern char DEFAULT_SS_DIR[MAX_PATH]; -extern char DEFAULT_CHEAT_DIR[MAX_PATH]; - -typedef struct _EMU_CONFIG EMU_CONFIG; -typedef struct _GAME_CONFIG GAME_CONFIG; - -extern EMU_CONFIG emu_config; -extern GAME_CONFIG game_config; - -/****************************************************************************** - ******************************************************************************/ -extern void gui_init(u32 lang_id); -extern u32 menu(u16 *original_screen, bool8 FirstInvocation); -extern void LowFrequencyCPU(); -extern void HighFrequencyCPU(); -extern void GameFrequencyCPU(); - -extern void QuickSaveState(); -extern void QuickLoadState(); -extern void ToggleFullScreen(); - -extern int load_language_msg(char *filename, u32 language); - -#ifdef __cplusplus -} -#endif - -#endif //__GUI_H__ diff --git a/source/nds/message.h b/source/nds/message.h deleted file mode 100644 index f2977e4..0000000 --- a/source/nds/message.h +++ /dev/null @@ -1,169 +0,0 @@ -/* message.h - * - * Copyright (C) 2010 dking <dking024@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licens e as - * published by the Free Software Foundation; either version 2 of - * the License, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __MESSAGE_H__ -#define __MESSAGE_H__ - -enum MSG -{ - MSG_MAIN_MENU_NEW_GAME, - MSG_MAIN_MENU_RETURN_TO_GAME, - MSG_MAIN_MENU_RESET_GAME, - MSG_MAIN_MENU_VIDEO_AUDIO, - MSG_MAIN_MENU_SAVED_STATES, - MSG_MAIN_MENU_CHEATS, - MSG_MAIN_MENU_TOOLS, - MSG_MAIN_MENU_OPTIONS, - MSG_MAIN_MENU_EXIT, - - MSG_FILE_MENU_LOADING_LIST, - MSG_FILE_MENU_SORTING_LIST, - - FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE, - MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO, - MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO, - FMT_VIDEO_ASPECT_RATIO, - FMT_VIDEO_FAST_FORWARD, - FMT_VIDEO_FRAME_SKIPPING, - FMT_VIDEO_GAME_SCREEN, - FMT_AUDIO_SOUND, - FMT_AUDIO_RETRO_SOUND, - FMT_SAVED_STATE_CREATE, - FMT_SAVED_STATE_LOAD, - MSG_SAVED_STATE_DELETE_GENERAL, - FMT_CHEAT_PAGE, - MSG_CHEAT_LOAD_FROM_FILE, - MSG_TOOLS_SCREENSHOT_GENERAL, - MSG_TOOLS_GLOBAL_HOTKEY_GENERAL, - MSG_TOOLS_GAME_HOTKEY_GENERAL, - FMT_OPTIONS_LANGUAGE, - FMT_OPTIONS_CPU_FREQUENCY, - MSG_OPTIONS_CPU_FREQUENCY_0, - MSG_OPTIONS_CPU_FREQUENCY_1, - MSG_OPTIONS_CPU_FREQUENCY_2, - MSG_OPTIONS_CPU_FREQUENCY_3, - MSG_OPTIONS_CPU_FREQUENCY_4, - MSG_OPTIONS_CPU_FREQUENCY_5, - MSG_OPTIONS_CARD_CAPACITY /* unused if !defined(ENABLE_FREE_SPACE) */, - MSG_OPTIONS_RESET, - MSG_OPTIONS_VERSION, - MSG_SCREENSHOT_CREATE, - MSG_SCREENSHOT_BROWSE, - MSG_HOTKEY_MAIN_MENU, - MSG_HOTKEY_TEMPORARY_FAST_FORWARD, - MSG_HOTKEY_SOUND_TOGGLE, - MSG_HOTKEY_QUICK_LOAD_STATE, - MSG_HOTKEY_QUICK_SAVE_STATE, - MSG_HOTKEY_FULL_SCREEN_TOGGLE, - MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS, - MSG_HOTKEY_DELETE_WITH_A, - MSG_HOTKEY_CANCEL_WITH_B, - MSG_LOAD_GAME_RECENTLY_PLAYED, - MSG_LOAD_GAME_FROM_CARD, - MSG_LOAD_GAME_MENU_TITLE, - - MSG_VIDEO_ASPECT_RATIO_0, - MSG_VIDEO_ASPECT_RATIO_1, - MSG_VIDEO_ASPECT_RATIO_2, - MSG_VIDEO_ASPECT_RATIO_3, - MSG_VIDEO_ASPECT_RATIO_4, - - MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC, - MSG_VIDEO_FRAME_SKIPPING_0, - MSG_VIDEO_FRAME_SKIPPING_1, - MSG_VIDEO_FRAME_SKIPPING_2, - MSG_VIDEO_FRAME_SKIPPING_3, - MSG_VIDEO_FRAME_SKIPPING_4, - MSG_VIDEO_FRAME_SKIPPING_5, - MSG_VIDEO_FRAME_SKIPPING_6, - MSG_VIDEO_FRAME_SKIPPING_7, - MSG_VIDEO_FRAME_SKIPPING_8, - MSG_VIDEO_FRAME_SKIPPING_9, - MSG_VIDEO_FRAME_SKIPPING_10, - - MSG_VIDEO_GAME_SCREEN_TOP, - MSG_VIDEO_GAME_SCREEN_BOTTOM, - - MSG_GENERAL_OFF, - MSG_GENERAL_ON, - - MSG_GENERAL_CONFIRM_WITH_A, - MSG_GENERAL_CANCEL_WITH_B, - - MSG_AUDIO_ENABLED, - MSG_AUDIO_MUTED, - - MSG_TOP_SCREEN_NO_GAME_LOADED, - MSG_CHEAT_ELEMENT_NOT_LOADED, - - MSG_SAVESTATE_FULL, - MSG_PROGRESS_SAVED_STATE_CREATING, - MSG_PROGRESS_SAVED_STATE_CREATION_FAILED, - MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED, - MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT, - MSG_PROGRESS_SAVED_STATE_CORRUPTED, - MSG_PROGRESS_SAVED_STATE_LOADING, - MSG_PROGRESS_SAVED_STATE_LOAD_FAILED, - MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED, - - MSG_SAVED_STATE_DELETE_ALL, - FMT_SAVED_STATE_DELETE_ONE, - - MSG_DIALOG_SAVED_STATE_DELETE_ALL, - FMT_DIALOG_SAVED_STATE_DELETE_ONE, - MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY, - - MSG_PROGRESS_SCREENSHOT_CREATING, - MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED, - MSG_PROGRESS_SCREENSHOT_CREATION_FAILED, - - MSG_NO_SLIDE, - MSG_PLAYING_SLIDE, - MSG_PAUSE_SLIDE, - MSG_SCREENSHOT_SLIDESHOW_KEYS, - - MSG_PROGRESS_LOADING_GAME, - - MSG_EMULATOR_NAME, - MSG_WORD_EMULATOR_VERSION, - - MSG_DIALOG_RESET, - MSG_PROGRESS_RESETTING, - - MSG_END -}; - -enum LANGUAGE { - ENGLISH, - CHINESE_SIMPLIFIED, - FRENCH, - GERMAN, - DUTCH, - SPANISH, - ITALIAN, - PORTUGUESE_BRAZILIAN -}; - -extern char* lang[8]; // Allocated in gui.c, needs to match the languages ^ - -char *msg[MSG_END+1]; -char msg_data[32 * 1024]; - -#endif //__MESSAGE_H__ - diff --git a/source/unzip/explode.c b/source/unzip/explode.c deleted file mode 100644 index 6558a7b..0000000 --- a/source/unzip/explode.c +++ /dev/null @@ -1,1120 +0,0 @@ -/* explode.c -- Not copyrighted 1992 by Mark Adler - version c7, 27 June 1992 */ - - -/* You can do whatever you like with this source file, though I would - prefer that if you modify it and redistribute it that you include - comments to that effect with your name and the date. Thank you. - - History: - vers date who what - ---- --------- -------------- ------------------------------------ - c1 30 Mar 92 M. Adler explode that uses huft_build from inflate - (this gives over a 70% speed improvement - over the original unimplode.c, which - decoded a bit at a time) - c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. - c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG - c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy() - c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing - the 32K window size for specialized - applications. - c6 31 May 92 M. Adler added typecasts to eliminate some warnings - c7 27 Jun 92 G. Roelofs added more typecasts - */ - - -/* - Explode imploded (PKZIP method 6 compressed) data. This compression - method searches for as much of the current string of bytes (up to a length - of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches - (of at least length 2 or 3), it codes the next byte. Otherwise, it codes - the length of the matched string and its distance backwards from the - current position. Single bytes ("literals") are preceded by a one (a - single bit) and are either uncoded (the eight bits go directly into the - compressed stream for a total of nine bits) or Huffman coded with a - supplied literal code tree. If literals are coded, then the minimum match - length is three, otherwise it is two. - - There are therefore four kinds of imploded streams: 8K search with coded - literals (min match = 3), 4K search with coded literals (min match = 3), - 8K with uncoded literals (min match = 2), and 4K with uncoded literals - (min match = 2). The kind of stream is identified in two bits of a - general purpose bit flag that is outside of the compressed stream. - - Distance-length pairs are always coded. Distance-length pairs for matched - strings are preceded by a zero bit (to distinguish them from literals) and - are always coded. The distance comes first and is either the low six (4K) - or low seven (8K) bits of the distance (uncoded), followed by the high six - bits of the distance coded. Then the length is six bits coded (0..63 + - min match length), and if the maximum such length is coded, then it's - followed by another eight bits (uncoded) to be added to the coded length. - This gives a match length range of 2..320 or 3..321 bytes. - - The literal, length, and distance codes are all represented in a slightly - compressed form themselves. What is sent are the lengths of the codes for - each value, which is sufficient to construct the codes. Each byte of the - code representation is the code length (the low four bits representing - 1..16), and the number of values sequentially with that length (the high - four bits also representing 1..16). There are 256 literal code values (if - literals are coded), 64 length code values, and 64 distance code values, - in that order at the beginning of the compressed stream. Each set of code - values is preceded (redundantly) with a byte indicating how many bytes are - in the code description that follows, in the range 1..256. - - The codes themselves are decoded using tables made by huft_build() from - the bit lengths. That routine and its comments are in the inflate.c - module. - */ - -#include "unz.h" /* this must supply the slide[] (byte) array */ -#include "unzipP.h" -//#include <stdlib.h> -#include "ds2_malloc.h" - -#ifndef WSIZE -# define WSIZE 0x8000 /* window size--must be a power of two, and at least - 8K for zip's implode method */ -#endif /* !WSIZE */ - - -struct huft { - byte e; /* number of extra bits or operation */ - byte b; /* number of bits in this code or subcode */ - union { - UWORD n; /* literal, length base, or distance base */ - struct huft *t; /* pointer to next level of table */ - } v; -}; - -/* Function prototypes */ -/* routines from inflate.c */ -extern unsigned hufts; -int huft_build OF((unsigned *, unsigned, unsigned, UWORD *, UWORD *, - struct huft **, int *)); -int huft_free OF((struct huft *)); -void flush OF((unsigned)); - -/* routines here */ -int get_tree OF((unsigned *, unsigned)); -int explode_lit8 OF((struct huft *, struct huft *, struct huft *, - int, int, int)); -int explode_lit4 OF((struct huft *, struct huft *, struct huft *, - int, int, int)); -int explode_nolit8 OF((struct huft *, struct huft *, int, int)); -int explode_nolit4 OF((struct huft *, struct huft *, int, int)); -int explode (); - -extern file_in_zip_read_info_s *pfile_in_zip_read_info; -extern unz_s *pUnzip; - -/* The implode algorithm uses a sliding 4K or 8K byte window on the - uncompressed stream to find repeated byte strings. This is implemented - here as a circular buffer. The index is updated simply by incrementing - and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K - buffer of inflate is used, and it works just as well to always have - a 32K circular buffer, so the index is anded with 0x7fff. This is - done to allow the window to also be used as the output buffer. */ -/* This must be supplied in an external module useable like "byte slide[8192];" - or "byte *slide;", where the latter would be malloc'ed. In unzip, slide[] - is actually a 32K area for use by inflate, which uses a 32K sliding window. - */ - - -/* Tables for length and distance */ -UWORD cplen2[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65}; -UWORD cplen3[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66}; -UWORD extra[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8}; -UWORD cpdist4[] = {1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705, - 769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473, - 1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177, - 2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881, - 2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585, - 3649, 3713, 3777, 3841, 3905, 3969, 4033}; -UWORD cpdist8[] = {1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281, - 1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689, - 2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097, - 4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505, - 5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913, - 7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065}; - - -/* Macros for inflate() bit peeking and grabbing. - The usage is: - - NEEDBITS(j) - x = b & mask_bits[j]; - DUMPBITS(j) - - where NEEDBITS makes sure that b has at least j bits in it, and - DUMPBITS removes the bits from b. The macros use the variable k - for the number of bits in b. Normally, b and k are register - variables for speed. - */ - -extern UWORD bytebuf; /* (use the one in inflate.c) */ -#define NEXTBYTE (ReadByte(&bytebuf), bytebuf) -#define NEEDBITS(n) {while(k<(n)){b|=((ULONG)NEXTBYTE)<<k;k+=8;}} -#define DUMPBITS(n) {b>>=(n);k-=(n);} - -/* HERE */ -UWORD mask_bits[] = { - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff -}; -union work area; /* see unzip.h for the definition of work */ -ULONG crc32val; -ush bytebuf; -ULONG bitbuf; -int bits_left; -boolean zipeof; - -int get_tree(l, n) -unsigned *l; /* bit lengths */ -unsigned n; /* number expected */ -/* Get the bit lengths for a code representation from the compressed - stream. If get_tree() returns 4, then there is an error in the data. - Otherwise zero is returned. */ -{ - unsigned i; /* bytes remaining in list */ - unsigned k; /* lengths entered */ - unsigned j; /* number of codes */ - unsigned b; /* bit length for those codes */ - - - /* get bit lengths */ - ReadByte(&bytebuf); - i = bytebuf + 1; /* length/count pairs to read */ - k = 0; /* next code */ - do { - ReadByte(&bytebuf); - b = ((j = bytebuf) & 0xf) + 1; /* bits in code (1..16) */ - j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */ - if (k + j > n) - return 4; /* don't overflow l[] */ - do { - l[k++] = b; - } while (--j); - } while (--i); - return k != n ? 4 : 0; /* should have read n of them */ -} - - - -int explode_lit8(tb, tl, td, bb, bl, bd) -struct huft *tb, *tl, *td; /* literal, length, and distance tables */ -int bb, bl, bd; /* number of bits decoded by those */ -/* Decompress the imploded data using coded literals and an 8K sliding - window. */ -{ - longint s; /* bytes to decompress */ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ - register ULONG b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - unsigned u; /* true if unflushed */ - - - /* explode the coded data */ - b = k = w = 0; /* initialize bit buffer, window */ - u = 1; /* buffer unflushed */ - mb = mask_bits[bb]; /* precompute masks for speed */ - ml = mask_bits[bl]; - md = mask_bits[bd]; - s = pUnzip->pfile_in_zip_read->rest_read_uncompressed; - while (s > 0) /* do until ucsize bytes uncompressed */ - { - NEEDBITS(1) - if (b & 1) /* then literal--decode it */ - { - DUMPBITS(1) - s--; - NEEDBITS((unsigned)bb) /* get coded literal */ - if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - slide[w++] = (byte)t->v.n; - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - } - else /* else distance/length */ - { - DUMPBITS(1) - NEEDBITS(7) /* get distance low bits */ - d = (unsigned)b & 0x7f; - DUMPBITS(7) - NEEDBITS((unsigned)bd) /* get coded distance high bits */ - if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - d = w - d - t->v.n; /* construct offset */ - NEEDBITS((unsigned)bl) /* get coded length */ - if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - n = t->v.n; - if (e) /* get length extra bits */ - { - NEEDBITS(8) - n += (unsigned)b & 0xff; - DUMPBITS(8) - } - - /* do the copy */ - s -= n; - do { - n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); - if (u && w <= d) - { - memset(slide + w, 0, e); - w += e; - d += e; - } - else -#ifndef NOMEMCPY - if (w - d >= e) /* (this test assumes unsigned comparison) */ - { - memcpy(slide + w, slide + d, e); - w += e; - d += e; - } - else /* do it slow to avoid memcpy() overlap */ -#endif /* !NOMEMCPY */ - do { - slide[w++] = slide[d++]; - } while (--e); - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - } while (n); - } - } - - /* flush out slide */ - flush(w); - return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */ -} - - - -int explode_lit4(tb, tl, td, bb, bl, bd) -struct huft *tb, *tl, *td; /* literal, length, and distance tables */ -int bb, bl, bd; /* number of bits decoded by those */ -/* Decompress the imploded data using coded literals and a 4K sliding - window. */ -{ - longint s; /* bytes to decompress */ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ - register ULONG b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - unsigned u; /* true if unflushed */ - - - /* explode the coded data */ - b = k = w = 0; /* initialize bit buffer, window */ - u = 1; /* buffer unflushed */ - mb = mask_bits[bb]; /* precompute masks for speed */ - ml = mask_bits[bl]; - md = mask_bits[bd]; - s = pUnzip->pfile_in_zip_read->rest_read_uncompressed; - while (s > 0) /* do until ucsize bytes uncompressed */ - { - NEEDBITS(1) - if (b & 1) /* then literal--decode it */ - { - DUMPBITS(1) - s--; - NEEDBITS((unsigned)bb) /* get coded literal */ - if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - slide[w++] = (byte)t->v.n; - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - } - else /* else distance/length */ - { - DUMPBITS(1) - NEEDBITS(6) /* get distance low bits */ - d = (unsigned)b & 0x3f; - DUMPBITS(6) - NEEDBITS((unsigned)bd) /* get coded distance high bits */ - if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - d = w - d - t->v.n; /* construct offset */ - NEEDBITS((unsigned)bl) /* get coded length */ - if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - n = t->v.n; - if (e) /* get length extra bits */ - { - NEEDBITS(8) - n += (unsigned)b & 0xff; - DUMPBITS(8) - } - - /* do the copy */ - s -= n; - do { - n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); - if (u && w <= d) - { - memset(slide + w, 0, e); - w += e; - d += e; - } - else -#ifndef NOMEMCPY - if (w - d >= e) /* (this test assumes unsigned comparison) */ - { - memcpy(slide + w, slide + d, e); - w += e; - d += e; - } - else /* do it slow to avoid memcpy() overlap */ -#endif /* !NOMEMCPY */ - do { - slide[w++] = slide[d++]; - } while (--e); - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - } while (n); - } - } - - /* flush out slide */ - flush(w); - return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */ -} - - - -int explode_nolit8(tl, td, bl, bd) -struct huft *tl, *td; /* length and distance decoder tables */ -int bl, bd; /* number of bits decoded by tl[] and td[] */ -/* Decompress the imploded data using uncoded literals and an 8K sliding - window. */ -{ - longint s; /* bytes to decompress */ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned ml, md; /* masks for bl and bd bits */ - register ULONG b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - unsigned u; /* true if unflushed */ - - - /* explode the coded data */ - b = k = w = 0; /* initialize bit buffer, window */ - u = 1; /* buffer unflushed */ - ml = mask_bits[bl]; /* precompute masks for speed */ - md = mask_bits[bd]; - s = pUnzip->pfile_in_zip_read->rest_read_uncompressed; - while (s > 0) /* do until ucsize bytes uncompressed */ - { - NEEDBITS(1) - if (b & 1) /* then literal--get eight bits */ - { - DUMPBITS(1) - s--; - NEEDBITS(8) - slide[w++] = (byte)b; - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - DUMPBITS(8) - } - else /* else distance/length */ - { - DUMPBITS(1) - NEEDBITS(7) /* get distance low bits */ - d = (unsigned)b & 0x7f; - DUMPBITS(7) - NEEDBITS((unsigned)bd) /* get coded distance high bits */ - if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - d = w - d - t->v.n; /* construct offset */ - NEEDBITS((unsigned)bl) /* get coded length */ - if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - n = t->v.n; - if (e) /* get length extra bits */ - { - NEEDBITS(8) - n += (unsigned)b & 0xff; - DUMPBITS(8) - } - - /* do the copy */ - s -= n; - do { - n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); - if (u && w <= d) - { - memset(slide + w, 0, e); - w += e; - d += e; - } - else -#ifndef NOMEMCPY - if (w - d >= e) /* (this test assumes unsigned comparison) */ - { - memcpy(slide + w, slide + d, e); - w += e; - d += e; - } - else /* do it slow to avoid memcpy() overlap */ -#endif /* !NOMEMCPY */ - do { - slide[w++] = slide[d++]; - } while (--e); - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - } while (n); - } - } - - /* flush out slide */ - flush(w); - return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */ -} - - - -int explode_nolit4(tl, td, bl, bd) -struct huft *tl, *td; /* length and distance decoder tables */ -int bl, bd; /* number of bits decoded by tl[] and td[] */ -/* Decompress the imploded data using uncoded literals and a 4K sliding - window. */ -{ - longint s; /* bytes to decompress */ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned ml, md; /* masks for bl and bd bits */ - register ULONG b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - unsigned u; /* true if unflushed */ - - - /* explode the coded data */ - b = k = w = 0; /* initialize bit buffer, window */ - u = 1; /* buffer unflushed */ - ml = mask_bits[bl]; /* precompute masks for speed */ - md = mask_bits[bd]; - s = pUnzip->pfile_in_zip_read->rest_read_uncompressed; - while (s > 0) /* do until ucsize bytes uncompressed */ - { - NEEDBITS(1) - if (b & 1) /* then literal--get eight bits */ - { - DUMPBITS(1) - s--; - NEEDBITS(8) - slide[w++] = (byte)b; - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - DUMPBITS(8) - } - else /* else distance/length */ - { - DUMPBITS(1) - NEEDBITS(6) /* get distance low bits */ - d = (unsigned)b & 0x3f; - DUMPBITS(6) - NEEDBITS((unsigned)bd) /* get coded distance high bits */ - if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - d = w - d - t->v.n; /* construct offset */ - NEEDBITS((unsigned)bl) /* get coded length */ - if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - n = t->v.n; - if (e) /* get length extra bits */ - { - NEEDBITS(8) - n += (unsigned)b & 0xff; - DUMPBITS(8) - } - - /* do the copy */ - s -= n; - do { - n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); - if (u && w <= d) - { - memset(slide + w, 0, e); - w += e; - d += e; - } - else -#ifndef NOMEMCPY - if (w - d >= e) /* (this test assumes unsigned comparison) */ - { - memcpy(slide + w, slide + d, e); - w += e; - d += e; - } - else /* do it slow to avoid memcpy() overlap */ -#endif /* !NOMEMCPY */ - do { - slide[w++] = slide[d++]; - } while (--e); - if (w == WSIZE) - { - flush(w); - w = u = 0; - } - } while (n); - } - } - - /* flush out slide */ - flush(w); - return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */ -} - - - -int explode () -/* Explode an imploded compressed stream. Based on the general purpose - bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding - window. Construct the literal (if any), length, and distance codes and - the tables needed to decode them (using huft_build() from inflate.c), - and call the appropriate routine for the type of data in the remainder - of the stream. The four routines are nearly identical, differing only - in whether the literal is decoded or simply read in, and in how many - bits are read in, uncoded, for the low distance bits. */ -{ - unsigned r; /* return codes */ - struct huft *tb; /* literal code table */ - struct huft *tl; /* length code table */ - struct huft *td; /* distance code table */ - int bb; /* bits for tb */ - int bl; /* bits for tl */ - int bd; /* bits for td */ - unsigned l[256]; /* bit lengths for codes */ - - - /* Tune base table sizes. Note: I thought that to truly optimize speed, - I would have to select different bl, bd, and bb values for different - compressed file sizes. I was suprised to find out the the values of - 7, 7, and 9 worked best over a very wide range of sizes, except that - bd = 8 worked marginally better for large compressed sizes. */ - bl = 7; - bd = pUnzip->pfile_in_zip_read->rest_read_compressed > 200000L ? 8 : 7; - - - /* With literal tree--minimum match length is 3 */ - hufts = 0; /* initialze huft's malloc'ed */ - if (pUnzip->cur_file_info.flag & 4) - { - bb = 9; /* base table size for literals */ - if ((r = get_tree(l, 256)) != 0) - return r; - if ((r = huft_build(l, 256, 256, NULL, NULL, &tb, &bb)) != 0) - { - if (r == 1) - huft_free(tb); - return r; - } - if ((r = get_tree(l, 64)) != 0) - return r; - if ((r = huft_build(l, 64, 0, cplen3, extra, &tl, &bl)) != 0) - { - if (r == 1) - huft_free(tl); - huft_free(tb); - return r; - } - if ((r = get_tree(l, 64)) != 0) - return r; - if (pUnzip->cur_file_info.flag & 2) /* true if 8K */ - { - if ((r = huft_build(l, 64, 0, cpdist8, extra, &td, &bd)) != 0) - { - if (r == 1) - huft_free(td); - huft_free(tl); - huft_free(tb); - return r; - } - r = explode_lit8(tb, tl, td, bb, bl, bd); - } - else /* else 4K */ - { - if ((r = huft_build(l, 64, 0, cpdist4, extra, &td, &bd)) != 0) - { - if (r == 1) - huft_free(td); - huft_free(tl); - huft_free(tb); - return r; - } - r = explode_lit4(tb, tl, td, bb, bl, bd); - } - huft_free(td); - huft_free(tl); - huft_free(tb); - } - else - - - /* No literal tree--minimum match length is 2 */ - { - if ((r = get_tree(l, 64)) != 0) - return r; - if ((r = huft_build(l, 64, 0, cplen2, extra, &tl, &bl)) != 0) - { - if (r == 1) - huft_free(tl); - return r; - } - if ((r = get_tree(l, 64)) != 0) - return r; - if (pUnzip->cur_file_info.flag & 2) /* true if 8K */ - { - if ((r = huft_build(l, 64, 0, cpdist8, extra, &td, &bd)) != 0) - { - if (r == 1) - huft_free(td); - huft_free(tl); - return r; - } - r = explode_nolit8(tl, td, bl, bd); - } - else /* else 4K */ - { - if ((r = huft_build(l, 64, 0, cpdist4, extra, &td, &bd)) != 0) - { - if (r == 1) - huft_free(td); - huft_free(tl); - return r; - } - r = explode_nolit4(tl, td, bl, bd); - } - huft_free(td); - huft_free(tl); - } -#ifdef DEBUG - fprintf(stderr, "<%u > ", hufts); -#endif /* DEBUG */ - return r; -} - - -int ReadByte(x) - UWORD *x; -{ - /* - * read a byte; return 8 if byte available, 0 if not - */ - - if (pfile_in_zip_read_info->stream.avail_in == 0) - { - unsigned int uReadThis = UNZ_BUFSIZE; - - if (pfile_in_zip_read_info->rest_read_compressed <= 0) - return (0); - - if (pfile_in_zip_read_info->rest_read_compressed < uReadThis) - uReadThis = (uInt) pfile_in_zip_read_info->rest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (fseek (pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile, SEEK_SET) != 0) - return UNZ_ERRNO; - if (fread (pfile_in_zip_read_info->read_buffer, uReadThis, 1, - pfile_in_zip_read_info->file) != 1) - return UNZ_ERRNO; - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - - pfile_in_zip_read_info->rest_read_compressed -= uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Bytef *) pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt) uReadThis; - } - - *x = *pfile_in_zip_read_info->stream.next_in++; - pfile_in_zip_read_info->stream.avail_in--; - - return 8; -} - -/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ -#define BMAX 16 /* maximum bit length of any code (16 for explode) */ -#define N_MAX 288 /* maximum number of codes in any set */ - -unsigned hufts; /* track memory usage */ - - -int huft_build(b, n, s, d, e, t, m) -unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ -unsigned n; /* number of codes (assumed <= N_MAX) */ -unsigned s; /* number of simple-valued codes (0..s-1) */ -ush *d; /* list of base values for non-simple codes */ -ush *e; /* list of extra bits for non-simple codes */ -struct huft **t; /* result: starting table */ -int *m; /* maximum lookup bits, returns actual */ -/* Given a list of code lengths and a maximum table size, make a set of - tables to decode that set of codes. Return zero on success, one if - the given code set is incomplete (the tables are still built in this - case), two if the input is invalid (all zero length codes or an - oversubscribed set of lengths), and three if not enough memory. */ -{ - unsigned a; /* counter for codes of length k */ - unsigned c[BMAX+1]; /* bit length count table */ - unsigned f; /* i repeats in table every f entries */ - int g; /* maximum code length */ - int h; /* table level */ - register unsigned i; /* counter, current code */ - register unsigned j; /* counter */ - register int k; /* number of bits in current code */ - int l; /* bits per table (returned in m) */ - register unsigned *p; /* pointer into c[], b[], or v[] */ - register struct huft *q; /* points to current table */ - struct huft r; /* table entry for structure assignment */ - struct huft *u[BMAX]; /* table stack */ - unsigned v[N_MAX]; /* values in order of bit length */ - register int w; /* bits before this table == (l * h) */ - unsigned x[BMAX+1]; /* bit offsets, then code stack */ - unsigned *xp; /* pointer into x */ - int y; /* number of dummy codes added */ - unsigned z; /* number of entries in current table */ - - - /* Generate counts for each bit length */ - memset(c, 0, sizeof(c)); - p = b; i = n; - do { - c[*p++]++; /* assume all entries <= BMAX */ - } while (--i); - if (c[0] == n) /* null input--all zero length codes */ - { - *t = (struct huft *)NULL; - *m = 0; - return 0; - } - - - /* Find minimum and maximum length, bound *m by those */ - l = *m; - for (j = 1; j <= BMAX; j++) - if (c[j]) - break; - k = j; /* minimum code length */ - if ((unsigned)l < j) - l = j; - for (i = BMAX; i; i--) - if (c[i]) - break; - g = i; /* maximum code length */ - if ((unsigned)l > i) - l = i; - *m = l; - - - /* Adjust last length count to fill out codes, if needed */ - for (y = 1 << j; j < i; j++, y <<= 1) - if ((y -= c[j]) < 0) - return 2; /* bad input: more codes than bits */ - if ((y -= c[i]) < 0) - return 2; - c[i] += y; - - - /* Generate starting offsets into the value table for each length */ - x[1] = j = 0; - p = c + 1; xp = x + 2; - while (--i) { /* note that i == g from above */ - *xp++ = (j += *p++); - } - - - /* Make a table of values in order of bit lengths */ - p = b; i = 0; - do { - if ((j = *p++) != 0) - v[x[j]++] = i; - } while (++i < n); - - - /* Generate the Huffman codes and for each, make the table entries */ - x[0] = i = 0; /* first Huffman code is zero */ - p = v; /* grab values in bit order */ - h = -1; /* no tables yet--level -1 */ - w = -l; /* bits decoded == (l * h) */ - u[0] = (struct huft *)NULL; /* just to keep compilers happy */ - q = (struct huft *)NULL; /* ditto */ - z = 0; /* ditto */ - - /* go through the bit lengths (k already is bits in shortest code) */ - for (; k <= g; k++) - { - a = c[k]; - while (a--) - { - /* here i is the Huffman code of length k bits for value *p */ - /* make tables up to required level */ - while (k > w + l) - { - h++; - w += l; /* previous table always l bits */ - - /* compute minimum size table less than or equal to l bits */ - z = (z = g - w) > (unsigned)l ? l : z; /* upper limit on table size */ - if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ - { /* too few codes for k-w bit table */ - f -= a + 1; /* deduct codes from patterns left */ - xp = c + k; - while (++j < z) /* try smaller tables up to z bits */ - { - if ((f <<= 1) <= *++xp) - break; /* enough codes to use up j bits */ - f -= *xp; /* else deduct codes from patterns */ - } - } - z = 1 << j; /* table entries for j-bit table */ - - /* allocate and link in new table */ - if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) == - (struct huft *)NULL) - { - if (h) - huft_free(u[0]); - return 3; /* not enough memory */ - } - hufts += z + 1; /* track memory usage */ - *t = q + 1; /* link to list for huft_free() */ - *(t = &(q->v.t)) = (struct huft *)NULL; - u[h] = ++q; /* table starts after link */ - - /* connect to last table, if there is one */ - if (h) - { - x[h] = i; /* save pattern for backing up */ - r.b = (uch)l; /* bits to dump before this table */ - r.e = (uch)(16 + j); /* bits in this table */ - r.v.t = q; /* pointer to this table */ - j = i >> (w - l); /* (get around Turbo C bug) */ - u[h-1][j] = r; /* connect to last table */ - } - } - - /* set up table entry in r */ - r.b = (uch)(k - w); - if (p >= v + n) - r.e = 99; /* out of values--invalid code */ - else if (*p < s) - { - r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ - r.v.n = *p++; /* simple code is just the value */ - } - else - { - r.e = (uch)e[*p - s]; /* non-simple--look up in lists */ - r.v.n = d[*p++ - s]; - } - - /* fill code-like entries with r */ - f = 1 << (k - w); - for (j = i >> w; j < z; j += f) - q[j] = r; - - /* backwards increment the k-bit code i */ - for (j = 1 << (k - 1); i & j; j >>= 1) - i ^= j; - i ^= j; - - /* backup over finished tables */ - while ((i & ((1 << w) - 1)) != x[h]) - { - h--; /* don't need to update q */ - w -= l; - } - } - } - - - /* Return true (1) if we were given an incomplete table */ - return y != 0 && g != 1; -} - - -int huft_free(t) -struct huft *t; /* table to free */ -/* Free the malloc'ed tables built by huft_build(), which makes a linked - list of the tables it made, with the links in a dummy first entry of - each table. */ -{ - register struct huft *p, *q; - - - /* Go through linked list, freeing from the malloced (t[-1]) address. */ - p = t; - while (p != (struct huft *)NULL) - { - q = (--p)->v.t; - free(p); - p = q; - } - return 0; -} - -void flush(w) -unsigned w; /* number of bytes to flush */ -/* Do the equivalent of OUTB for the bytes slide[0..w-1]. */ -{ - memmove (pfile_in_zip_read_info->stream.next_out, slide, w); - pfile_in_zip_read_info->crc32 = crc32 (pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - w); - pfile_in_zip_read_info->stream.next_out += w; - pfile_in_zip_read_info->stream.avail_out -= w; - pfile_in_zip_read_info->stream.total_out += w; -} - -void flush_stack(w) -unsigned w; /* number of bytes to flush */ -/* Do the equivalent of OUTB for the bytes slide[0..w-1]. */ -{ - memmove (pfile_in_zip_read_info->stream.next_out, stack, w); - pfile_in_zip_read_info->crc32 = crc32 (pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - w); - pfile_in_zip_read_info->stream.next_out += w; - pfile_in_zip_read_info->stream.avail_out -= w; - pfile_in_zip_read_info->stream.total_out += w; -} - -/****************************/ -/* Function FillBitBuffer() */ -/****************************/ - -int FillBitBuffer() -{ - /* - * Fill bitbuf, which is 32 bits. This function is only used by the - * READBIT and PEEKBIT macros (which are used by all of the uncompression - * routines). - */ - UWORD temp; - - zipeof = 1; - while (bits_left < 25 && ReadByte(&temp) == 8) - { - bitbuf |= (ULONG)temp << bits_left; - bits_left += 8; - zipeof = 0; - } - return 0; -} - diff --git a/source/unzip/unreduce.c b/source/unzip/unreduce.c deleted file mode 100644 index e978746..0000000 --- a/source/unzip/unreduce.c +++ /dev/null @@ -1,217 +0,0 @@ -/*--------------------------------------------------------------------------- - - unreduce.c - - The Reducing algorithm is actually a combination of two distinct algorithms. - The first algorithm compresses repeated byte sequences, and the second al- - gorithm takes the compressed stream from the first algorithm and applies a - probabilistic compression method. - - ---------------------------------------------------------------------------*/ - - -#include "unz.h" -#include "unzipP.h" - -/**************************************/ -/* UnReduce Defines, Typedefs, etc. */ -/**************************************/ - -#define DLE 144 - -typedef byte f_array[64]; /* for followers[256][64] */ - -static void LoadFollowers (); -void flush OF((unsigned)); /* routine from inflate.c */ - -extern file_in_zip_read_info_s *pfile_in_zip_read_info; -extern unz_s *pUnzip; - -/*******************************/ -/* UnReduce Global Variables */ -/*******************************/ - -#if (defined(MACOS) || defined(MTS)) - f_array *followers; /* shared work space */ -#else - f_array *followers = (f_array *) (slide + 0x4000); -#endif - -byte Slen[256]; -int factor; - -int L_table[] = -{0, 0x7f, 0x3f, 0x1f, 0x0f}; - -int D_shift[] = -{0, 0x07, 0x06, 0x05, 0x04}; -int D_mask[] = -{0, 0x01, 0x03, 0x07, 0x0f}; - -int B_table[] = -{8, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8}; - - - - - -/*************************/ -/* Function unReduce() */ -/*************************/ - -void unReduce() /* expand probabilistically reduced data */ -{ - register int lchar = 0; - int nchar; - int ExState = 0; - int V = 0; - int Len = 0; - longint s = pUnzip->pfile_in_zip_read->rest_read_compressed; - unsigned w = 0; /* position in output window slide[] */ - unsigned u = 1; /* true if slide[] unflushed */ - - -#if (defined(MACOS) || defined(MTS)) - followers = (f_array *) (slide + 0x4000); -#endif - - factor = pUnzip->cur_file_info.compression_method; - LoadFollowers(); - - while (s > 0 /* && (!zipeof) */) { - if (Slen[lchar] == 0) - READBIT(8, nchar) /* ; */ - else { - READBIT(1, nchar); - if (nchar != 0) - READBIT(8, nchar) /* ; */ - else { - int follower; - int bitsneeded = B_table[Slen[lchar]]; - READBIT(bitsneeded, follower); - nchar = followers[lchar][follower]; - } - } - /* expand the resulting byte */ - switch (ExState) { - - case 0: - if (nchar != DLE) { - s--; - slide[w++] = (byte) nchar; - if (w == 0x4000) { - flush(w); - w = u = 0; - } - } - else - ExState = 1; - break; - - case 1: - if (nchar != 0) { - V = nchar; - Len = V & L_table[factor]; - if (Len == L_table[factor]) - ExState = 2; - else - ExState = 3; - } else { - s--; - slide[w++] = DLE; - if (w == 0x4000) - { - flush(w); - w = u = 0; - } - ExState = 0; - } - break; - - case 2:{ - Len += nchar; - ExState = 3; - } - break; - - case 3:{ - register unsigned e; - register unsigned n = Len + 3; - register unsigned d = w - ((((V >> D_shift[factor]) & - D_mask[factor]) << 8) + nchar + 1); - - s -= n; - do { - n -= (e = (e = 0x4000 - ((d &= 0x3fff) > w ? d : w)) > n ? - n : e); - if (u && w <= d) - { - memset(slide + w, 0, e); - w += e; - d += e; - } - else - if (w - d < e) /* (assume unsigned comparison) */ - do { /* slow to avoid memcpy() overlap */ - slide[w++] = slide[d++]; - } while (--e); - else - { - memcpy(slide + w, slide + d, e); - w += e; - d += e; - } - if (w == 0x4000) - { - flush(w); - w = u = 0; - } - } while (n); - - ExState = 0; - } - break; - } - - /* store character for next iteration */ - lchar = nchar; - } - - /* flush out slide */ - flush(w); -} - - - - - -/******************************/ -/* Function LoadFollowers() */ -/******************************/ - -static void LoadFollowers() -{ - register int x; - register int i; - - for (x = 255; x >= 0; x--) { - READBIT(6, Slen[x]); - for (i = 0; (byte) i < Slen[x]; i++) { - READBIT(8, followers[x][i]); - } - } -} diff --git a/source/unzip/unshrink.c b/source/unzip/unshrink.c deleted file mode 100644 index 6deb4d4..0000000 --- a/source/unzip/unshrink.c +++ /dev/null @@ -1,177 +0,0 @@ -/*--------------------------------------------------------------------------- - - unshrink.c - - Shrinking is a Dynamic Lempel-Ziv-Welch compression algorithm with partial - clearing. - - ---------------------------------------------------------------------------*/ - - -#include "unz.h" -void flush_stack (int); - -/*************************************/ -/* UnShrink Defines, Globals, etc. */ -/*************************************/ - -/* MAX_BITS 13 (in unzip.h; defines size of global work area) */ -#define INIT_BITS 9 -#define FIRST_ENT 257 -#define CLEAR 256 -#define GetCode(dest) READBIT(codesize,dest) - -static void partial_clear (); - -int codesize, maxcode, maxcodemax, free_ent; - - - - -/*************************/ -/* Function unShrink() */ -/*************************/ - -void unShrink() -{ - register int code; - register int stackp; - int finchar; - int oldcode; - int incode; - - - /* decompress the file */ - codesize = INIT_BITS; - maxcode = (1 << codesize) - 1; - maxcodemax = HSIZE; /* (1 << MAX_BITS) */ - free_ent = FIRST_ENT; - - code = maxcodemax; - do { - prefix_of[code] = -1; - } while (--code > 255); -/* - OvdL: -Ox with SCO's 3.2.0 cc gives - a. warning: overflow in constant multiplication - b. segmentation fault (core dumped) when using the executable - for (code = maxcodemax; code > 255; code--) - prefix_of[code] = -1; - */ - - for (code = 255; code >= 0; code--) { - prefix_of[code] = 0; - suffix_of[code] = (byte) code; - } - - GetCode(oldcode); - if (zipeof) - return; - finchar = oldcode; - - stack[0] = finchar; - flush_stack (1); - - stackp = HSIZE; - - while (!zipeof) { - GetCode(code); - if (zipeof) - return; - - while (code == CLEAR) { - GetCode(code); - switch (code) { - case 1: - codesize++; - if (codesize == MAX_BITS) - maxcode = maxcodemax; - else - maxcode = (1 << codesize) - 1; - break; - - case 2: - partial_clear(); - break; - } - - GetCode(code); - if (zipeof) - return; - } - - - /* special case for KwKwK string */ - incode = code; - if (prefix_of[code] == -1) { - stack[--stackp] = (byte) finchar; - code = oldcode; - } - /* generate output characters in reverse order */ - while (code >= FIRST_ENT) { - if (prefix_of[code] == -1) { - stack[--stackp] = (byte) finchar; - code = oldcode; - } else { - stack[--stackp] = suffix_of[code]; - code = prefix_of[code]; - } - } - - finchar = suffix_of[code]; - stack[--stackp] = (byte) finchar; - - /* and put them out in forward order, block copy */ - flush_stack (HSIZE - stackp); - stackp = HSIZE; - - /* generate new entry */ - code = free_ent; - if (code < maxcodemax) { - prefix_of[code] = oldcode; - suffix_of[code] = (byte) finchar; - - do - code++; - while ((code < maxcodemax) && (prefix_of[code] != -1)); - - free_ent = code; - } - /* remember previous code */ - oldcode = incode; - } -} - - - -/******************************/ -/* Function partial_clear() */ -/******************************/ - -static void partial_clear() -{ - register int pr; - register int cd; - - /* mark all nodes as potentially unused */ - for (cd = FIRST_ENT; cd < free_ent; cd++) - prefix_of[cd] |= 0x8000; - - /* unmark those that are used by other nodes */ - for (cd = FIRST_ENT; cd < free_ent; cd++) { - pr = prefix_of[cd] & 0x7fff; /* reference to another node? */ - if (pr >= FIRST_ENT) /* flag node as referenced */ - prefix_of[pr] &= 0x7fff; - } - - /* clear the ones that are still marked */ - for (cd = FIRST_ENT; cd < free_ent; cd++) - if ((prefix_of[cd] & 0x8000) != 0) - prefix_of[cd] = -1; - - /* find first cleared node as next free_ent */ - cd = FIRST_ENT; - while ((cd < maxcodemax) && (prefix_of[cd] != -1)) - cd++; - free_ent = cd; -} diff --git a/source/unzip/unz.h b/source/unzip/unz.h deleted file mode 100644 index 1ea7478..0000000 --- a/source/unzip/unz.h +++ /dev/null @@ -1,994 +0,0 @@ -/*--------------------------------------------------------------------------- - - unzip.h - - This header file is used by all of the unzip source files. Its contents - are divided into seven more-or-less separate sections: predefined macros, - OS-dependent includes, (mostly) OS-independent defines, typedefs, function - prototypes (or "prototypes," in the case of non-ANSI compilers), macros, - and global-variable declarations. - - ---------------------------------------------------------------------------*/ - -#include "zlib.h" - -/*****************************************/ -/* Predefined, Machine-specific Macros */ -/*****************************************/ - -#if (defined(__GO32__) && defined(unix)) /* DOS extender */ -# undef unix -#endif - -#if defined(unix) || defined(__convexc__) || defined(M_XENIX) -# ifndef UNIX -# define UNIX -# endif /* !UNIX */ -#endif /* unix || __convexc__ || M_XENIX */ - -/* Much of the following is swiped from zip's tailor.h: */ - -/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */ -#ifdef __POWERC -# define __TURBOC__ -# define MSDOS -#endif /* __POWERC */ -#if (defined(__TURBOC__) && defined(__MSDOS__) && !defined(MSDOS)) -# define MSDOS -#endif - -/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C, - * or Silicon Graphics, or Convex, or IBM C Set/2, or GNU gcc under emx, or - * or Watcom C, or Macintosh, or Windows NT. - */ -#if (__STDC__ || defined(MSDOS) || defined(sgi) || defined(CONVEX) || defined(__sun)) -# ifndef PROTO -# define PROTO -# endif -# define MODERN -#endif -#if (defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__)) -# ifndef PROTO -# define PROTO -# endif -# define MODERN -#endif -#if (defined(THINK_C) || defined(MPW) || defined(WIN32)) -# ifndef PROTO -# define PROTO -# endif -# define MODERN -#endif - -/* turn off prototypes if requested */ -#if (defined(NOPROTO) && defined(PROTO)) -# undef PROTO -#endif - -#if (defined(ultrix) || defined(bsd4_2) || defined(sun) || defined(pyr)) -# if (!defined(BSD) && !defined(__SYSTEM_FIVE) && !defined(SYSV)) -# define BSD -# endif /* !BSD && !__SYSTEM_FIVE && !SYSV */ -#endif /* ultrix || bsd4_2 || sun || pyr */ - -#if (defined(CONVEX) || defined(CRAY) || defined(__SYSTEM_FIVE)) -# ifndef TERMIO -# define TERMIO -# endif /* !TERMIO */ -#endif /* CONVEX || CRAY || __SYSTEM_FIVE */ - -#ifdef pyr /* Pyramid */ -# ifndef ZMEM -# define ZMEM -# endif /* !ZMEM */ -#endif /* pyr */ - -#ifdef CRAY -# ifdef ZMEM -# undef ZMEM -# endif /* ZMEM */ -#endif /* CRAY */ - -/* the i386 test below is to catch SCO Unix (which has redefinition - * warnings if param.h is included), but it probably doesn't hurt if - * other 386 Unixes get nailed, too...except now that 386BSD and BSDI - * exist. Sigh. <sys/param.h> is mostly included for "BSD", I think. - * [An alternate fix for SCO Unix is below.] - */ -#if (defined(MINIX) || (defined(i386) && defined(unix))) -# define NO_PARAM_H -#endif /* MINIX || (i386 && unix) */ - - - - - -/***************************/ -/* OS-Dependent Includes */ -/***************************/ - -#ifndef MINIX /* Minix needs it after all the other includes (?) */ -# include <stdio.h> -#endif -#include <ctype.h> /* skip for VMS, to use tolower() function? */ -#include <errno.h> /* used in mapname() */ -#ifndef NO_ERRNO -# define DECLARE_ERRNO /* everybody except MSC 6.0, SCO cc, Watcom C/386 */ -#endif /* !NO_ERRNO */ -#ifdef VMS -# include <types.h> /* (placed up here instead of in VMS section below */ -# include <stat.h> /* because types.h is used in some other headers) */ -#else /* !VMS */ -# if !defined(THINK_C) && !defined(MPW) -# include <sys/types.h> /* off_t, time_t, dev_t, ... */ -# include <sys/stat.h> -# endif /* !THINK_C && !MPW */ -#endif /* ?VMS */ - -#ifdef MODERN -# if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun))) -# include <stddef.h> -# endif -# if (!defined(__GNUC__) && !defined(apollo)) /* both define __STDC__ */ -# include <stdlib.h> /* standard library prototypes, malloc(), etc. */ -# else -# ifdef __EMX__ -# include <stdlib.h> /* emx IS gcc but has stdlib.h */ -# endif -# endif -# include <string.h> /* defines strcpy, strcmp, memcpy, etc. */ - typedef size_t extent; -#else /* !MODERN */ - char *malloc(); - char *strchr(), *strrchr(); - long lseek(); - typedef unsigned int extent; -# define void int -#endif /* ?MODERN */ - -/* this include must be down here for SysV.4, for some reason... */ -#include <signal.h> /* used in unzip.c, file_io.c */ - - - -/*--------------------------------------------------------------------------- - Next, a word from our Unix (mostly) sponsors: - ---------------------------------------------------------------------------*/ - -#ifdef UNIX -# ifdef AMIGA -# include <libraries/dos.h> -# else /* !AMIGA */ -# ifndef NO_PARAM_H -#if 0 /* [GRR: this is an alternate fix for SCO's redefinition bug] */ -# ifdef NGROUPS_MAX -# undef NGROUPS_MAX /* SCO bug: defined again in <param.h> */ -# endif /* NGROUPS_MAX */ -#endif /* 0 */ -# include <sys/param.h> /* conflict with <sys/types.h>, some systems? */ -# endif /* !NO_PARAM_H */ -# endif /* ?AMIGA */ - -# ifndef BSIZE -# ifdef MINIX -# define BSIZE 1024 -# else /* !MINIX */ -# define BSIZE DEV_BSIZE /* assume common for all Unix systems */ -# endif /* ?MINIX */ -# endif - -# ifndef BSD -# if (!defined(AMIGA) && !defined(MINIX)) -# define NO_MKDIR /* for mapname() */ -# endif /* !AMIGA && !MINIX */ -# include <time.h> - struct tm *gmtime(), *localtime(); -# else /* BSD */ -# include <sys/time.h> -# include <sys/timeb.h> -# ifdef _AIX -# include <time.h> -# endif -# endif - -#else /* !UNIX */ -# define BSIZE 512 /* disk block size */ -#endif /* ?UNIX */ - -#if (defined(V7) || defined(BSD)) -# define strchr index -# define strrchr rindex -#endif - -/*--------------------------------------------------------------------------- - And now, our MS-DOS and OS/2 corner: - ---------------------------------------------------------------------------*/ - -#ifdef __TURBOC__ -# define DOS_OS2 -# include <sys/timeb.h> /* for structure ftime */ -# ifndef __BORLANDC__ /* there appears to be a bug (?) in Borland's */ -# include <mem.h> /* MEM.H related to __STDC__ and far poin- */ -# endif /* ters. (dpk) [mem.h included for memcpy] */ -# include <dos.h> /* for REGS macro (at least for Turbo C 2.0) */ -#else /* NOT Turbo C (or Power C)... */ -# ifdef MSDOS /* but still MS-DOS, so we'll assume it's */ -# ifndef MSC /* Microsoft's compiler and fake the ID, if */ -# define MSC /* necessary (it is in 5.0; apparently not */ -# endif /* in 5.1 and 6.0) */ -# include <dos.h> /* for _dos_setftime() */ -# endif -#endif - -#if (defined(__IBMC__) && defined(__OS2__)) -# define DOS_OS2 -# define S_IFMT 0xF000 -# define timezone _timezone -#endif - -#ifdef __WATCOMC__ -# define DOS_OS2 -# define __32BIT__ -# ifdef DECLARE_ERRNO -# undef DECLARE_ERRNO -# endif -# undef far -# define far -#endif - -#ifdef __EMX__ -# define DOS_OS2 -# define __32BIT__ -# define far -#endif /* __EMX__ */ - -#ifdef MSC /* defined for all versions of MSC now */ -# define DOS_OS2 /* Turbo C under DOS, MSC under DOS or OS/2 */ -# if (defined(_MSC_VER) && (_MSC_VER >= 600)) /* new with 5.1 or 6.0 ... */ -# undef DECLARE_ERRNO /* errno is now a function in a dynamic link */ -# endif /* library (or something)--incompatible with */ -#endif /* the usual "extern int errno" declaration */ - -#ifdef DOS_OS2 /* defined for all MS-DOS and OS/2 compilers */ -# include <io.h> /* lseek(), open(), setftime(), dup(), creat() */ -# include <time.h> /* localtime() */ -#endif - -#ifdef OS2 /* defined for all OS/2 compilers */ -# ifdef isupper -# undef isupper -# endif -# ifdef tolower -# undef tolower -# endif -# define isupper(x) IsUpperNLS((unsigned char)(x)) -# define tolower(x) ToLowerNLS((unsigned char)(x)) -#endif - -#ifdef WIN32 -# include <io.h> /* read(), open(), etc. */ -# include <time.h> -# include <memory.h> -# include <direct.h> /* mkdir() */ -# ifdef FILE_IO_C -# include <fcntl.h> -# include <conio.h> -# include <sys\types.h> -# include <sys\utime.h> -# include <windows.h> -# define DOS_OS2 -# define getch() getchar() -# endif -#endif - -/*--------------------------------------------------------------------------- - Followed by some VMS (mostly) stuff: - ---------------------------------------------------------------------------*/ - -#ifdef VMS -# include <time.h> /* the usual non-BSD time functions */ -# include <file.h> /* same things as fcntl.h has */ -# include <rms.h> -# define _MAX_PATH NAM$C_MAXRSS /* to define FILNAMSIZ below */ -# define UNIX /* can share most of same code from now on */ -# define RETURN return_VMS /* VMS interprets return codes incorrectly */ -#else /* !VMS */ -# ifndef THINK_C -# define RETURN return /* only used in main() */ -# else -# define RETURN(v) { int n;\ - n = (v);\ - fprintf(stderr, "\npress <return> to continue ");\ - while (getc(stdin) != '\n');\ - putc('\n', stderr);\ - InitCursor();\ - goto start;\ - } -# endif -# ifdef V7 -# define O_RDONLY 0 -# define O_WRONLY 1 -# define O_RDWR 2 -# else /* !V7 */ -# ifdef MTS -# include <sys/file.h> /* MTS uses this instead of fcntl.h */ -# include <timeb.h> -# include <time.h> -# else /* !MTS */ -# ifdef COHERENT /* Coherent 3.10/Mark Williams C */ -# include <sys/fcntl.h> -# define SHORT_NAMES -# define tzset settz -# else /* !COHERENT */ -# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */ -# endif /* ?COHERENT */ -# endif /* ?MTS */ -# endif /* ?V7 */ -#endif /* ?VMS */ - -#if (defined(MSDOS) || defined(VMS)) -# define DOS_VMS -#endif - -/*--------------------------------------------------------------------------- - And some Mac stuff for good measure: - ---------------------------------------------------------------------------*/ - -#ifdef THINK_C -# define MACOS -# ifndef __STDC__ /* if Think C hasn't defined __STDC__ ... */ -# define __STDC__ 1 /* make sure it's defined: it needs it */ -# else /* __STDC__ defined */ -# if !__STDC__ /* sometimes __STDC__ is defined as 0; */ -# undef __STDC__ /* it needs to be 1 or required header */ -# define __STDC__ 1 /* files are not properly included. */ -# endif /* !__STDC__ */ -# endif /* ?defined(__STDC__) */ -#endif /* THINK_C */ - -#ifdef MPW -# define MACOS -# include <Errors.h> -# include <Files.h> -# include <Memory.h> -# include <Quickdraw.h> -# include <ToolUtils.h> -# define CtoPstr c2pstr -# define PtoCstr p2cstr -# ifdef CR -# undef CR -# endif -#endif /* MPW */ - -#ifdef MACOS -# define open(x,y) macopen(x,y, gnVRefNum, glDirID) -# define close macclose -# define read macread -# define write macwrite -# define lseek maclseek -# define creat(x,y) maccreat(x, gnVRefNum, glDirID, gostCreator, gostType) -# define stat(x,y) macstat(x,y,gnVRefNum, glDirID) - -# ifndef isascii -# define isascii(c) ((unsigned char)(c) <= 0x3F) -# endif - -# include "macstat.h" - -typedef struct _ZipExtraHdr { - unsigned short header; /* 2 bytes */ - unsigned short data; /* 2 bytes */ -} ZIP_EXTRA_HEADER; - -typedef struct _MacInfoMin { - unsigned short header; /* 2 bytes */ - unsigned short data; /* 2 bytes */ - unsigned long signature; /* 4 bytes */ - FInfo finfo; /* 16 bytes */ - unsigned long lCrDat; /* 4 bytes */ - unsigned long lMdDat; /* 4 bytes */ - unsigned long flags ; /* 4 bytes */ - unsigned long lDirID; /* 4 bytes */ - /*------------*/ -} MACINFOMIN; /* = 40 bytes for size of data */ - -typedef struct _MacInfo { - unsigned short header; /* 2 bytes */ - unsigned short data; /* 2 bytes */ - unsigned long signature; /* 4 bytes */ - FInfo finfo; /* 16 bytes */ - unsigned long lCrDat; /* 4 bytes */ - unsigned long lMdDat; /* 4 bytes */ - unsigned long flags ; /* 4 bytes */ - unsigned long lDirID; /* 4 bytes */ - char rguchVolName[28]; /* 28 bytes */ - /*------------*/ -} MACINFO; /* = 68 bytes for size of data */ -#endif /* MACOS */ - -/*--------------------------------------------------------------------------- - And finally, some random extra stuff: - ---------------------------------------------------------------------------*/ - -#ifdef MINIX -# include <stdio.h> -#endif - -#ifdef SHORT_NAMES /* Mark Williams C, ...? */ -# define extract_or_test_files xtr_or_tst_files -# define extract_or_test_member xtr_or_tst_member -#endif - -#ifdef MTS -# include <unix.h> /* Some important non-ANSI routines */ -# define mkdir(s,n) (-1) /* No "make directory" capability */ -# define EBCDIC /* Set EBCDIC conversion on */ -#endif - - - - - -/*************/ -/* Defines */ -/*************/ - -#ifndef WSIZE -# define WSIZE 0x8000 /* window size--must be a power of two, and */ -#endif /* !WSIZE */ /* at least 32K for zip's deflate method */ - -#define DIR_BLKSIZ 64 /* number of directory entries per block - * (should fit in 4096 bytes, usually) */ -#ifndef INBUFSIZ -# define INBUFSIZ 2048 /* works for MS-DOS small model */ -#endif /* !INBUFSIZ */ - -/* - * If <limits.h> exists on most systems, should include that, since it may - * define some or all of the following: NAME_MAX, PATH_MAX, _POSIX_NAME_MAX, - * _POSIX_PATH_MAX. - */ -#ifdef DOS_OS2 -# include <limits.h> -#endif /* DOS_OS2 */ - -#ifdef _MAX_PATH -# define FILNAMSIZ (_MAX_PATH) -#else /* !_MAX_PATH */ -# define FILNAMSIZ 1025 -#endif /* ?_MAX_PATH */ - -#ifndef PATH_MAX -# ifdef MAXPATHLEN /* defined in <sys/param.h> some systems */ -# define PATH_MAX MAXPATHLEN -# else -# if FILENAME_MAX > 255 /* used like PATH_MAX on some systems */ -# define PATH_MAX FILENAME_MAX -# else -# define PATH_MAX (FILNAMSIZ - 1) -# endif -# endif /* ?MAXPATHLEN */ -#endif /* !PATH_MAX */ - -#define OUTBUFSIZ INBUFSIZ - -#define ZSUFX ".zip" -#define CENTRAL_HDR_SIG "\113\001\002" /* the infamous "PK" signature */ -#define LOCAL_HDR_SIG "\113\003\004" /* bytes, sans "P" (so unzip */ -#define END_CENTRAL_SIG "\113\005\006" /* executable not mistaken for */ -#define EXTD_LOCAL_SIG "\113\007\010" /* zipfile itself) */ - -#define SKIP 0 /* choice of activities for do_string() */ -#define DISPLAY 1 -#define FILENAME 2 -#define EXTRA_FIELD 3 - -#define DOES_NOT_EXIST -1 /* return values for check_for_newer() */ -#define EXISTS_AND_OLDER 0 -#define EXISTS_AND_NEWER 1 - -#define DOS_OS2_FAT_ 0 /* version_made_by codes (central dir) */ -#define AMIGA_ 1 -#define VMS_ 2 /* make sure these are not defined on */ -#define UNIX_ 3 /* the respective systems!! (like, for */ -#define VM_CMS_ 4 /* instance, "VMS", or "UNIX": CFLAGS = */ -#define ATARI_ 5 /* -O -DUNIX) */ -#define OS2_HPFS_ 6 -#define MAC_ 7 -#define Z_SYSTEM_ 8 -#define CPM_ 9 -/* #define TOPS20_ 10? (TOPS20_ is to be defined in PKZIP 2.0...) */ -#define NUM_HOSTS 10 /* index of last system + 1 */ - -#define STORED 0 /* compression methods */ -#define SHRUNK 1 -#define REDUCED1 2 -#define REDUCED2 3 -#define REDUCED3 4 -#define REDUCED4 5 -#define IMPLODED 6 -#define TOKENIZED 7 -#define DEFLATED 8 -#define NUM_METHODS 9 /* index of last method + 1 */ -/* don't forget to update list_files() appropriately if NUM_METHODS changes */ - -#define DF_MDY 0 /* date format 10/26/91 (USA only) */ -#define DF_DMY 1 /* date format 26/10/91 (most of the world) */ -#define DF_YMD 2 /* date format 91/10/26 (a few countries) */ - -#define UNZIP_VERSION 20 /* compatible with PKUNZIP 2.0 */ -#define VMS_VERSION 42 /* if OS-needed-to-extract is VMS: can do */ - -/*--------------------------------------------------------------------------- - True sizes of the various headers, as defined by PKWare--so it is not - likely that these will ever change. But if they do, make sure both these - defines AND the typedefs below get updated accordingly. - ---------------------------------------------------------------------------*/ -#define LREC_SIZE 26 /* lengths of local file headers, central */ -#define CREC_SIZE 42 /* directory headers, and the end-of- */ -#define ECREC_SIZE 18 /* central-dir record, respectively */ - -#define MAX_BITS 13 /* used in unShrink() */ -#define HSIZE (1 << MAX_BITS) /* size of global work area */ - -#define LF 10 /* '\n' on ASCII machines. Must be 10 due to EBCDIC */ -#define CR 13 /* '\r' on ASCII machines. Must be 13 due to EBCDIC */ -#define CTRLZ 26 /* DOS & OS/2 EOF marker (used in file_io.c, vms.c) */ - -#ifdef EBCDIC -# define ascii_to_native(c) ebcdic[(c)] -# define NATIVE "EBCDIC" -#endif - -#if MPW -# define FFLUSH putc('\n',stderr); -#else /* !MPW */ -# define FFLUSH fflush(stderr); -#endif /* ?MPW */ - -#ifdef VMS -# define ENV_UNZIP "UNZIP_OPTS" /* name of environment variable */ -# define ENV_ZIPINFO "ZIPINFO_OPTS" -#else /* !VMS */ -# define ENV_UNZIP "UNZIP" -# define ENV_ZIPINFO "ZIPINFO" -#endif /* ?VMS */ - -#ifdef CRYPT -# define PWLEN 80 -# define DECRYPT(b) (update_keys(t=((b)&0xff)^decrypt_byte()),t) -#endif /* CRYPT */ - -#ifdef QQ /* Newtware version */ -# define QCOND (!quietflg) /* for no file comments with -vq or -vqq */ -#else /* (original) Bill Davidsen version */ -# define QCOND (which_hdr) /* no way to kill file comments with -v, -l */ -#endif - -#ifndef TRUE -# define TRUE 1 /* sort of obvious */ -#endif -#ifndef FALSE -# define FALSE 0 -#endif - -#ifndef SEEK_SET /* These should all be declared in stdio.h! But */ -# define SEEK_SET 0 /* since they're not (in many cases), do so here. */ -# define SEEK_CUR 1 -# define SEEK_END 2 -#endif - -#ifndef S_IRUSR -# define S_IRWXU 00700 /* read, write, execute: owner */ -# define S_IRUSR 00400 /* read permission: owner */ -# define S_IWUSR 00200 /* write permission: owner */ -# define S_IXUSR 00100 /* execute permission: owner */ -# define S_IRWXG 00070 /* read, write, execute: group */ -# define S_IRGRP 00040 /* read permission: group */ -# define S_IWGRP 00020 /* write permission: group */ -# define S_IXGRP 00010 /* execute permission: group */ -# define S_IRWXO 00007 /* read, write, execute: other */ -# define S_IROTH 00004 /* read permission: other */ -# define S_IWOTH 00002 /* write permission: other */ -# define S_IXOTH 00001 /* execute permission: other */ -#endif /* !S_IRUSR */ - -#ifdef ZIPINFO /* these are individually checked because SysV doesn't */ -# ifndef S_IFBLK /* have some of them, Microsoft C others, etc. */ -# define S_IFBLK 0060000 /* block special */ -# endif -# ifndef S_IFIFO /* in Borland C, not MSC */ -# define S_IFIFO 0010000 /* fifo */ -# endif -# ifndef S_IFLNK /* in BSD, not SysV */ -# define S_IFLNK 0120000 /* symbolic link */ -# endif -# ifndef S_IFSOCK /* in BSD, not SysV */ -# define S_IFSOCK 0140000 /* socket */ -# endif -# ifndef S_ISUID -# define S_ISUID 04000 /* set user id on execution */ -# endif -# ifndef S_ISGID -# define S_ISGID 02000 /* set group id on execution */ -# endif -# ifndef S_ISVTX -# define S_ISVTX 01000 /* directory permissions control */ -# endif -# ifndef S_ENFMT -# define S_ENFMT S_ISGID /* record locking enforcement flag */ -# endif -#endif /* ZIPINFO */ - - - - - -/**************/ -/* Typedefs */ -/**************/ - -#ifndef _BULL_SOURCE /* Bull has it defined somewhere already */ - typedef unsigned char byte; /* code assumes UNSIGNED bytes */ -#endif /* !_BULL_SOURCE */ - -typedef char boolean; -typedef long longint; -typedef unsigned short UWORD; -typedef unsigned long ULONG; -typedef unsigned char uch; -typedef unsigned short ush; -typedef unsigned long ulg; - -typedef struct min_info { - unsigned unix_attr; - unsigned dos_attr; - int hostnum; - longint offset; - ULONG compr_size; /* compressed size (needed if extended header) */ - ULONG crc; /* crc (needed if extended header) */ - unsigned encrypted : 1; /* file encrypted: decrypt before uncompressing */ - unsigned ExtLocHdr : 1; /* use time instead of CRC for decrypt check */ - unsigned text : 1; /* file is text or binary */ - unsigned lcflag : 1; /* convert filename to lowercase */ -} min_info; - -typedef struct VMStimbuf { - char *revdate; /* (both correspond to Unix modtime/st_mtime) */ - char *credate; -} VMStimbuf; - -/*--------------------------------------------------------------------------- - Zipfile layout declarations. If these headers ever change, make sure the - xxREC_SIZE defines (above) change with them! - ---------------------------------------------------------------------------*/ - - typedef byte local_byte_hdr[ LREC_SIZE ]; -# define L_VERSION_NEEDED_TO_EXTRACT_0 0 -# define L_VERSION_NEEDED_TO_EXTRACT_1 1 -# define L_GENERAL_PURPOSE_BIT_FLAG 2 -# define L_COMPRESSION_METHOD 4 -# define L_LAST_MOD_FILE_TIME 6 -# define L_LAST_MOD_FILE_DATE 8 -# define L_CRC32 10 -# define L_COMPRESSED_SIZE 14 -# define L_UNCOMPRESSED_SIZE 18 -# define L_FILENAME_LENGTH 22 -# define L_EXTRA_FIELD_LENGTH 24 - - typedef byte cdir_byte_hdr[ CREC_SIZE ]; -# define C_VERSION_MADE_BY_0 0 -# define C_VERSION_MADE_BY_1 1 -# define C_VERSION_NEEDED_TO_EXTRACT_0 2 -# define C_VERSION_NEEDED_TO_EXTRACT_1 3 -# define C_GENERAL_PURPOSE_BIT_FLAG 4 -# define C_COMPRESSION_METHOD 6 -# define C_LAST_MOD_FILE_TIME 8 -# define C_LAST_MOD_FILE_DATE 10 -# define C_CRC32 12 -# define C_COMPRESSED_SIZE 16 -# define C_UNCOMPRESSED_SIZE 20 -# define C_FILENAME_LENGTH 24 -# define C_EXTRA_FIELD_LENGTH 26 -# define C_FILE_COMMENT_LENGTH 28 -# define C_DISK_NUMBER_START 30 -# define C_INTERNAL_FILE_ATTRIBUTES 32 -# define C_EXTERNAL_FILE_ATTRIBUTES 34 -# define C_RELATIVE_OFFSET_LOCAL_HEADER 38 - - typedef byte ec_byte_rec[ ECREC_SIZE+4 ]; -/* define SIGNATURE 0 space-holder only */ -# define NUMBER_THIS_DISK 4 -# define NUM_DISK_WITH_START_CENTRAL_DIR 6 -# define NUM_ENTRIES_CENTRL_DIR_THS_DISK 8 -# define TOTAL_ENTRIES_CENTRAL_DIR 10 -# define SIZE_CENTRAL_DIRECTORY 12 -# define OFFSET_START_CENTRAL_DIRECTORY 16 -# define ZIPFILE_COMMENT_LENGTH 20 - - - typedef struct local_file_header { /* LOCAL */ - byte version_needed_to_extract[2]; - UWORD general_purpose_bit_flag; - UWORD compression_method; - UWORD last_mod_file_time; - UWORD last_mod_file_date; - ULONG crc32; - ULONG compressed_size; - ULONG uncompressed_size; - UWORD filename_length; - UWORD extra_field_length; - } local_file_hdr; - - typedef struct central_directory_file_header { /* CENTRAL */ - byte version_made_by[2]; - byte version_needed_to_extract[2]; - UWORD general_purpose_bit_flag; - UWORD compression_method; - UWORD last_mod_file_time; - UWORD last_mod_file_date; - ULONG crc32; - ULONG compressed_size; - ULONG uncompressed_size; - UWORD filename_length; - UWORD extra_field_length; - UWORD file_comment_length; - UWORD disk_number_start; - UWORD internal_file_attributes; - ULONG external_file_attributes; - ULONG relative_offset_local_header; - } cdir_file_hdr; - - typedef struct end_central_dir_record { /* END CENTRAL */ - UWORD number_this_disk; - UWORD num_disk_with_start_central_dir; - UWORD num_entries_centrl_dir_ths_disk; - UWORD total_entries_central_dir; - ULONG size_central_directory; - ULONG offset_start_central_directory; - UWORD zipfile_comment_length; - } ecdir_rec; - - - - - -/*************************/ -/* Function Prototypes */ -/*************************/ - -#ifndef __ -# define __ OF -#endif - -/*--------------------------------------------------------------------------- - Decompression functions: - ---------------------------------------------------------------------------*/ - -int explode (); -void unReduce (); -void unShrink (); - -/*--------------------------------------------------------------------------- - Functions in file_io.c and crypt.c: - ---------------------------------------------------------------------------*/ - -int FillBitBuffer (); -int ReadByte __((UWORD *x)); /* file_io.c */ - -/************/ -/* Macros */ -/************/ - -#ifndef MAX -# define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef MIN -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - - -#define LSEEK(abs_offset) {longint request=(abs_offset)+extra_bytes,\ - inbuf_offset=request%INBUFSIZ, bufstart=request-inbuf_offset;\ - if(request<0) {fprintf(stderr, SeekMsg, ReportMsg); return(3);}\ - else if(bufstart!=cur_zipfile_bufstart)\ - {cur_zipfile_bufstart=lseek(zipfd,bufstart,SEEK_SET);\ - if((incnt=read(zipfd,(char *)inbuf,INBUFSIZ))<=0) return(51);\ - inptr=inbuf+(int)inbuf_offset; incnt-=(int)inbuf_offset;} else\ - {incnt+=(inptr-inbuf)-(int)inbuf_offset; inptr=inbuf+(int)inbuf_offset;}} - -/* - * Seek to the block boundary of the block which includes abs_offset, - * then read block into input buffer and set pointers appropriately. - * If block is already in the buffer, just set the pointers. This macro - * is used by process_end_central_dir (unzip.c) and do_string (misc.c). - * A slightly modified version is embedded within extract_or_test_files - * (unzip.c). ReadByte and readbuf (file_io.c) are compatible. - * - * macro LSEEK(abs_offset) - * ULONG abs_offset; - * { - * longint request = abs_offset + extra_bytes; - * longint inbuf_offset = request % INBUFSIZ; - * longint bufstart = request - inbuf_offset; - * - * if (request < 0) { - * fprintf(stderr, SeekMsg, ReportMsg); - * return(3); /-* 3: severe error in zipfile *-/ - * } else if (bufstart != cur_zipfile_bufstart) { - * cur_zipfile_bufstart = lseek(zipfd, bufstart, SEEK_SET); - * if ((incnt = read(zipfd,inbuf,INBUFSIZ)) <= 0) - * return(51); /-* 51: unexpected EOF *-/ - * inptr = inbuf + (int)inbuf_offset; - * incnt -= (int)inbuf_offset; - * } else { - * incnt += (inptr-inbuf) - (int)inbuf_offset; - * inptr = inbuf + (int)inbuf_offset; - * } - * } - * - */ - - -#define SKIP_(length) if(length&&((error=do_string(length,SKIP))!=0))\ - {error_in_archive=error; if(error>1) return error;} - -/* - * Skip a variable-length field, and report any errors. Used in zipinfo.c - * and unzip.c in several functions. - * - * macro SKIP_(length) - * UWORD length; - * { - * if (length && ((error = do_string(length, SKIP)) != 0)) { - * error_in_archive = error; /-* might be warning *-/ - * if (error > 1) /-* fatal *-/ - * return (error); - * } - * } - * - */ - -#define READBIT(nbits,zdest) {if(nbits>bits_left) FillBitBuffer();\ - zdest=(int)((UWORD)bitbuf&mask_bits[nbits]);bitbuf>>=nbits;bits_left-=nbits;} - -/* - * macro READBIT(nbits,zdest) - * { - * if (nbits > bits_left) - * FillBitBuffer(); - * zdest = (int)((UWORD)bitbuf & mask_bits[nbits]); - * bitbuf >>= nbits; - * bits_left -= nbits; - * } - * - */ - - -#define PEEKBIT(nbits) (nbits>bits_left? (FillBitBuffer(),\ - (UWORD)bitbuf & mask_bits[nbits]) : (UWORD)bitbuf & mask_bits[nbits]) - - -#define NUKE_CRs(buf,len) {register int i,j; for (i=j=0; j<len;\ - (buf)[i++]=(buf)[j++]) if ((buf)[j]=='\r') ++j; len=i;} - -/* - * Remove all the ASCII carriage returns from buffer buf (length len), - * shortening as necessary (note that len gets modified in the process, - * so it CANNOT be an expression). This macro is intended to be used - * BEFORE A_TO_N(); hence the check for CR instead of '\r'. NOTE: The - * if-test gets performed one time too many, but it doesn't matter. - * - * macro NUKE_CRs(buf,len) - * { - * register int i, j; - * - * for (i = j = 0; j < len; (buf)[i++] = (buf)[j++]) - * if ((buf)[j] == CR) - * ++j; - * len = i; - * } - * - */ - - -#define TOLOWER(str1,str2) {char *ps1,*ps2; ps1=(str1)-1; ps2=(str2);\ - while(*++ps1) *ps2++=(char)(isupper((int)(*ps1))?tolower((int)(*ps1)):*ps1);\ - *ps2='\0';} - -/* - * Copy the zero-terminated string in str1 into str2, converting any - * uppercase letters to lowercase as we go. str2 gets zero-terminated - * as well, of course. str1 and str2 may be the same character array. - * - * macro TOLOWER( str1, str2 ) - * { - * char *ps1, *ps2; - * - * ps1 = (str1) - 1; - * ps2 = (str2); - * while (*++ps1) - * *ps2++ = (char)(isupper((int)(*ps1))? tolower((int)(*ps1)) : *ps1); - * *ps2='\0'; - * } - * - * NOTES: This macro makes no assumptions about the characteristics of - * the tolower() function or macro (beyond its existence), nor does it - * make assumptions about the structure of the character set (i.e., it - * should work on EBCDIC machines, too). The fact that either or both - * of isupper() and tolower() may be macros has been taken into account; - * watch out for "side effects" (in the C sense) when modifying this - * macro. - */ - - -#ifndef ascii_to_native -# define ascii_to_native(c) (c) -# define A_TO_N(str1) -#else -# ifndef NATIVE -# define NATIVE "native chars" -# endif -# define A_TO_N(str1) {register unsigned char *ps1;\ - for (ps1=str1; *ps1; ps1++) *ps1=ascii_to_native(*ps1);} -#endif - -/* - * Translate the zero-terminated string in str1 from ASCII to the native - * character set. The translation is performed in-place and uses the - * ascii_to_native macro to translate each character. - * - * macro A_TO_N( str1 ) - * { - * register unsigned char *ps1; - * - * for (ps1 = str1; *ps1; ++ps1) - * *ps1 = ascii_to_native(*ps1); - * } - * - * NOTE: Using the ascii_to_native macro means that is it the only part of - * unzip which knows which translation table (if any) is actually in use - * to produce the native character set. This makes adding new character - * set translation tables easy, insofar as all that is needed is an - * appropriate ascii_to_native macro definition and the translation - * table itself. Currently, the only non-ASCII native character set - * implemented is EBCDIC, but this may not always be so. - */ - -/*************/ -/* Globals */ -/*************/ - -#ifdef MACOS - union work { - struct { - short *Prefix_of; /* (8193 * sizeof(short)) */ - byte *Suffix_of; - byte *Stack; - } shrink; - byte *Slide; - }; -#else - union work { - struct { - short Prefix_of[HSIZE + 2]; /* (8194 * sizeof(short)) */ - byte Suffix_of[HSIZE + 2]; /* also s-f length_nodes (smaller) */ - byte Stack[HSIZE + 2]; /* also s-f distance_nodes (smaller) */ - } shrink; - byte Slide[WSIZE]; - }; -#endif - extern union work area; - -# define prefix_of area.shrink.Prefix_of -# define suffix_of area.shrink.Suffix_of -# define stack area.shrink.Stack -# define slide area.Slide - - extern ULONG crc32val; - extern UWORD mask_bits[]; - extern int bits_left; - extern ULONG bitbuf; - extern boolean zipeof; - diff --git a/source/unzip/unzip.c b/source/unzip/unzip.c deleted file mode 100644 index 54695c2..0000000 --- a/source/unzip/unzip.c +++ /dev/null @@ -1,1224 +0,0 @@ -/* - * unzip.c -- IO on .zip files using zlib Version 0.15 beta, Mar 19th, 1998, - * - * Read unzip.h for more info - */ - - -//#include <stdio.h> -//#include <stdlib.h> -#include "fs_api.h" -#include "ds2_malloc.h" -#include <string.h> -#include "zlib.h" -#include "unzip.h" -#include "unzipP.h" - -#ifdef STDC -//#include <stddef.h> -//#include <string.h> -//#include <stdlib.h> -#endif - -#ifdef NO_ERRNO_H -extern int errno; -#else -#include <errno.h> -#endif - -const char unz_copyright[] = -" unzip 0.15 Copyright 1998 Gilles Vollant "; - -void unShrink (); -void unReduce (); -int explode (); - -/* - * =========================================================================== - * Read a byte from a gz_stream; update next_in and avail_in. Return EOF for - * end of file. IN assertion: the stream s has been sucessfully opened for - * reading. - */ - - -local int -unzlocal_getByte (FILE * fin, int *pi) -{ - unsigned char c; - int err = fread (&c, 1, 1, fin); - if (err == 1) - { - *pi = (int) c; - return UNZ_OK; - } else - { - if (ferror (fin)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } -} - - -/* - * =========================================================================== - * Reads a long in LSB order from the given gz_stream. Sets - */ -local int -unzlocal_getShort (FILE * fin, uLong * pX) -{ - uLong x; - int i; - int err; - - err = unzlocal_getByte (fin, &i); - x = (uLong) i; - - if (err == UNZ_OK) - err = unzlocal_getByte (fin, &i); - x += ((uLong) i) << 8; - - if (err == UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int -unzlocal_getLong (FILE * fin, uLong * pX) -{ - uLong x; - int i; - int err; - - err = unzlocal_getByte (fin, &i); - x = (uLong) i; - - if (err == UNZ_OK) - err = unzlocal_getByte (fin, &i); - x += ((uLong) i) << 8; - - if (err == UNZ_OK) - err = unzlocal_getByte (fin, &i); - x += ((uLong) i) << 16; - - if (err == UNZ_OK) - err = unzlocal_getByte (fin, &i); - x += ((uLong) i) << 24; - - if (err == UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - - -/* My own strcmpi / strcasecmp */ -local int -strcmpcasenosensitive_internal (const char *fileName1, const char *fileName2) -{ - for (;;) - { - char c1 = *(fileName1++); - char c2 = *(fileName2++); - if ((c1 >= 'a') && (c1 <= 'z')) - c1 -= 0x20; - if ((c2 >= 'a') && (c2 <= 'z')) - c2 -= 0x20; - if (c1 == '\0') - return ((c2 == '\0') ? 0 : -1); - if (c2 == '\0') - return 1; - if (c1 < c2) - return -1; - if (c1 > c2) - return 1; - } -} - - -#ifdef CASESENSITIVITYDEFAULT_NO -#define CASESENSITIVITYDEFAULTVALUE 2 -#else -#define CASESENSITIVITYDEFAULTVALUE 1 -#endif - -#ifndef STRCMPCASENOSENTIVEFUNCTION -#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal -#endif - -/* - * Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, - * comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, - * comparision is not case sensitivity (like strcmpi or strcasecmp) If - * iCaseSenisivity = 0, case sensitivity is defaut of your operating system - * (like 1 on Unix, 2 on Windows) - * - */ -extern int ZEXPORT -unzStringFileNameCompare (const char *fileName1, const char *fileName2, int iCaseSensitivity) -{ - if (iCaseSensitivity == 0) - iCaseSensitivity = CASESENSITIVITYDEFAULTVALUE; - - if (iCaseSensitivity == 1) - return strcmp (fileName1, fileName2); - - return STRCMPCASENOSENTIVEFUNCTION (fileName1, fileName2); -} - -#define BUFREADCOMMENT (0x400) - -/* - * Locate the Central directory of a zipfile (at the end, just before the - * global comment) - */ -local uLong -unzlocal_SearchCentralDir (FILE * fin) -{ - unsigned char *buf; - uLong uSizeFile; - uLong uBackRead; - uLong uMaxBack = 0xffff; /* maximum size of global comment */ - uLong uPosFound = 0; - - if (fseek (fin, 0, SEEK_END) != 0) - return 0; - - uSizeFile = ftell (fin); - - if (uMaxBack > uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char *) ALLOC (BUFREADCOMMENT + 4); - if (buf == NULL) - return 0; - - uBackRead = 4; - while (uBackRead < uMaxBack) - { - uLong uReadSize, uReadPos; - int i; - if (uBackRead + BUFREADCOMMENT > uMaxBack) - uBackRead = uMaxBack; - else - uBackRead += BUFREADCOMMENT; - uReadPos = uSizeFile - uBackRead; - - uReadSize = ((BUFREADCOMMENT + 4) < (uSizeFile - uReadPos)) ? - (BUFREADCOMMENT + 4) : (uSizeFile - uReadPos); - if (fseek (fin, uReadPos, SEEK_SET) != 0) - break; - - if (fread (buf, (uInt) uReadSize, 1, fin) != 1) - break; - - for (i = 0; i < (int) uReadSize - 3; i++) - if (((*(buf + i)) == 0x50) && ((*(buf + i + 1)) == 0x4b) && - ((*(buf + i + 2)) == 0x05) && ((*(buf + i + 3)) == 0x06)) - { - uPosFound = uReadPos + i; - break; - } - if (uPosFound != 0) - break; - } - TRYFREE (buf); - return uPosFound; -} - -/* - * Open a Zip file. path contain the full pathname (by example, on a Windows - * NT computer "c:\\test\\zlib109.zip" or on an Unix computer - * "zlib/zlib109.zip". If the zipfile cannot be opened (file don't exist or - * in not valid), the return value is NULL. Else, the return value is a - * unzFile Handle, usable with other function of this unzip package. - */ -extern unzFile ZEXPORT -unzOpen (const char *path) -{ - unz_s us; - unz_s *s; - uLong central_pos, uL; - FILE *fin; - - uLong number_disk;/* number of the current dist, used for - * spaning ZIP, unsupported, always 0 */ - uLong number_disk_with_CD; /* number the the disk with - * central dir, used for - * spaning ZIP, unsupported, - * always 0 */ - uLong number_entry_CD; /* total number of entries in the - * central dir (same than - * number_entry on nospan) */ - - int err = UNZ_OK; - - if (unz_copyright[0] != ' ') - return NULL; - - fin = fopen (path, "rb"); - if (fin == NULL) - return NULL; - - central_pos = unzlocal_SearchCentralDir (fin); - if (central_pos == 0) - err = UNZ_ERRNO; - - if (fseek (fin, central_pos, SEEK_SET) != 0) - err = UNZ_ERRNO; - - /* the signature, already checked */ - if (unzlocal_getLong (fin, &uL) != UNZ_OK) - err = UNZ_ERRNO; - - /* number of this disk */ - if (unzlocal_getShort (fin, &number_disk) != UNZ_OK) - err = UNZ_ERRNO; - - /* number of the disk with the start of the central directory */ - if (unzlocal_getShort (fin, &number_disk_with_CD) != UNZ_OK) - err = UNZ_ERRNO; - - /* total number of entries in the central dir on this disk */ - if (unzlocal_getShort (fin, &us.gi.number_entry) != UNZ_OK) - err = UNZ_ERRNO; - - /* total number of entries in the central dir */ - if (unzlocal_getShort (fin, &number_entry_CD) != UNZ_OK) - err = UNZ_ERRNO; - - if ((number_entry_CD != us.gi.number_entry) || - (number_disk_with_CD != 0) || - (number_disk != 0)) - err = UNZ_BADZIPFILE; - - /* size of the central directory */ - if (unzlocal_getLong (fin, &us.size_central_dir) != UNZ_OK) - err = UNZ_ERRNO; - - /* - * offset of start of central directory with respect to the starting disk - * number - */ - if (unzlocal_getLong (fin, &us.offset_central_dir) != UNZ_OK) - err = UNZ_ERRNO; - - /* zipfile comment length */ - if (unzlocal_getShort (fin, &us.gi.size_comment) != UNZ_OK) - err = UNZ_ERRNO; - - if ((central_pos < us.offset_central_dir + us.size_central_dir) && - (err == UNZ_OK)) - err = UNZ_BADZIPFILE; - - if (err != UNZ_OK) - { - fclose (fin); - return NULL; - } - us.file = fin; - us.byte_before_the_zipfile = central_pos - - (us.offset_central_dir + us.size_central_dir); - us.central_pos = central_pos; - us.pfile_in_zip_read = NULL; - - - s = (unz_s *) ALLOC (sizeof (unz_s)); - *s = us; - unzGoToFirstFile ((unzFile) s); - return (unzFile) s; -} - - -/* - * Close a ZipFile opened with unzipOpen. If there is files inside the .Zip - * opened with unzipOpenCurrentFile (see later), these files MUST be closed - * with unzipCloseCurrentFile before call unzipClose. return UNZ_OK if there - * is no problem. - */ -extern int ZEXPORT -unzClose (unzFile file) -{ - unz_s *s; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile (file); - - fclose (s->file); - TRYFREE (s); - return UNZ_OK; -} - - -/* - * Write info about the ZipFile in the *pglobal_info structure. No - * preparation of the structure is needed return UNZ_OK if there is no - * problem. - */ -extern int ZEXPORT -unzGetGlobalInfo (unzFile file, unz_global_info * pglobal_info) -{ - unz_s *s; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - *pglobal_info = s->gi; - return UNZ_OK; -} - - -/* - * Translate date/time from Dos format to tm_unz (readable more easilty) - */ -local void -unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz * ptm) -{ - uLong uDate; - uDate = (uLong) (ulDosDate >> 16); - ptm->tm_mday = (uInt) (uDate & 0x1f); - ptm->tm_mon = (uInt) ((((uDate) & 0x1E0) / 0x20) - 1); - ptm->tm_year = (uInt) (((uDate & 0x0FE00) / 0x0200) + 1980); - - ptm->tm_hour = (uInt) ((ulDosDate & 0xF800) / 0x800); - ptm->tm_min = (uInt) ((ulDosDate & 0x7E0) / 0x20); - ptm->tm_sec = (uInt) (2 * (ulDosDate & 0x1f)); -} - -/* - * Get Info about the current file in the zipfile, with internal only info - */ -local int unzlocal_GetCurrentFileInfoInternal -OF ((unzFile file, - unz_file_info * pfile_info, - unz_file_info_internal - * pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); - - local int unzlocal_GetCurrentFileInfoInternal ( - unzFile file, - unz_file_info * pfile_info, - unz_file_info_internal * pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize) -{ - unz_s *s; - unz_file_info file_info; - unz_file_info_internal file_info_internal; - int err = UNZ_OK; - uLong uMagic; - long lSeek = 0; - - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - if (fseek (s->file, s->pos_in_central_dir + s->byte_before_the_zipfile, SEEK_SET) != 0) - err = UNZ_ERRNO; - - - /* we check the magic */ - if (err == UNZ_OK) - { - if (unzlocal_getLong (s->file, &uMagic) != UNZ_OK) - err = UNZ_ERRNO; - else if (uMagic != 0x02014b50) - err = UNZ_BADZIPFILE; - } - if (unzlocal_getShort (s->file, &file_info.version) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.version_needed) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.flag) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.compression_method) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getLong (s->file, &file_info.dosDate) != UNZ_OK) - err = UNZ_ERRNO; - - unzlocal_DosDateToTmuDate (file_info.dosDate, &file_info.tmu_date); - - if (unzlocal_getLong (s->file, &file_info.crc) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getLong (s->file, &file_info.compressed_size) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getLong (s->file, &file_info.uncompressed_size) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.size_filename) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.size_file_extra) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.size_file_comment) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.disk_num_start) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &file_info.internal_fa) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getLong (s->file, &file_info.external_fa) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getLong (s->file, &file_info_internal.offset_curfile) != UNZ_OK) - err = UNZ_ERRNO; - - lSeek += file_info.size_filename; - if ((err == UNZ_OK) && (szFileName != NULL)) - { - uLong uSizeRead; - if (file_info.size_filename < fileNameBufferSize) - { - *(szFileName + file_info.size_filename) = '\0'; - uSizeRead = file_info.size_filename; - } else - uSizeRead = fileNameBufferSize; - - if ((file_info.size_filename > 0) && (fileNameBufferSize > 0)) - if (fread (szFileName, (uInt) uSizeRead, 1, s->file) != 1) - err = UNZ_ERRNO; - lSeek -= uSizeRead; - } - if ((err == UNZ_OK) && (extraField != NULL)) - { - uLong uSizeRead; - if (file_info.size_file_extra < extraFieldBufferSize) - uSizeRead = file_info.size_file_extra; - else - uSizeRead = extraFieldBufferSize; - - if (lSeek != 0) - { - if (fseek (s->file, lSeek, SEEK_CUR) == 0) - lSeek = 0; - else - err = UNZ_ERRNO; - } - if ((file_info.size_file_extra > 0) && (extraFieldBufferSize > 0)) - if (fread (extraField, (uInt) uSizeRead, 1, s->file) != 1) - err = UNZ_ERRNO; - lSeek += file_info.size_file_extra - uSizeRead; - } else - lSeek += file_info.size_file_extra; - - - if ((err == UNZ_OK) && (szComment != NULL)) - { - uLong uSizeRead; - if (file_info.size_file_comment < commentBufferSize) - { - *(szComment + file_info.size_file_comment) = '\0'; - uSizeRead = file_info.size_file_comment; - } else - uSizeRead = commentBufferSize; - - if (lSeek != 0) - { - if (fseek (s->file, lSeek, SEEK_CUR) == 0) - lSeek = 0; - else - err = UNZ_ERRNO; - } - if ((file_info.size_file_comment > 0) && (commentBufferSize > 0)) - if (fread (szComment, (uInt) uSizeRead, 1, s->file) != 1) - err = UNZ_ERRNO; - lSeek += file_info.size_file_comment - uSizeRead; - } else - lSeek += file_info.size_file_comment; - - if ((err == UNZ_OK) && (pfile_info != NULL)) - *pfile_info = file_info; - - if ((err == UNZ_OK) && (pfile_info_internal != NULL)) - *pfile_info_internal = file_info_internal; - - return err; -} - - - -/* - * Write info about the ZipFile in the *pglobal_info structure. No - * preparation of the structure is needed return UNZ_OK if there is no - * problem. - */ -extern int ZEXPORT -unzGetCurrentFileInfo ( - unzFile file, - unz_file_info * pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize) -{ - return unzlocal_GetCurrentFileInfoInternal (file, pfile_info, NULL, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize); -} - -/* - * Set the current file of the zipfile to the first file. return UNZ_OK if - * there is no problem - */ -extern int ZEXPORT -unzGoToFirstFile (unzFile file) -{ - int err = UNZ_OK; - unz_s *s; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - s->pos_in_central_dir = s->offset_central_dir; - s->num_file = 0; - err = unzlocal_GetCurrentFileInfoInternal (file, &s->cur_file_info, - &s->cur_file_info_internal, - NULL, 0, NULL, 0, NULL, 0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - * Set the current file of the zipfile to the next file. return UNZ_OK if - * there is no problem return UNZ_END_OF_LIST_OF_FILE if the actual file was - * the latest. - */ -extern int ZEXPORT -unzGoToNextFile (unzFile file) -{ - unz_s *s; - int err; - - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - if (s->num_file + 1 == s->gi.number_entry) - return UNZ_END_OF_LIST_OF_FILE; - - s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment; - s->num_file++; - err = unzlocal_GetCurrentFileInfoInternal (file, &s->cur_file_info, - &s->cur_file_info_internal, - NULL, 0, NULL, 0, NULL, 0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - * Try locate the file szFileName in the zipfile. For the iCaseSensitivity - * signification, see unzipStringFileNameCompare - * - * return value : UNZ_OK if the file is found. It becomes the current file. - * UNZ_END_OF_LIST_OF_FILE if the file is not found - */ -extern int ZEXPORT -unzLocateFile ( - unzFile file, - const char *szFileName, - int iCaseSensitivity) -{ - unz_s *s; - int err; - - - uLong num_fileSaved; - uLong pos_in_central_dirSaved; - - - if (file == NULL) - return UNZ_PARAMERROR; - - if (strlen (szFileName) >= UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; - - s = (unz_s *) file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - num_fileSaved = s->num_file; - pos_in_central_dirSaved = s->pos_in_central_dir; - - err = unzGoToFirstFile (file); - - while (err == UNZ_OK) - { - char szCurrentFileName[UNZ_MAXFILENAMEINZIP + 1]; - unzGetCurrentFileInfo (file, NULL, - szCurrentFileName, sizeof (szCurrentFileName) - 1, - NULL, 0, NULL, 0); - if (unzStringFileNameCompare (szCurrentFileName, - szFileName, iCaseSensitivity) == 0) - return UNZ_OK; - err = unzGoToNextFile (file); - } - - s->num_file = num_fileSaved; - s->pos_in_central_dir = pos_in_central_dirSaved; - return err; -} - - -/* - * Read the local header of the current zipfile Check the coherency of the - * local header and info in the end of central directory about this file - * store in *piSizeVar the size of extra info in local header (filename and - * size of extra field data) - */ -local int -unzlocal_CheckCurrentFileCoherencyHeader ( - unz_s * s, - uInt * piSizeVar, - uLong * poffset_local_extrafield, - uInt * psize_local_extrafield) -{ - uLong uMagic, uData, uFlags; - uLong size_filename; - uLong size_extra_field; - int err = UNZ_OK; - - *piSizeVar = 0; - *poffset_local_extrafield = 0; - *psize_local_extrafield = 0; - - if (fseek (s->file, s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile, SEEK_SET) != 0) - return UNZ_ERRNO; - - - if (err == UNZ_OK) - { - if (unzlocal_getLong (s->file, &uMagic) != UNZ_OK) - err = UNZ_ERRNO; - else if (uMagic != 0x04034b50) - err = UNZ_BADZIPFILE; - } - - if (unzlocal_getShort (s->file, &uData) != UNZ_OK) - err = UNZ_ERRNO; - /* - * else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) - * err=UNZ_BADZIPFILE; - */ - if (unzlocal_getShort (s->file, &uFlags) != UNZ_OK) - err = UNZ_ERRNO; - - if (unzlocal_getShort (s->file, &uData) != UNZ_OK) - err = UNZ_ERRNO; - else if ((err == UNZ_OK) && (uData != s->cur_file_info.compression_method)) - err = UNZ_BADZIPFILE; - - if ((err == UNZ_OK) && - s->cur_file_info.compression_method > Z_DEFLATED) - err = UNZ_BADZIPFILE; - - if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* date/time */ - err = UNZ_ERRNO; - - if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* crc */ - err = UNZ_ERRNO; - else if ((err == UNZ_OK) && (uData != s->cur_file_info.crc) && - ((uFlags & 8) == 0)) - err = UNZ_BADZIPFILE; - - if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* size compr */ - err = UNZ_ERRNO; - else if ((err == UNZ_OK) && (uData != s->cur_file_info.compressed_size) && - ((uFlags & 8) == 0)) - err = UNZ_BADZIPFILE; - - if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* size uncompr */ - err = UNZ_ERRNO; - else if ((err == UNZ_OK) && (uData != s->cur_file_info.uncompressed_size) && - ((uFlags & 8) == 0)) - err = UNZ_BADZIPFILE; - - - if (unzlocal_getShort (s->file, &size_filename) != UNZ_OK) - err = UNZ_ERRNO; - else if ((err == UNZ_OK) && (size_filename != s->cur_file_info.size_filename)) - err = UNZ_BADZIPFILE; - - *piSizeVar += (uInt) size_filename; - - if (unzlocal_getShort (s->file, &size_extra_field) != UNZ_OK) - err = UNZ_ERRNO; - *poffset_local_extrafield = s->cur_file_info_internal.offset_curfile + - SIZEZIPLOCALHEADER + size_filename; - *psize_local_extrafield = (uInt) size_extra_field; - - *piSizeVar += (uInt) size_extra_field; - - return err; -} - -/* - * Open for reading data the current file in the zipfile. If there is no - * error and the file is opened, the return value is UNZ_OK. - */ -extern int ZEXPORT -unzOpenCurrentFile (unzFile file) -{ - int err = UNZ_OK; - uInt iSizeVar; - unz_s *s; - file_in_zip_read_info_s *pfile_in_zip_read_info; - uLong offset_local_extrafield; /* offset of the local extra - * field */ - uInt size_local_extrafield; /* size of the local extra - * field */ - - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - if (!s->current_file_ok) - return UNZ_PARAMERROR; - - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile (file); - - if (unzlocal_CheckCurrentFileCoherencyHeader (s, &iSizeVar, - &offset_local_extrafield, &size_local_extrafield) != UNZ_OK) - return UNZ_BADZIPFILE; - - pfile_in_zip_read_info = (file_in_zip_read_info_s *) - ALLOC (sizeof (file_in_zip_read_info_s)); - if (pfile_in_zip_read_info == NULL) - return UNZ_INTERNALERROR; - - pfile_in_zip_read_info->read_buffer = (char *) ALLOC (UNZ_BUFSIZE); - pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; - pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; - pfile_in_zip_read_info->pos_local_extrafield = 0; - - if (pfile_in_zip_read_info->read_buffer == NULL) - { - TRYFREE (pfile_in_zip_read_info); - return UNZ_INTERNALERROR; - } - pfile_in_zip_read_info->stream_initialised = 0; - - if (s->cur_file_info.compression_method > Z_DEFLATED) - err = UNZ_BADZIPFILE; - - pfile_in_zip_read_info->crc32_wait = s->cur_file_info.crc; - pfile_in_zip_read_info->crc32 = 0; - pfile_in_zip_read_info->compression_method = - s->cur_file_info.compression_method; - pfile_in_zip_read_info->file = s->file; - pfile_in_zip_read_info->byte_before_the_zipfile = s->byte_before_the_zipfile; - - pfile_in_zip_read_info->stream.total_out = 0; - - switch (s->cur_file_info.compression_method) - { - case UNZ_STORED: - break; - case UNZ_SHRUNK: - break; - case UNZ_REDUCED1: - case UNZ_REDUCED2: - case UNZ_REDUCED3: - case UNZ_REDUCED4: - break; - case UNZ_IMPLODED: - break; - case UNZ_DEFLATED: - pfile_in_zip_read_info->stream.zalloc = (alloc_func) 0; - pfile_in_zip_read_info->stream.zfree = (free_func) 0; - pfile_in_zip_read_info->stream.opaque = (voidpf) 0; - - err = inflateInit2 (&pfile_in_zip_read_info->stream, -MAX_WBITS); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised = 1; - /* - * windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. In unzip, i don't wait absolutely - * Z_STREAM_END because I known the size of both compressed and - * uncompressed data - */ - break; - default: - return UNZ_INTERNALERROR; - break; - } - pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size; - pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size; - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + - iSizeVar; - - pfile_in_zip_read_info->stream.avail_in = (uInt) 0; - s->pfile_in_zip_read = pfile_in_zip_read_info; - return UNZ_OK; -} - - -/* - * Read bytes from the current file. buf contain buffer where data must be - * copied len the size of buf. - * - * return the number of byte copied if somes bytes are copied return 0 if the - * end of file was reached return <0 with error code if there is an error - * (UNZ_ERRNO for IO error, or zLib error for uncompress error) - */ - -file_in_zip_read_info_s *pfile_in_zip_read_info = NULL; -unz_s *pUnzip = NULL; -extern int ZEXPORT -unzReadCurrentFile ( - unzFile file, - voidp buf, - unsigned len) -{ - int err = UNZ_OK; - uInt iRead = 0; - unz_s *s; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - pUnzip = s; - pfile_in_zip_read_info = s->pfile_in_zip_read; - - if (pfile_in_zip_read_info == NULL) - return UNZ_PARAMERROR; - - - if ((pfile_in_zip_read_info->read_buffer == NULL)) - return UNZ_END_OF_LIST_OF_FILE; - if (len == 0) - return 0; - - pfile_in_zip_read_info->stream.next_out = (Bytef *) buf; - - pfile_in_zip_read_info->stream.avail_out = (uInt) len; - - if (len > pfile_in_zip_read_info->rest_read_uncompressed) - pfile_in_zip_read_info->stream.avail_out = - (uInt) pfile_in_zip_read_info->rest_read_uncompressed; - - while (pfile_in_zip_read_info->stream.avail_out > 0 && err == UNZ_OK) - { - switch (pfile_in_zip_read_info->compression_method) - { - case UNZ_STORED: - case UNZ_DEFLATED: - if ((pfile_in_zip_read_info->stream.avail_in == 0) && - (pfile_in_zip_read_info->rest_read_compressed > 0)) - { - uInt uReadThis = UNZ_BUFSIZE; - if (pfile_in_zip_read_info->rest_read_compressed < uReadThis) - uReadThis = (uInt) pfile_in_zip_read_info->rest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (fseek (pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile, SEEK_SET) != 0) - return UNZ_ERRNO; - if (fread (pfile_in_zip_read_info->read_buffer, uReadThis, 1, - pfile_in_zip_read_info->file) != 1) - return UNZ_ERRNO; - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - - pfile_in_zip_read_info->rest_read_compressed -= uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Bytef *) pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt) uReadThis; - } - break; - } - switch (pfile_in_zip_read_info->compression_method) - { - case UNZ_STORED: - { - uInt uDoCopy, i; - if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out; - else - uDoCopy = pfile_in_zip_read_info->stream.avail_in; - - for (i = 0; i < uDoCopy; i++) - *(pfile_in_zip_read_info->stream.next_out + i) = - *(pfile_in_zip_read_info->stream.next_in + i); - - pfile_in_zip_read_info->crc32 = crc32 (pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - uDoCopy); - pfile_in_zip_read_info->rest_read_uncompressed -= uDoCopy; - pfile_in_zip_read_info->stream.avail_in -= uDoCopy; - pfile_in_zip_read_info->stream.avail_out -= uDoCopy; - pfile_in_zip_read_info->stream.next_out += uDoCopy; - pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; - iRead += uDoCopy; - break; - } - case UNZ_SHRUNK: - iRead = pfile_in_zip_read_info->rest_read_uncompressed; - unShrink (); - break; - case UNZ_REDUCED1: - case UNZ_REDUCED2: - case UNZ_REDUCED3: - case UNZ_REDUCED4: - iRead = pfile_in_zip_read_info->rest_read_uncompressed; - unReduce (); - break; - case UNZ_IMPLODED: - iRead = pfile_in_zip_read_info->rest_read_uncompressed; - err = explode (); - break; - case UNZ_DEFLATED: - { - uLong uTotalOutBefore, uTotalOutAfter; - const Bytef *bufBefore; - uLong uOutThis; - int flush = Z_SYNC_FLUSH; - - uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; - bufBefore = pfile_in_zip_read_info->stream.next_out; - - /* - * if ((pfile_in_zip_read_info->rest_read_uncompressed == - * pfile_in_zip_read_info->stream.avail_out) && - * (pfile_in_zip_read_info->rest_read_compressed == 0)) flush = - * Z_FINISH; - */ - err = inflate (&pfile_in_zip_read_info->stream, flush); - - uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; - uOutThis = uTotalOutAfter - uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = - crc32 (pfile_in_zip_read_info->crc32, bufBefore, - (uInt) (uOutThis)); - - pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; - - iRead += (uInt) (uTotalOutAfter - uTotalOutBefore); - - if (err == Z_STREAM_END) - return (iRead == 0) ? UNZ_EOF : iRead; - if (err != Z_OK) - break; - break; - } - default: - return (UNZ_EOF); - } - } - - if (err == Z_OK) - return iRead; - return err; -} - - -/* - * Give the current position in uncompressed data - */ -extern z_off_t ZEXPORT -unztell (unzFile file) -{ - unz_s *s; - file_in_zip_read_info_s *pfile_in_zip_read_info; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - pfile_in_zip_read_info = s->pfile_in_zip_read; - - if (pfile_in_zip_read_info == NULL) - return UNZ_PARAMERROR; - - return (z_off_t) pfile_in_zip_read_info->stream.total_out; -} - - -/* - * return 1 if the end of file was reached, 0 elsewhere - */ -extern int ZEXPORT -unzeof (unzFile file) -{ - unz_s *s; - file_in_zip_read_info_s *pfile_in_zip_read_info; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - pfile_in_zip_read_info = s->pfile_in_zip_read; - - if (pfile_in_zip_read_info == NULL) - return UNZ_PARAMERROR; - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; -} - - - -/* - * Read extra field from the current file (opened by unzOpenCurrentFile) This - * is the local-header version of the extra field (sometimes, there is more - * info in the local-header version than in the central-header) - * - * if buf==NULL, it return the size of the local extra field that can be read - * - * if buf!=NULL, len is the size of the buffer, the extra header is copied in - * buf. the return value is the number of bytes copied in buf, or (if <0) the - * error code - */ -extern int ZEXPORT -unzGetLocalExtrafield ( - unzFile file, - voidp buf, - unsigned len) -{ - unz_s *s; - file_in_zip_read_info_s *pfile_in_zip_read_info; - uInt read_now; - uLong size_to_read; - - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - pfile_in_zip_read_info = s->pfile_in_zip_read; - - if (pfile_in_zip_read_info == NULL) - return UNZ_PARAMERROR; - - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - - pfile_in_zip_read_info->pos_local_extrafield); - - if (buf == NULL) - return (int) size_to_read; - - if (len > size_to_read) - read_now = (uInt) size_to_read; - else - read_now = (uInt) len; - - if (read_now == 0) - return 0; - - if (fseek (pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + - pfile_in_zip_read_info->pos_local_extrafield, SEEK_SET) != 0) - return UNZ_ERRNO; - - if (fread (buf, (uInt) size_to_read, 1, pfile_in_zip_read_info->file) != 1) - return UNZ_ERRNO; - - return (int) read_now; -} - -/* - * Close the file in zip opened with unzipOpenCurrentFile Return UNZ_CRCERROR - * if all the file was read but the CRC is not good - */ -extern int ZEXPORT -unzCloseCurrentFile (unzFile file) -{ - int err = UNZ_OK; - - unz_s *s; - file_in_zip_read_info_s *pfile_in_zip_read_info; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - pfile_in_zip_read_info = s->pfile_in_zip_read; - - if (pfile_in_zip_read_info == NULL) - return UNZ_PARAMERROR; - - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - { - if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) - err = UNZ_CRCERROR; - } - TRYFREE (pfile_in_zip_read_info->read_buffer); - pfile_in_zip_read_info->read_buffer = NULL; - if (pfile_in_zip_read_info->stream_initialised) - inflateEnd (&pfile_in_zip_read_info->stream); - - pfile_in_zip_read_info->stream_initialised = 0; - TRYFREE (pfile_in_zip_read_info); - - s->pfile_in_zip_read = NULL; - - return err; -} - - -/* - * Get the global comment string of the ZipFile, in the szComment buffer. - * uSizeBuf is the size of the szComment buffer. return the number of byte - * copied or an error code <0 - */ -extern int ZEXPORT -unzGetGlobalComment ( - unzFile file, - char *szComment, - uLong uSizeBuf) -{ - unz_s *s; - uLong uReadThis; - if (file == NULL) - return UNZ_PARAMERROR; - s = (unz_s *) file; - - uReadThis = uSizeBuf; - if (uReadThis > s->gi.size_comment) - uReadThis = s->gi.size_comment; - - if (fseek (s->file, s->central_pos + 22, SEEK_SET) != 0) - return UNZ_ERRNO; - - if (uReadThis > 0) - { - *szComment = '\0'; - if (fread (szComment, (uInt) uReadThis, 1, s->file) != 1) - return UNZ_ERRNO; - } - if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) - *(szComment + s->gi.size_comment) = '\0'; - return (int) uReadThis; -} diff --git a/source/unzip/unzip.h b/source/unzip/unzip.h deleted file mode 100644 index f629782..0000000 --- a/source/unzip/unzip.h +++ /dev/null @@ -1,285 +0,0 @@ -/* unzip.h -- IO for uncompress .zip files using zlib - Version 0.15 beta, Mar 19th, 1998, - - Copyright (C) 1998 Gilles Vollant - - This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g - WinZip, InfoZip tools and compatible. - Encryption and multi volume ZipFile (span) are not supported. - Old compressions used by old PKZip 1.x are not supported - - THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE - CAN CHANGE IN FUTURE VERSION !! - I WAIT FEEDBACK at mail info@winimage.com - Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution - - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - -*/ -/* for more info about .ZIP format, see - ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip - PkWare has also a specification at : - ftp://ftp.pkware.com/probdesc.zip */ - -#ifndef _unz_H -#define _unz_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _ZLIB_H -#include "zlib.h" -#endif - -#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; -typedef unzFile__ *unzFile; -#else -typedef voidp unzFile; -#endif - - -#define UNZ_OK (0) -#define UNZ_END_OF_LIST_OF_FILE (-100) -#define UNZ_ERRNO (Z_ERRNO) -#define UNZ_EOF (0) -#define UNZ_PARAMERROR (-102) -#define UNZ_BADZIPFILE (-103) -#define UNZ_INTERNALERROR (-104) -#define UNZ_CRCERROR (-105) - -#define UNZ_STORED 0 /* compression methods */ -#define UNZ_SHRUNK 1 -#define UNZ_REDUCED1 2 -#define UNZ_REDUCED2 3 -#define UNZ_REDUCED3 4 -#define UNZ_REDUCED4 5 -#define UNZ_IMPLODED 6 -#define UNZ_TOKENIZED 7 -#define UNZ_DEFLATED 8 - -/* tm_unz contain date/time info */ -typedef struct tm_unz_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_unz; - -/* unz_global_info structure contain global data about the ZIPfile - These data comes from the end of central dir */ -typedef struct unz_global_info_s -{ - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - - -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_info_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info; - -extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, - const char* fileName2, - int iCaseSensitivity)); -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) -*/ - - -extern unzFile ZEXPORT unzOpen OF((const char *path)); -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer - "zlib/zlib111.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ - -extern int ZEXPORT unzClose OF((unzFile file)); -/* - Close a ZipFile opened with unzipOpen. - If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. - return UNZ_OK if there is no problem. */ - -extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, - unz_global_info *pglobal_info)); -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ - - -extern int ZEXPORT unzGetGlobalComment OF((unzFile file, - char *szComment, - uLong uSizeBuf)); -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ - - -/***************************************************************************/ -/* Unzip package allow you browse the directory of the zipfile */ - -extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ - -extern int ZEXPORT unzGoToNextFile OF((unzFile file)); -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ - -extern int ZEXPORT unzLocateFile OF((unzFile file, - const char *szFileName, - int iCaseSensitivity)); -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ - - -extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, - unz_file_info *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); -/* - Get Info about the current file - if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file - if szFileName!=NULL, the filemane string will be copied in szFileName - (fileNameBufferSize is the size of the buffer) - if extraField!=NULL, the extra field information will be copied in extraField - (extraFieldBufferSize is the size of the buffer). - This is the Central-header version of the extra field - if szComment!=NULL, the comment string of the file will be copied in szComment - (commentBufferSize is the size of the buffer) -*/ - -/***************************************************************************/ -/* for reading the content of the current zipfile, you can open it, read data - from it, and close it (you can close it before reading all the file) - */ - -extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); -/* - Open for reading data the current file in the zipfile. - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); -/* - Close the file in zip opened with unzOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ - - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read bytes from the current file (opened by unzOpenCurrentFile) - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ - -extern z_off_t ZEXPORT unztell OF((unzFile file)); -/* - Give the current position in uncompressed data -*/ - -extern int ZEXPORT unzeof OF((unzFile file)); -/* - return 1 if the end of file was reached, 0 elsewhere -*/ - -extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _unz_H */ diff --git a/source/unzip/unzipP.h b/source/unzip/unzipP.h deleted file mode 100644 index c44e3cb..0000000 --- a/source/unzip/unzipP.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef _UNZIPP_H_ -#define _UNZIPP_H_ - -#include "ds2_malloc.h" -#include "unzip.h" - -#ifndef local -#define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - - - -#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \ - !defined(CASESENSITIVITYDEFAULT_NO) -#define CASESENSITIVITYDEFAULT_NO -#endif - - -#ifndef UNZ_BUFSIZE -#define UNZ_BUFSIZE (16384) -#endif - -#ifndef UNZ_MAXFILENAMEINZIP -#define UNZ_MAXFILENAMEINZIP (256) -#endif - -#ifndef ALLOC -#define ALLOC(size) (malloc(size)) -#endif -#ifndef TRYFREE -#define TRYFREE(p) {if (p) free(p);} -#endif - -#define SIZECENTRALDIRITEM (0x2e) -#define SIZEZIPLOCALHEADER (0x1e) - - -/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -/* unz_file_info_interntal contain internal info about a file in zipfile */ -typedef struct unz_file_info_internal_s -{ - uLong offset_curfile; /* relative offset of local header 4 - * bytes */ -} unz_file_info_internal; - - -/* - * file_in_zip_read_info_s contain internal information about a file in - * zipfile, when reading and decompress it - */ -typedef struct -{ - char *read_buffer;/* internal buffer for compressed data */ - z_stream stream; /* zLib stream structure for inflate */ - - uLong pos_in_zipfile; /* position in byte on the zipfile, - * for fseek */ - uLong stream_initialised; /* flag set if stream structure is - * initialised */ - - uLong offset_local_extrafield; /* offset of the local extra - * field */ - uInt size_local_extrafield; /* size of the local extra - * field */ - uLong pos_local_extrafield; /* position in the local - * extra field in read */ - - uLong crc32; /* crc32 of all data uncompressed */ - uLong crc32_wait; /* crc32 we must obtain after decompress all */ - uLong rest_read_compressed; /* number of byte to be - * decompressed */ - uLong rest_read_uncompressed; /* number of byte to be - * obtained after decomp */ - FILE *file; /* io structore of the zipfile */ - uLong compression_method; /* compression method (0==store) */ - uLong byte_before_the_zipfile; /* byte before the zipfile, - * (>0 for sfx) */ -} file_in_zip_read_info_s; - - -/* - * unz_s contain internal information about the zipfile - */ -typedef struct -{ - FILE *file; /* io structore of the zipfile */ - unz_global_info gi; /* public global information */ - uLong byte_before_the_zipfile; /* byte before the zipfile, - * (>0 for sfx) */ - uLong num_file; /* number of the current file in the zipfile */ - uLong pos_in_central_dir; /* pos of the current file in the - * central dir */ - uLong current_file_ok; /* flag about the usability of the - * current file */ - uLong central_pos;/* position of the beginning of the central - * dir */ - - uLong size_central_dir; /* size of the central directory */ - uLong offset_central_dir; /* offset of start of central - * directory with respect to the - * starting disk number */ - - unz_file_info cur_file_info; /* public info about the current file - * in zip */ - unz_file_info_internal cur_file_info_internal; /* private info about it */ - file_in_zip_read_info_s *pfile_in_zip_read; /* structure about the - * current file if we are - * decompressing it */ -} unz_s; - -#endif |