############################################################
Unofficial Yabause for wii (An Sega Saturn Emulator for Wii)
############################################################

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must not ask the Yabause Team about unofficial versions
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

http://wiibrew.org/wiki/Yabause_Wii
(I will update the above website. But the site is wiki, anyone 
 can edit it. If I felt inconvenience, I might stop updating.)

#Introduction
In this unofficial version, some functions were added to the
 original Yabause by Yabause Team, and this was modified mainly
 in displaying.
But, this emulator is originated from the great effort of
 "Yabause Team".
So, you should write the name "Yabause Team" as the author
 or creator.
But, note that Yabause Team does not support Wii port.
So, you must not ask the Yabause Team about this unofficial Wii
 version.

This set includes the source.
The original sources are available on the following sites.

Yabause original source
http://yabause.org/download/
or
http://sourceforge.net/projects/yabause/

#Features
- ISO or CUE file, cue file needs the files listed in cue file. (not support sega original CD, because Wii cannot read CD)
- Wiimote, Classic, and Game Cube controllers.
- front SD/SDHC and USB storage (only FAT)
- save/load state
- configure buttons
- save settings

#How to set up
1) Copy the contents in the HBC to your SD (including SDHC) card or USB storage (only FAT). 
2) Copy game roms files (.cue with needed files, or .iso) to /yabause/games directory.
Optional) If you want, copy the bios file of the Sega Saturn to 
/yabause directory as the name "bios.bin" (But, the default setting is "Without bios". So, if you want to use bios, please set the "With bios" in the Settings submenu).
The current version of Yabause Wii can execute games without BIOS.
Some games need the bios file to run normally.
But, some games freeze with BIOS (ex., Sega Rally Champ.)
So, "With BIOS" is not almighty.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Moreover, you can use the bios utilities (cartridge management (remove, copy, etc.), etc.), when you set the "Bios only" in the Settings submenu.

When there is /yabause directory in both SD card and USB storage, the files in SD card are given to priority.

You can set smpc peripheral timing parameter (500-16000: default=5000. 16000 in old yabause, it seems to be too long for wii.).

You can set decline number parameter (2-17: default=15. 10 in original yabause).
The yabause executes the process of displyaing (BlankOUT process) one image per the decline number
The higher the number, the faster but some games are unstable (freezing) while anoter some games, which did not work in the previous yabauses, work only in the lower number (ex. 2-4) but slower.

#How to use
Load this emulator by a loader such as the homebrew channel.
At first, select the "Load ISO/CUE" menu.
Then, the game files in the /yabause/games directory are displayed.
Second, select a game.
Then, you return to the main menu.
Finally, select the "Start emulation".

Some games need to select the proper cartridge.
So, you must select the proper cartridge before start.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#Files Structure and Names
Structure
 /yabause/bios.bin (optional): bios file of saturn
   |     /yabause.xml (auto): setting file
   |
   |-----/carts/actionreplay.bin (optional)
   |           /bkram4M.bin (auto)
   |           /bkram8M.bin (auto)
   |           /bkram16M.bin (auto)
   |           /bkram32M.bin (auto)
   |           /ROM16M.bin  (optional)
   |
   |-----/saves/bkram.bin (auto, one-backup mode): one internal back-up file
   |           /[gameID].bin (auto, each-backup mode): internal back-up file in each game
   |           /[gameID]_00?.yss (auto): state save file in each game
   |
   |-----/games/[game_nameA.iso

   |           /[game_nameB].cue (with some files)


Catridge list
type           file name
---------------------------------------
None           ""
Action Replay  "/yabause/carts/actionreplay.bin"
Backup  4M RAM "/yabause/carts/bkram4M.bin"
Backup  8M RAM "/yabause/carts/bkram8M.bin"
Backup 16M RAM "/yabause/carts/bkram16M.bin"
Backup 32M RAM "/yabause/carts/bkram32M.bin"
DRAM  8M       ""
DRAM 32M       ""
ROM 16M        "/yabause/carts/ROM16M.bin"
Japanese Modem ""

The above file names cannot be changed.
Tested cartridge types are only backup-RAMs and DRAMs.
The other types cannot be tested.
The file name of the internal backup ram is "/yabause/saves/bkram.bin" on one-backup mode or "/yabause/saves/[gameID].bin" on each-backup mode, though it is not cartridge. 

#Controls
In Menu : 
A(2 in wiimote): select menu item
up/down: pad or stick

In Game (Do not point monitor by wiimote 1 in any controllers.)
Wiimote(horizontal), Classic, Gamecube: Action
PADs or Stick: move
A, Y, Y: A (changeable)
1, B, B: B (changeable)
2, A, A: C (changeable)
-, X, X: X (changeable)
B, ZL,subStick(any direction): Y (changeable)
 , ZR, Z: Z (changeable)
 ,FULL L, LTrigger: LTrigger (changeable)
 ,FULL R, RTrigger: RTrigger (changeable)
+,+,Start: Start (changeable)
Home, Home, Z+Start: Quit
Wiimote when pointing monitor (you can see a brief square pointer)
-&1  : save state slot 1
-&2  : save state slot 2
+&1  : load state slot 1
+&2  : load state slot 2
UP   : Toggle VDP2 NBG0 display
RIGHT: Toggle VDP2 NBG1 display
DOWN : Toggle VDP2 NBG2 display
LEFT : Toggle VDP2 NBG3 display
A    : Toggle VDP2 RBG0 display
B    : Toggle VDP1 display
1&2  : Toggle FPS display

You can save two states in each game.
When you cannot play normally because of display priority, try toggle buttons.

#Known issues
-Slow. However, because the auto-frameskip is active by default, some games run at playable speed.
-Not displaying some images (So, try to push any buttons on black screen.)
-Freezing

#Brief Change Log
% ver. Unofficial r2649 beta20 - Jul. 24, 2011
 -can adjust decline number (2-17): The higher the number, the faster but some games are unstable while anoter some games work only in the lower number (ex. 2-4) but slower. 
 -adjust for PAL monitor mode when libogc detects VI_PAL mode (but I cannot verify this forever)
 -fix threading
 -some minor fixes and changes

% ver. Unofficial r2649 beta19 - Jul. 16, 2011
 -change directory structure from old "/SSROMS" directory to each subdirectories under "/yabause" directory
 -add new internal backup ram saving mode: save in each game
 -activate threading scsp2 using mutex
 -avoid freezing in some vdp1 commands
 -some minor fixes and changes

% ver. Unofficial r2649 beta18 - Jul. 2, 2011
 -base on the original yabause r2649 (cmake branches)
 -compile with devkitPPC r23 and recent libogc except r4078 audio.c
 -use scsp2.c instead of scsp.c (some games works, but, sound quality seems to be lower)
 -fix clip bug of vdp1 in vidsoft.c
 -some minor fixes and changes

% ver. Unofficial r2604 beta17 - Nov. 3, 2010
 -compile with devkitPPC r22 (performance up)
 -adjust smpc peripheral timing parameter (some games work), and add setting menu of the parameter
 -fix crash bug in menu
 -some minor fixes and changes

% ver. Unofficial r2604 beta16 - Oct. 16, 2010
 -add special color setting menu (default on, off: a little faster, but lower compatibility)
 -some minor fixes and changes

% ver. Unofficial r2604 beta15 - Oct. 10, 2010
 -revert a part of the previous optimizations because of bug
 -display FPS (default off)
 -some minor fixes and changes

% ver. Unofficial r2604 beta14 - Oct. 1, 2010
 -support saving settings
 -support configuring buttons
 -some optimizations (a little fast)
 -scroll display of long file name
 -some minor fixes and changes

% ver. Unofficial r2604 beta13 - Sep. 24, 2010
 -improve processing vdp1 (fix some imvisibilities and flickers of vdp1)
 -fix path name of ROM 16M-bit cartridge (maybe affect KOF95 etc.)
 -some minor fixes and changes

% ver. Unofficial r2604 beta12 - Sep. 18, 2010
 -add some previous unhandled commands of vdp2
 -use optimization options of compiler (a little fast)
 -use inline assemblies more in functions used in RBG0 and RBG1 (a little fast but not accurate)
 -some minor fixes and changes

% ver. Unofficial r2604 beta11 - Sep. 11, 2010
 -add "additive" special color calculation mode
 -fix color bug owing to endian
 -use inline assembler in the mulfixed-function (used in RBG0 and RBG1) for speed up (but a little..)
 -some minor fixes and changes

% ver. Unofficial r2604 beta10 - Sep. 6, 2010
 -change order of drawing vdp2 for special color calculation mode

% ver. Unofficial r2604 beta9 - Sep. 5, 2010
 -add special color calculation mode (blend colors)
 -thread audio and increase buffer
 -some minor fixes and changes

% ver. Unofficial r2604 beta8 - Aug. 28, 2010
 -add more some previous unhandled commands of SH2 and memory accesses
 -fix color offset to avoid bluish image
 -some minor fixes and changes

% ver. Unofficial r2604 beta7 - Aug. 18, 2010
 -based on the original yabause r2604
 -change mounting method of fat for stable mounting (retry three times)
 -some minor fixes and changes

% ver. Unofficial r2411 beta6 - Aug. 15, 2010
 -recompile for recent HBC1.0.8 and recent libogc (I don't know using IOS58 for USB2)
 -add some previous unhandled commands of SH2 (ex. Sega Rally Champ. works)
 -some minor fixes and changes

% ver. Unofficial r2411 beta5 - Mar. 27, 2010
 -fix user-clipping
 -add subsubmenu of selecting sound driver
 -some minor fixes and changes

% ver. Unofficial r2411 beta4 - Mar. 6, 2010
 -add bios setting submenus (default is "without bios")
 -fix variable type of the localX, localY taken from rr branch
 -some minor fixes and changes

% ver. Unofficial r2411 beta3 - Feb. 13, 2010
 -avoid crash in scsp
 -fix clipping bug more
 -display vdp1 palette only mode

% ver. Unofficial r2411 beta2 - Jan. 23, 2010
 -fix clipping bug in high-reso.
 -support state save & load
 -sort game list alphabetically with case-insensitive
 -some minor fixes and changes

% ver. Unofficial r2411 beta1 - Dec. 26, 2009
 -support USB storage
 -sort game list alphabetically

% ver. Unofficial r2411 alpha10 - Dec. 5, 2009
 -use GX in converting resolution
 -fix pixel size of vdp1 on the games such as Virtua Fighter

% ver. Unofficial r2411 alpha9 - Nov. 6, 2009
 -based on the original yabause r2411 
 -fix putting position of vdp1 in the games using high resolution modes

% ver. Unofficial 0.9.10 alpha8 - Nov. 2, 2009 
 -add submenu of setting cartridge
 -not compile high resolution version (highreso.dol) because of bugs

% ver. Unofficial 0.9.10 alpha7 - Oct. 31, 2009 
 -can play repeatedly
 -fix displaying more
 -high resolution version (highreso.dol)

% ver. Unofficial 0.9.10 alpha6 - Oct. 29, 2009 
 -fix displaying, again (but, cannot test all TV-modes except NTSC-J)
 -omit small black square in left-top corner
 -delete stopping DVD (because the latest HBC stops DVD)

% ver. Unofficial 0.9.10 alpha5 - Oct. 25, 2009 
 -fix displaying

% ver. Unofficial 0.9.10 alpha4 - Oct. 24, 2009 
 -support Gamecube Controller & stick of Classic tontroller
 -improve displaying ..(but, provisionally)

% ver. Unofficial 0.9.10 alpha3 - Jun. 2, 2009 
 -based on the original yabause 0.9.10
 -set DRAM32MBIT Cart

% ver. Unofficial 0.9.8 alpha2 - Feb. 4, 2009 
 -based on the original yabause 0.9.9
 -can play without bios file

% ver. Unofficial 0.9.8 alpha1 - Jan. 10, 2009 
 -based on the original yabause 0.9.8
 -submenu of games
 -stop the sound when you return to the main menu
 -set backup ram as "/SSROMS/bkram.bin"