mirror of
https://github.com/ApacheThunder/GBA-Exploader.git
synced 2025-06-18 11:35:38 -04:00
Starting Commit ....
This commit is contained in:
parent
dc0c39203b
commit
bbe4ce75c0
51
.gitignore
vendored
Normal file
51
.gitignore
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# devkitARM/libnds/3DS compiled stuff
|
||||
*.bin
|
||||
*.tmd
|
||||
*.cia
|
||||
*.cmd
|
||||
*.nds
|
||||
*.app
|
||||
*.arm7
|
||||
*.arm9
|
||||
*.elf
|
||||
build
|
||||
data
|
||||
title
|
||||
|
||||
# Stuff generated by Windows.
|
||||
*.cmd
|
||||
Thumbs.db
|
||||
desktop.ini
|
76
Fami_mini_cnv/Fami_mini_cnv
Normal file
76
Fami_mini_cnv/Fami_mini_cnv
Normal file
@ -0,0 +1,76 @@
|
||||
on error Resume next
|
||||
|
||||
Set Fs = WScript.CreateObject("Scripting.FileSystemObject")
|
||||
Set arg = WScript.Arguments
|
||||
|
||||
|
||||
if arg.Count=0 then
|
||||
path = InputBox("Please specify the file name of the converted save file.")
|
||||
else
|
||||
path = arg(0)
|
||||
end if
|
||||
|
||||
|
||||
savefile = false
|
||||
if Fs.FileExists(path) then
|
||||
set fo = Fs.GetFile(path)
|
||||
ext = UCase(Fs.GetExtensionName(path))
|
||||
if ext = "SAV" then savefile = true
|
||||
if ext = "SV1" then savefile = true
|
||||
if ext = "SV2" then savefile = true
|
||||
if ext = "SV3" then savefile = true
|
||||
if ext = "SV4" then savefile = true
|
||||
if ext = "SV5" then savefile = true
|
||||
end if
|
||||
|
||||
if savefile = false then
|
||||
MsgBox "It is not a save file."
|
||||
WScript.Quit
|
||||
end if
|
||||
|
||||
|
||||
|
||||
|
||||
Dim sIn, sOut
|
||||
|
||||
Set sIn = CreateObject("ADODB.Stream")
|
||||
Set sOut = CreateObject("ADODB.Stream")
|
||||
|
||||
sIn.Type = 1
|
||||
sOut.Type = 1
|
||||
|
||||
sIn.Open
|
||||
sOut.Open
|
||||
|
||||
|
||||
sIn.LoadFromFile(fo.Path)
|
||||
Do Until sIn.EOS
|
||||
bf0 = sIn.Read(1)
|
||||
bf1 = sIn.Read(1)
|
||||
bf2 = sIn.Read(1)
|
||||
bf3 = sIn.Read(1)
|
||||
bf4 = sIn.Read(1)
|
||||
bf5 = sIn.Read(1)
|
||||
bf6 = sIn.Read(1)
|
||||
bf7 = sIn.Read(1)
|
||||
|
||||
sOut.Write bf7
|
||||
sOut.Write bf6
|
||||
sOut.Write bf5
|
||||
sOut.Write bf4
|
||||
sOut.Write bf3
|
||||
sOut.Write bf2
|
||||
sOut.Write bf1
|
||||
sOut.Write bf0
|
||||
Loop
|
||||
sOut.SaveToFile fo.Path, 2
|
||||
|
||||
sIn.Close
|
||||
sOut.Close
|
||||
|
||||
|
||||
MsgBox "The save data was converted." & vbCrLf & vbCrLf & vbCrLf & _
|
||||
fo.Name & " " & FormatNumber(fo.Size, 0) & "Byte" & vbCrLf & _
|
||||
"(" & fo.Path & ")" & vbCrLf & vbCrLf _
|
||||
,,"Famicom Mini SAVE Converter"
|
||||
|
22
Fami_mini_cnv/読んでネ.txt
Normal file
22
Fami_mini_cnv/読んでネ.txt
Normal file
@ -0,0 +1,22 @@
|
||||
====== Famicom Mini SAVE Convertor ======
|
||||
|
||||
GBA_ExpLoader V0.57より、Famicom Mini系のSAVEファイルの形式を
|
||||
変更したことによる変換プログラムです。
|
||||
|
||||
GBA_ExpLoader V0.56以前で作成された、Famicom Mini系のSAVEファイルを
|
||||
指定した場合は、GBA_ExpLoader V0.57以降およびVBA互換の形式に変換します。
|
||||
|
||||
逆に、GBA_ExpLoader V0.57以降およびVBAで作成されたSAVEファイルを
|
||||
指定した場合は、GBA_ExpLoader V0.56以前の形式に変換します。
|
||||
|
||||
<使い方>
|
||||
・Fami_mini_cnv.vbsを、PCの適当な場所にコピーします。
|
||||
・変換したいSAVEファイルをドラッグして、Fami_mini_cnv.vbsにドロップして起動します。
|
||||
|
||||
<注意>
|
||||
・VBScriptによる超適当プログラムです。
|
||||
・エラー処理もいい加減ですので、正しい使い方でお願いします。
|
||||
・SAVEファイルは変換時に内容を置き換えますので、必要に応じて事前にバックアップして
|
||||
から変換してください。
|
||||
|
||||
by Rudolph (皇帝)
|
8
GBA_ExpLoader/GBA_ExpLoader.ini
Normal file
8
GBA_ExpLoader/GBA_ExpLoader.ini
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# GBA_ExpLoader.ini
|
||||
#
|
||||
|
||||
SaveDir /GBA_SAVE
|
||||
SignDir /GBA_SIGN
|
||||
#No_MultiSave ! No Multi Save
|
||||
|
BIN
GBA_ExpLoader/Readme_EN_UTF-16.txt
Normal file
BIN
GBA_ExpLoader/Readme_EN_UTF-16.txt
Normal file
Binary file not shown.
255
GBA_ExpLoader/読んでネ.txt
Normal file
255
GBA_ExpLoader/読んでネ.txt
Normal file
@ -0,0 +1,255 @@
|
||||
====== GBA ExpLoader V0.57 ======
|
||||
|
||||
Slot2タイプ拡張パックを利用して、Slot-1カードのGBAのゲームを起動します。
|
||||
|
||||
ソフトリセットが可能なSlot-1カードでは、「DS振動カートリッジ」と「DS拡張メモリ」
|
||||
として利用する事ができます。
|
||||
|
||||
サポートしているSlot2タイプ拡張パックは、「3in1拡張パック」「EZ4 lite-delux」
|
||||
と「EWIN EXPANSION PAK, DSTT GBA&EXPLORER 2IN1」です。
|
||||
また、「M3」「G6」「GBA Expansion Pack」を暫定でサポートしています。
|
||||
但し「NORモード」と「DS振動カートリッジ」は、「3in1拡張パック」のみのサポートになります。
|
||||
|
||||
|
||||
<3in1拡張パックの仕様>
|
||||
1. 256Mbit(32MByte) NORfalsh page size is 1Mbits(128KB)
|
||||
2. 128Mbit(16MByte) PSRAM page size is 1Mbits(128KB)
|
||||
3. 4Mbit(512KByte) SRAM page size is 64Kbits(8KB)
|
||||
|
||||
<EZ FlashIV lite-deluxの仕様>
|
||||
1. 384Mbit(48MByte) NORfalsh page size is 1Mbits(128KB)
|
||||
2. 256Mbit(32MByte) PSRAM page size is 1Mbits(128KB)
|
||||
3. 8Mbit(1MByte) SRAM page size is 64Kbits(8KB)
|
||||
|
||||
<EWIN EXPANSION PAKの仕様>
|
||||
1. 256Mbit(32MByte) SDRAM
|
||||
2. 2Mbit(256KByte) SRAM page size is 256Kbits(64KB)
|
||||
|
||||
<DSTT GBA&EXPLORER 2IN1の仕様>
|
||||
1. 256Mbit(32MByte) SDRAM
|
||||
2. 1Mbit(128KByte) SRAM page size is 256Kbits(64KB)
|
||||
|
||||
<GBA Expansion Packの仕様>
|
||||
1. 256Mbit(32MByte) SDRAM
|
||||
2. 8Mbit(1MByte) SRAM page size is 256Kbits(64KB)
|
||||
|
||||
|
||||
<導入方法>
|
||||
「GBA_ExpLoader.NDS」は、DLDI対応ですので利用するSlot-1カードに合わせて
|
||||
パッチしてください(通常は自動DLDIパッチなのでそのままで動作します)。
|
||||
|
||||
・SDのルートに、"/GBA_SAVE"と"/GBA_SIGN"フォルダを作成します
|
||||
(iniファイルにて、ディレクトリを指定した場合はそのディレクトリを作成します)。
|
||||
・GBAファイルを入れます(場所は任意の位置でいいです)。
|
||||
・"/GBA_SAVE"フォルダに、GBAファイルと同じ名前でSAVファイルを入れます
|
||||
(SAVファイルが無い場合は、新規でGBAファイルと同じ名前でSAVファイルが作成されます)。
|
||||
・GBA起動時にフレームを使用したい場合は、gbaframe.bmp(24bitもしくは8bit)を
|
||||
ルート、SignDir、"/_system_"フォルダのいずれかに入れてください(記載順で検索)。
|
||||
|
||||
|
||||
<GBA ExpLoader.ini>
|
||||
各種動作環境の設定を記入します。'#'と'!'以降のその行の文字はコメントとして扱われます。
|
||||
GBA ExpLoader.iniは、SDのルートディレクトリに必ず置いてください。
|
||||
ロングファイル名のディレクトリを指定する場合は、"/GBA SAVE"のようにダブルコーテーションで
|
||||
括ってください。
|
||||
・SaveDir
|
||||
SAVファイルを格納するSDのディレクトリを指定します(初期値は、/GBA_SAVE)。
|
||||
・SignDir 0
|
||||
SGNファイルとheader.datを格納するSDのディレクトリを指定します(初期値は、/GBA_SIGN)。
|
||||
・No_MultiSave
|
||||
複数のSAVファイルを選択して取り扱う事を止めます(指定しない事で、MultiSAVEになります)。
|
||||
|
||||
|
||||
===《 重 要 》===========================================================================
|
||||
3in1_ExpPack_Toolとは、SRAMの管理情報が異なっています。
|
||||
3in1_ExpPack_Toolや他のツールと併用することはできません。
|
||||
他のツールで使用していた拡張パックを利用する場合は、必ずSRAMのバックアップを
|
||||
取ってから使用してください。
|
||||
=========================================================================================
|
||||
|
||||
|
||||
<使用方法>
|
||||
・「GBA_ExpLoader.NDS」を起動します。
|
||||
・「3in1拡張パック」では、<L><R>でPSRAMモード・NORモード・拡張モード(サポートされている場合のみ)を
|
||||
切り替えます。
|
||||
|
||||
自動的に、PSRAM/SDRAMモードで前回起動した時の保存されていないSRAMのSAVEデータを、SAVファイルに保存します。
|
||||
SAVファイルへの保存は、選択したSAVファイルに保存します(「保存しない」事も可能)。
|
||||
|
||||
(PSRAM/SDRAMモード)
|
||||
・<A>:選択したGBAファイルをSRAMパッチ後にPSRAMに書込みます。
|
||||
また、そのGBAの選択したSAVファイルをSRAMにロードします。
|
||||
PSRAMからGBAを起動します。
|
||||
・<B>:現在のSRAMのSAVEを、選択したSAVファイルに保存します。
|
||||
|
||||
・<Y>:<X>でバックアップした、SRAM.BINをSRAMに書き込みます。
|
||||
・<X>:全SRAM(512KB)を、SRAM.BINというファイルにバックアップします。
|
||||
|
||||
・<R>:ブラウザ拡張メモリに、設定してソフトリセットします(「3in1拡張パック」以外)。
|
||||
|
||||
|
||||
「3in1拡張パック」の場合は、PSRAMで実行できるファイルのサイズは16MByte(正確には16000KB)です。
|
||||
|
||||
画面には表示されていませんが、リセットがサポートされているカードでは<SELECT>で
|
||||
<A>のGBA起動の代わりにメニューに戻ります。
|
||||
DSの電源切入・拡張パックの抜き差しをするまではRAMからのGBA起動が可能です。
|
||||
|
||||
SAVファイルを取り替えたい場合等は、一度<B>で保存した(もしくは違うゲームを
|
||||
PSRAMで起動)後に、SAVファイルを入れ替えることで反映します。
|
||||
同一のゲームを続けて行う場合でも毎回選択したSAVファイルをSRAMに書込みます。
|
||||
|
||||
|
||||
(NORモード)「3in1拡張パック」のみ
|
||||
|
||||
・<A>:現在のSRAMのSAVEを選択したSAVファイルに保存します。
|
||||
選択したGBAファイルをSRAMパッチ後にNORにコピーします。
|
||||
また、そのGBAの選択したSAVファイルをSRAMにロードします。
|
||||
・<B>:現在のSRAMのSAVEを選択したSAVファイルに保存します。
|
||||
・<Y>:現在のNORのGBA用の選択したSAVファイルをSRAMにロードします。
|
||||
・<X>:NOR利用モードで、GBA(Slot-2)を起動します。
|
||||
|
||||
<X>のGBA(Slot-2)起動は、拡張パック単独での起動とまったく同じ動作です。
|
||||
|
||||
|
||||
(拡張モード)「3in1拡張パック」のみ
|
||||
振動レベル(小・中・大)とブラウザ拡張メモリに、設定してソフトリセットします。
|
||||
|
||||
|
||||
<3in1拡張パックとEZ4でのSRAMの構成>
|
||||
SRAMは、512KB(4Mbit)で8KB(64Kbits)単位のページングで使用できます。
|
||||
NORをGBAカートとして使う場合を考慮してNOR用のSAVEはオフセット64KBから使っています。
|
||||
64KB 未使用
|
||||
128KB NOR用SAVE
|
||||
8KB SAVE管理エリア
|
||||
128KB PSRAM用SAVE
|
||||
残り 未使用
|
||||
|
||||
<EWIN EXPANSION PAKでのSRAMの構成>
|
||||
SRAMは、256KB(1Mbit)で64KB(256Kbits)単位のページングで使用できます。
|
||||
128KB SDRAM用SAVE
|
||||
64KB SAVE管理エリア
|
||||
64KB 未使用
|
||||
|
||||
<DSTT GBA&EXPLORER 2IN1でのSRAMの構成>
|
||||
SRAMは、256KB(1Mbit)で64KB(256Kbits)単位のページングで使用できます。
|
||||
SAVE管理ファイルは、SignDirに"EXP128K.dat"のファイル名で作成されます。
|
||||
128KB SDRAM用SAVE
|
||||
1.5KB SAVE管理ファイル(EXP128K.dat)
|
||||
|
||||
<GBA Expansion Pack(M3/G6)でのSRAMの構成>
|
||||
SRAMは、256KB(1Mbit)で64KB(256Kbits)単位のページングで使用できます。
|
||||
256KB 未使用
|
||||
128KB SDRAM用SAVE
|
||||
64KB SAVE管理エリア
|
||||
残り 未使用
|
||||
|
||||
|
||||
<ソフトリセットについて>
|
||||
ソフトリセットが可能なSlot-1カードは次のものです。
|
||||
①標準サポート(ダイレクト起動)
|
||||
R4/M3Simply
|
||||
DSLink
|
||||
②システムファイルを利用
|
||||
SCDS(ONE)
|
||||
N-Card udisk.ndsをSDルートにコピー
|
||||
Acekard R.P.G akmenu4.ndsをSDルートにコピー
|
||||
X9SD
|
||||
DSTT(TTDS)
|
||||
③ファームウェア等を利用
|
||||
カードのファームウェアをバックアップしたNDSファイル等を、SoftReset.DLDI名(4文字)と
|
||||
いう名前でSDルートに置くことによってリセットする。
|
||||
|
||||
・EZ5では①のソフトリセットが可能ですが、カーネルメニューにて「3in1拡張パック」を初期設定しているため
|
||||
「DS振動カートリッジ/DS拡張メモリ」としての設定が無効になってしまうためサポートしていません。
|
||||
|
||||
|
||||
<ヘッダの修復について>
|
||||
ヘッダ情報が不正な、GBAファイルを自動的に修復して起動します(BINファイルは修復しません)。
|
||||
諸般の事情により、ヘッダ修復機能を利用したい場合は下記の手順でセットアップしてください。
|
||||
製品版のGBAファイルの先頭から256Byteを切り出し、header.datという名前で/GBA_SIGNフォルダに
|
||||
コピーします(切り出しが分からない方は、なるべく小さいGBAファイルをそのままheader.datとして
|
||||
コピーしてください)。
|
||||
|
||||
|
||||
<注意等>
|
||||
・SAVEタイプがSRAMタイプ以外の場合には、自動的にSRAMパッチを施します。
|
||||
SRAMパッチをサポートしているSAVEの形式は下記の通りです。
|
||||
EEPROM_V111、EEPROM_V120、EEPROM_V121、EEPROM_V122、EEPROM_V124、EEPROM_V125、EEPROM_V126
|
||||
FLASH_V120、FLASH_V121、FLASH_V123、FLASH_V124、FLASH_V125、FLASH_V126
|
||||
FLASH512_V130、FLASH512_V131、FLASH512_V133
|
||||
FLASH1M_V102、FLASH1M_V103
|
||||
Famicom Mini(Classic NES)の特殊なEEPROM_V122、EEPROM_V124、未定義タイプ
|
||||
・SAVファイルのサイズは、実際のSAVEのサイズにしています。但し、EEPROMタイプでは
|
||||
512Bか8KBかの判別が不可能なため全て8KBとしています。
|
||||
・SAVEタイプが判別不可能(SAVEなしも含む)な場合は、SAVEタイプをSRAMタイプと仮定して
|
||||
処理しています(SAVファイルのサイズは64KB)。
|
||||
・実際のSAVファイルのサイズは、先頭からが有効なデータであれば大きくても構いません。
|
||||
・SAVファイルは、GBAファイルと同じ名前でSaveDirフォルダに作成されます。
|
||||
・2回目の起動からSRAMパッチを高速に行うために、アナライズしたパッチ情報を
|
||||
SignDirフォルダにSGNファイルとして作成します。
|
||||
・拡張子をBINとしたファイルでは、パッチ処理を行いません。homebrewやパッチ済みの場合は、拡張子を
|
||||
GBAではなくBINとしてください。また、その場合のSAVファイルのサイズは64KBとなります。
|
||||
・SAVEファイルの選択で、SAVは拡張子がsavとなります。<1>から<5>は、sv1からsv5になります。
|
||||
・SAVファイルとSGNファイル用のフォルダは、できるだけ自分で作成してください
|
||||
(Slot-1カードの種類によっては正しく作成されません。N-Card系では時間が非常に長くかかります)。
|
||||
また、複数階層のディレクトリは自動では作成できませんので必ず自分で作成してください。
|
||||
・暫定サポートの「M3」「G6」「GBA Expansion Pack」では、FLASH1Mタイプのパッチは行いません(未完成)。
|
||||
・「DSTT GBA&EXPLORER 2IN1」では、SAVE管理をファイルで行っていますので複数の「DSTT GBA&EXPLORER 2IN1」を
|
||||
使い分けることはできません。また、Slot-1側のSDも使い分けできませんので注意が必要です。
|
||||
|
||||
<履歴>
|
||||
・V0.0 2008/2/6 プロトタイプ版
|
||||
・V0.1 2008/2/8 3in1/2in1のゲームに対応。
|
||||
・V0.2 2008/2/10 SAVファイルの拡張子の大文字/小文字の区別を無くした(バグってゴメンなさい)。
|
||||
BINファイルおよびUNKNOWNのゲームのSAVEサイズを64KBに変更。
|
||||
NORモードのタイトルの色を変更。
|
||||
PSRAMでの転送でDMAを使用するのを止めた(遅くなったけど安定した?)。
|
||||
・V0.3 2008/2/21 R4/M3Sで、リセット無効に設定している時の不具合を修正。
|
||||
EEPROM_V111のパッチ不具合の修正。
|
||||
NORモードのFLASH1M_V103のパッチ不具合の修正。
|
||||
「EZ4 lite-delux」と「EWIN EXPANSION PAK (2in1)」のサポート
|
||||
PSRAM/SDRAMモードでのSAVEデータを、「GBA_ExpLoader」起動時にSAVファイルへ
|
||||
書込むように仕様を変更(今までは次にRAMからGBA/BINを起動する時)。
|
||||
・V0.4 2008/3/1 メッセージを少し修正。
|
||||
EWIN EXP PAKで、拡張RAMやLINK等のリセット後に認識されないのを修正。
|
||||
EWIN EXP PAKで、SRAMが256KB無い時の判定を修正。
|
||||
SAVファイルを、SAVと<1>から<5>(sv1からsv5)の6種類から選択できるようにした。
|
||||
・V0.5β 2008/3/9
|
||||
Famicom Mini(Classic NES)のEEPROM_V124をサポート(EEPROM_V122は未サポート)。
|
||||
EWIN EXPANSION PAK (2in1)のSRAMが、128KBのタイプを暫定ですがサポート。
|
||||
GBAファイル時の自動ヘッダ修復機能を内蔵。
|
||||
iniファイルにて、SAVE/SIGNのディレクトリとMultiSave機能の無効を指定できるようにした。
|
||||
・V0.5β(1) 2008/3/10
|
||||
モジュール不正により勝手に差換え
|
||||
|
||||
・V0.5 2008/3/12 これより正式版
|
||||
Famicom Mini(Classic NES)のEEPROM_V122と未定義タイプをサポート。
|
||||
「DS振動カートリッジ」に設定した後の初期化の不具合を修正。
|
||||
ディレクトリの作成日付を入れるように修正。
|
||||
GBAのファイル名が、ショートネーム(半角8文字以内+.GBA)の場合に正しくSAVファイルを
|
||||
認識していなかった点を修正。
|
||||
・V0.51 2008/3/15
|
||||
エイリアス名を、Windows互換になるようにlibfatを修正(デジットは2桁に固定)。
|
||||
よって、0xE5問題("薔薇も使えます.gba")と空白・日本語を使用したショート名に対応。
|
||||
拡張カード判定を修正(変化ないかも?)。
|
||||
[EXP128K]時のSRAM.BINの処理の不具合を修正
|
||||
・V0.53 2008/3/22
|
||||
SRAMが128Kの「DSTT GBA&EXPLORER 2IN1」での判定の不具合を修正。
|
||||
「M3」「G6」「GBA Expansion Pack」の暫定サポート(FLASH1Mタイプのパッチは未実装)。
|
||||
ソフトリセット不可時での表示の不具合を修正。
|
||||
正しくSLOT-1タイプになっていない、SLOT-1のDLDIに対応。
|
||||
・V0.54 2008/3/23
|
||||
「M3」「G6」「GBA Expansion Pack」のSRAMの一部を壊わしてしまう不具合のため差換え。
|
||||
・V0.55 2008/3/30
|
||||
NOR書込み時の不具合を修正。
|
||||
「DSTT GBA&EXPLORER 2IN1」時に、SAVE管理をファイルにすることによりFLASH1Mタイプをサポート。
|
||||
・V0.56 2008/4/13
|
||||
SAVEのタイムスタンプ値の不正を修正。
|
||||
日本語ファイル名の表示時で、行末の処理を追加。
|
||||
ショートネーム(半角8文字以内+.GBA)の場合に大文字/小文字混在時の不具合を修正。
|
||||
・V0.57 2008/5/12
|
||||
SAVEのタイムスタンプ値の不正を再度修正(おそらく今度は大丈夫?)。
|
||||
Famicom Mini(Classic NES)のSAVEデータをVBAと同じに形式に変更。よって、今までのSAVEとは
|
||||
互換性がなくなったので注意が必要です(すいません!)。
|
||||
|
||||
by Rudolph (皇帝)
|
48
Makefile
Normal file
48
Makefile
Normal file
@ -0,0 +1,48 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
export TARGET := $(shell basename $(CURDIR))
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools - this can be deleted if you set the path in windows
|
||||
#---------------------------------------------------------------------------------
|
||||
export PATH := $(DEVKITARM)/bin:$(PATH)
|
||||
|
||||
.PHONY: $(TARGET).arm7 $(TARGET).arm9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(TARGET).nds
|
||||
|
||||
#$(TARGET).ds.gba : $(TARGET).nds
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).nds : $(TARGET).arm7 $(TARGET).arm9
|
||||
ndstool -c GBA_ExpLoader.nds -7 arm7/arm7.bin -9 arm9/arm9.bin -b arm9/logo32.bmp "GBA ExpLoader;Version 0.57;By Rudolph"
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).arm7 : arm7/$(TARGET).elf
|
||||
$(TARGET).arm9 : arm9/$(TARGET).elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
arm7/$(TARGET).elf:
|
||||
$(MAKE) -C arm7
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
arm9/$(TARGET).elf:
|
||||
$(MAKE) -C arm9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
$(MAKE) -C arm9 clean
|
||||
$(MAKE) -C arm7 clean
|
||||
rm -f $(TARGET).ds.gba $(TARGET).nds $(TARGET).arm7 $(TARGET).arm9
|
132
arm7/Makefile
Normal file
132
arm7/Makefile
Normal file
@ -0,0 +1,132 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include build
|
||||
DATA :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM7
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-rtti
|
||||
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -mno-fpu -Wl,-Map,../arm7.map
|
||||
|
||||
LIBS := -lnds7
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(LIBFAT)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export ARM7BIN := $(CURDIR)/arm7.bin
|
||||
export ARM7ELF := $(CURDIR)/arm7.elf
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(ARM7BIN) : $(ARM7ELF)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
|
||||
$(ARM7ELF) : $(OFILES)
|
||||
@echo linking $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
724
arm7/arm7.map
Normal file
724
arm7/arm7.map
Normal file
@ -0,0 +1,724 @@
|
||||
Archive member included because of file (symbol)
|
||||
|
||||
d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
main.o (rtcGetTimeAndDate)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
main.o (writePowerManagement)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
main.o (touchReadXY)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
main.o (irqSet)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
main.o (swiSoftReset)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(interrupts.o) (IntrMain)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
main.o (__aeabi_idiv)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o) (__div0)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o (_call_via_r3)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o (__libc_init_array)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
main.o (memcpy)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
d:/devkitPro/libnds/lib\libnds7.a(clock.o) (mktime)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o) (__tzcalc_limits)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o) (__tz_lock)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o) (_daylight)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o) (div)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o) (__gettzinfo)
|
||||
|
||||
Allocating common symbols
|
||||
Common symbol size file
|
||||
|
||||
_menu7_Gen 0x4 ret_menu7_Gen.o
|
||||
irqTable 0xc8 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
tempPos 0xc main.o
|
||||
first 0xc main.o
|
||||
|
||||
Memory Configuration
|
||||
|
||||
Name Origin Length Attributes
|
||||
rom 0x08000000 0x02000000
|
||||
iwram 0x037f8000 0x00018000
|
||||
*default* 0x00000000 0xffffffff
|
||||
|
||||
Linker script and memory map
|
||||
|
||||
0x037f8000 __iwram_start = 0x37f8000
|
||||
0x03810000 __iwram_top = 0x3810000
|
||||
0x0380ffa0 __sp_irq = (__iwram_top - 0x60)
|
||||
0x0380fea0 __sp_svc = (__sp_irq - 0x100)
|
||||
0x0380fda0 __sp_usr = (__sp_svc - 0x100)
|
||||
0x0380fff8 __irq_flags = (__iwram_top - 0x8)
|
||||
0x0380fffc __irq_vector = (__iwram_top - 0x4)
|
||||
|
||||
.init 0x037f8000 0xe8
|
||||
0x037f8000 __text_start = .
|
||||
*(.init)
|
||||
.init 0x037f8000 0xd0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
0x037f8000 _start
|
||||
.init 0x037f80d0 0xc d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
0x037f80d0 _init
|
||||
.init 0x037f80dc 0xc d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
0x037f80e8 . = ALIGN (0x4)
|
||||
|
||||
.plt
|
||||
*(.plt)
|
||||
|
||||
.text 0x037f80f0 0x3298
|
||||
*(.text.*)
|
||||
*(.stub)
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
*(.glue_7)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.glue_7 0x037f80f0 0x0 main.o
|
||||
.glue_7 0x037f80f0 0x0 ret_menu7_Gen.o
|
||||
.glue_7 0x037f80f0 0x0 ret_menu7_R4.o
|
||||
.glue_7 0x037f80f0 0x0 ret_menu7_mse.o
|
||||
.glue_7 0x037f80f0 0x0 linkreset_arm7.o
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
.glue_7 0x037f80f0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
.glue_7 0x037f80f0 0x9c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
0x037f812c __irqSet_from_arm
|
||||
0x037f8180 __swiSoftReset_from_arm
|
||||
0x037f815c __swiDelay_from_arm
|
||||
0x037f8138 __irqEnable_from_arm
|
||||
0x037f8174 __touchReadTemperature_from_arm
|
||||
0x037f80f0 ___call_via_r3_from_arm
|
||||
0x037f8108 __swiSwitchToGBAMode_from_arm
|
||||
0x037f8150 __touchReadXY_from_arm
|
||||
0x037f8168 __rtcGetTimeAndDate_from_arm
|
||||
0x037f8114 __irqInit_from_arm
|
||||
0x037f8144 __swiWaitForVBlank_from_arm
|
||||
0x037f8120 __initClockIRQ_from_arm
|
||||
0x037f80fc __writePowerManagement_from_arm
|
||||
.glue_7 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
*(.glue_7t)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.glue_7t 0x037f818c 0x0 main.o
|
||||
.glue_7t 0x037f818c 0x0 ret_menu7_Gen.o
|
||||
.glue_7t 0x037f818c 0x0 ret_menu7_R4.o
|
||||
.glue_7t 0x037f818c 0x0 ret_menu7_mse.o
|
||||
.glue_7t 0x037f818c 0x0 linkreset_arm7.o
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
.glue_7t 0x037f818c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
.glue_7t 0x037f818c 0x10 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
0x037f818c __mktime_from_thumb
|
||||
0x037f8194 ____aeabi_idiv_from_thumb
|
||||
0x037f8190 __mktime_change_to_arm
|
||||
0x037f8198 ____aeabi_idiv_change_to_arm
|
||||
.glue_7t 0x037f819c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
0x037f819c . = ALIGN (0x4)
|
||||
.text 0x037f819c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
.text 0x037f819c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
.text 0x037f819c 0xa4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.text 0x037f8240 0x6ac main.o
|
||||
0x037f842c VcountHandler
|
||||
0x037f86bc PM_SetControl
|
||||
0x037f8240 FIFOInit
|
||||
0x037f8318 gbaMode
|
||||
0x037f8258 startSound
|
||||
0x037f8534 PM_SetRegister
|
||||
0x037f839c main
|
||||
0x037f86dc VblankHandler
|
||||
0x037f85d8 PM_GetRegister
|
||||
0x037f82ec getFreeSoundChannel
|
||||
.text 0x037f88ec 0x300 ret_menu7_Gen.o
|
||||
0x037f88ec ret_menu7_Gen
|
||||
0x037f8a0c _menu7_Gen_s
|
||||
.text 0x037f8bec 0x2c4 ret_menu7_R4.o
|
||||
0x037f8d00 ret_menu7_R4
|
||||
.text 0x037f8eb0 0x118 ret_menu7_mse.o
|
||||
0x037f8eb0 ret_menu7_mse
|
||||
.text 0x037f8fc8 0x18 linkreset_arm7.o
|
||||
0x037f8fc8 LinkReset_ARM7
|
||||
.text 0x037f8fe0 0x3d0 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
0x037f8fe0 BCDToInteger
|
||||
0x037f912c rtcSetTime
|
||||
0x037f9154 rtcGetTime
|
||||
0x037f9298 initClockIRQ
|
||||
0x037f925c integerToBCD
|
||||
0x037f9354 syncRTC
|
||||
0x037f91a0 rtcSetTimeAndDate
|
||||
0x037f9218 rtcReset
|
||||
0x037f900c rtcTransaction
|
||||
0x037f91cc rtcGetTimeAndDate
|
||||
.text 0x037f93b0 0xf0 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
0x037f93b0 writePowerManagement
|
||||
0x037f9408 readFirmware
|
||||
.text 0x037f94a0 0x7dc d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
0x037f9520 CheckStylus
|
||||
0x037f9b7c touchRead
|
||||
0x037f9650 readTouchValue
|
||||
0x037f9c48 touchReadTemperature
|
||||
0x037f987c touchReadXY
|
||||
0x037f94a0 UpdateRange
|
||||
.text 0x037f9c7c 0x21c d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
0x037f9df4 irqEnable
|
||||
0x037f9c80 irqSet
|
||||
0x037f9e4c irqDisable
|
||||
0x037f9cec irqInit
|
||||
0x037f9c7c irqDummy
|
||||
0x037f9dc0 irqInitHandler
|
||||
0x037f9d3c irqClear
|
||||
*fill* 0x037f9e98 0x8 ff
|
||||
.text 0x037f9ea0 0x80 d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
0x037f9eb0 swiSleep
|
||||
0x037f9eea swiDecompressLZSSVram
|
||||
0x037f9f02 swiGetPitchTable
|
||||
0x037f9ed2 swiFastCopy
|
||||
0x037f9ed6 swiSqrt
|
||||
0x037f9f0a swiSwitchToGBAMode
|
||||
0x037f9ea0 swiSoftReset
|
||||
0x037f9eda swiCRC16
|
||||
0x037f9eee swiDecompressHuffman
|
||||
0x037f9f0e swiSetHaltCR
|
||||
0x037f9efe swiGetSineTable
|
||||
0x037f9f06 swiGetVolumeTable
|
||||
0x037f9ebc swiRemainder
|
||||
0x037f9ee2 swiUnpackBits
|
||||
0x037f9efa swiHalt
|
||||
0x037f9ee6 swiDecompressLZSSWram
|
||||
0x037f9ea4 swiDelay
|
||||
0x037f9ec2 swiDivMod
|
||||
0x037f9ef6 swiDecompressRLEVram
|
||||
0x037f9ef2 swiDecompressRLEWram
|
||||
0x037f9eb8 swiDivide
|
||||
0x037f9eb4 swiChangeSoundBias
|
||||
0x037f9eac swiWaitForVBlank
|
||||
0x037f9ea8 swiIntrWait
|
||||
0x037f9ede swiIsDebugger
|
||||
0x037f9ece swiCopy
|
||||
.text 0x037f9f20 0xc8 d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
0x037f9f20 IntrMain
|
||||
.text 0x037f9fe8 0x144 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
0x037f9fe8 __aeabi_idiv
|
||||
0x037f9fe8 __divsi3
|
||||
0x037fa114 __aeabi_idivmod
|
||||
.text 0x037fa12c 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
0x037fa12c __aeabi_ldiv0
|
||||
0x037fa12c __div0
|
||||
0x037fa12c __aeabi_idiv0
|
||||
.text 0x037fa130 0x3c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
0x037fa138 _call_via_r2
|
||||
0x037fa148 _call_via_r6
|
||||
0x037fa144 _call_via_r5
|
||||
0x037fa13c _call_via_r3
|
||||
0x037fa15c _call_via_fp
|
||||
0x037fa150 _call_via_r8
|
||||
0x037fa14c _call_via_r7
|
||||
0x037fa130 _call_via_r0
|
||||
0x037fa158 _call_via_sl
|
||||
0x037fa164 _call_via_sp
|
||||
0x037fa154 _call_via_r9
|
||||
0x037fa140 _call_via_r4
|
||||
0x037fa134 _call_via_r1
|
||||
0x037fa160 _call_via_ip
|
||||
0x037fa168 _call_via_lr
|
||||
.text 0x037fa16c 0xd4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
0x037fa1b8 __libc_init_array
|
||||
0x037fa16c __libc_fini_array
|
||||
.text 0x037fa240 0x9c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
0x037fa240 memcpy
|
||||
.text 0x037fa2dc 0x7e4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
0x037fa694 mktime
|
||||
.text 0x037faac0 0x848 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
0x037faac0 __tzcalc_limits
|
||||
0x037fad30 _mktm_r
|
||||
.text 0x037fb308 0x8 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
0x037fb30c __tz_unlock
|
||||
0x037fb308 __tz_lock
|
||||
.text 0x037fb310 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
.text 0x037fb310 0x6c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
0x037fb310 div
|
||||
.text 0x037fb37c 0xc d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
0x037fb37c __gettzinfo
|
||||
.text 0x037fb388 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
.text 0x037fb388 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
|
||||
.fini 0x037fb388 0x18
|
||||
*(.fini)
|
||||
.fini 0x037fb388 0xc d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
0x037fb388 _fini
|
||||
.fini 0x037fb394 0xc d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
0x037fb3a0 __text_end = .
|
||||
|
||||
.rodata 0x037fb3a0 0xcc
|
||||
*(.rodata)
|
||||
.rodata 0x037fb3a0 0x60 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.rodata 0x037fb400 0x68 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
*all.rodata*(*)
|
||||
*(.roda)
|
||||
*(.rodata.*)
|
||||
.rodata.str1.4
|
||||
0x037fb468 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
*(.gnu.linkonce.r*)
|
||||
0x037fb46c . = ALIGN (0x4)
|
||||
|
||||
.ARM.extab
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
0x037fb46c __exidx_start = .
|
||||
|
||||
.ARM.exidx
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
0x037fb46c __exidx_end = .
|
||||
0x037fb46c . = ALIGN (0x4)
|
||||
0x037fb46c PROVIDE (__preinit_array_start, .)
|
||||
|
||||
.preinit_array
|
||||
*(.preinit_array)
|
||||
0x037fb46c PROVIDE (__preinit_array_end, .)
|
||||
0x037fb46c PROVIDE (__init_array_start, .)
|
||||
|
||||
.init_array 0x037fb46c 0x4
|
||||
*(.init_array)
|
||||
.init_array 0x037fb46c 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
0x037fb470 PROVIDE (__init_array_end, .)
|
||||
0x037fb470 PROVIDE (__fini_array_start, .)
|
||||
|
||||
.fini_array 0x037fb470 0x4
|
||||
*(.fini_array)
|
||||
.fini_array 0x037fb470 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
0x037fb474 PROVIDE (__fini_array_end, .)
|
||||
|
||||
.ctors 0x037fb474 0x0
|
||||
*crtbegin.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
0x037fb474 . = ALIGN (0x4)
|
||||
|
||||
.dtors 0x037fb474 0x0
|
||||
*crtbegin.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
0x037fb474 . = ALIGN (0x4)
|
||||
|
||||
.eh_frame 0x037fb474 0x4
|
||||
*(.eh_frame)
|
||||
.eh_frame 0x037fb474 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.eh_frame 0x037fb474 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
0x037fb478 . = ALIGN (0x4)
|
||||
|
||||
.gcc_except_table
|
||||
0x037fb478 0x0
|
||||
*(.gcc_except_table)
|
||||
0x037fb478 . = ALIGN (0x4)
|
||||
|
||||
.jcr 0x037fb478 0x4
|
||||
*(.jcr)
|
||||
.jcr 0x037fb478 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.jcr 0x037fb478 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
|
||||
.got
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
|
||||
.iwram 0x037fb47c 0x0
|
||||
0x037fb47c __iwram_start = <code 342> (.)
|
||||
*(.iwram)
|
||||
*iwram.*(.text)
|
||||
0x037fb47c . = ALIGN (0x4)
|
||||
0x037fb47c __iwram_end = <code 342> (.)
|
||||
|
||||
.data 0x037fb47c 0x54
|
||||
0x037fb47c __data_start = <code 342> (.)
|
||||
*(.data)
|
||||
.data 0x037fb47c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
.data 0x037fb47c 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
.data 0x037fb47c 0x4 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
0x037fb47c __dso_handle
|
||||
.data 0x037fb480 0x4 main.o
|
||||
.data 0x037fb484 0x0 ret_menu7_Gen.o
|
||||
.data 0x037fb484 0x0 ret_menu7_R4.o
|
||||
.data 0x037fb484 0x0 ret_menu7_mse.o
|
||||
.data 0x037fb484 0x0 linkreset_arm7.o
|
||||
.data 0x037fb484 0x0 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.data 0x037fb484 0x0 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.data 0x037fb484 0x1 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.data 0x037fb485 0x0 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
.data 0x037fb485 0x0 d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
.data 0x037fb485 0x0 d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
.data 0x037fb485 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
*fill* 0x037fb485 0x3 ff
|
||||
.data 0x037fb488 0x8 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
0x037fb488 _tzname
|
||||
.data 0x037fb490 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
.data 0x037fb490 0x40 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
.data 0x037fb4d0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
.data 0x037fb4d0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
0x037fb4d0 . = ALIGN (0x4)
|
||||
0x037fb4d0 __data_end = <code 342> (.)
|
||||
|
||||
.bss 0x037fb4d0 0x11c
|
||||
0x037fb4d0 __bss_start = <code 342> (.)
|
||||
0x037fb4d0 __bss_start__ = <code 342> (.)
|
||||
*(.dynbss)
|
||||
*(.gnu.linkonce.b*)
|
||||
*(.bss*)
|
||||
.bss 0x037fb4d0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
.bss 0x037fb4d0 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
.bss 0x037fb4d0 0x1c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.bss 0x037fb4ec 0x0 main.o
|
||||
.bss 0x037fb4ec 0x0 ret_menu7_Gen.o
|
||||
.bss 0x037fb4ec 0x0 ret_menu7_R4.o
|
||||
.bss 0x037fb4ec 0x0 ret_menu7_mse.o
|
||||
.bss 0x037fb4ec 0x0 linkreset_arm7.o
|
||||
.bss 0x037fb4ec 0x0 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.bss 0x037fb4ec 0x0 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.bss 0x037fb4ec 0x14 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
.bss 0x037fb500 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
.bss 0x037fb500 0x8 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
0x037fb500 _daylight
|
||||
0x037fb504 _timezone
|
||||
.bss 0x037fb508 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
.bss 0x037fb508 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
.bss 0x037fb508 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
.bss 0x037fb508 0x0 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
*(COMMON)
|
||||
COMMON 0x037fb508 0x18 main.o
|
||||
0x037fb508 tempPos
|
||||
0x037fb514 first
|
||||
COMMON 0x037fb520 0x4 ret_menu7_Gen.o
|
||||
0x037fb520 _menu7_Gen
|
||||
COMMON 0x037fb524 0xc8 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
0x037fb524 irqTable
|
||||
0x037fb5ec . = ALIGN (0x4)
|
||||
0x037fb5ec __bss_end = .
|
||||
0x037fb5ec __bss_end__ = .
|
||||
0x037fb5ec _end = .
|
||||
0x037fb5ec __end__ = .
|
||||
0x037fb5ec PROVIDE (end, _end)
|
||||
|
||||
.stab
|
||||
*(.stab)
|
||||
|
||||
.stabstr
|
||||
*(.stabstr)
|
||||
|
||||
.stab.excl
|
||||
*(.stab.excl)
|
||||
|
||||
.stab.exclstr
|
||||
*(.stab.exclstr)
|
||||
|
||||
.stab.index
|
||||
*(.stab.index)
|
||||
|
||||
.stab.indexstr
|
||||
*(.stab.indexstr)
|
||||
|
||||
.comment 0x00000000 0x2e2
|
||||
*(.comment)
|
||||
.comment 0x00000000 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.comment 0x00000029 0x29 main.o
|
||||
.comment 0x00000052 0x29 ret_menu7_Gen.o
|
||||
.comment 0x0000007b 0x29 ret_menu7_R4.o
|
||||
.comment 0x000000a4 0x29 ret_menu7_mse.o
|
||||
.comment 0x000000cd 0x29 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.comment 0x000000f6 0x29 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.comment 0x0000011f 0x29 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.comment 0x00000148 0x29 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
.comment 0x00000171 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
.comment 0x0000019a 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
.comment 0x000001c3 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.comment 0x000001ec 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
.comment 0x00000215 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
.comment 0x0000023e 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
.comment 0x00000267 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
.comment 0x00000290 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
.comment 0x000002b9 0x29 d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
|
||||
.debug
|
||||
*(.debug)
|
||||
|
||||
.line
|
||||
*(.line)
|
||||
|
||||
.debug_srcinfo
|
||||
*(.debug_srcinfo)
|
||||
|
||||
.debug_sfnames
|
||||
*(.debug_sfnames)
|
||||
|
||||
.debug_aranges 0x00000000 0x120
|
||||
*(.debug_aranges)
|
||||
.debug_aranges
|
||||
0x00000000 0x20 main.o
|
||||
.debug_aranges
|
||||
0x00000020 0x20 ret_menu7_Gen.o
|
||||
.debug_aranges
|
||||
0x00000040 0x20 ret_menu7_R4.o
|
||||
.debug_aranges
|
||||
0x00000060 0x20 ret_menu7_mse.o
|
||||
.debug_aranges
|
||||
0x00000080 0x20 linkreset_arm7.o
|
||||
.debug_aranges
|
||||
0x000000a0 0x20 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_aranges
|
||||
0x000000c0 0x20 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_aranges
|
||||
0x000000e0 0x20 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_aranges
|
||||
0x00000100 0x20 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_pubnames
|
||||
0x00000000 0x34b
|
||||
*(.debug_pubnames)
|
||||
.debug_pubnames
|
||||
0x00000000 0xcd main.o
|
||||
.debug_pubnames
|
||||
0x000000cd 0x44 ret_menu7_Gen.o
|
||||
.debug_pubnames
|
||||
0x00000111 0x23 ret_menu7_R4.o
|
||||
.debug_pubnames
|
||||
0x00000134 0x24 ret_menu7_mse.o
|
||||
.debug_pubnames
|
||||
0x00000158 0xbb d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_pubnames
|
||||
0x00000213 0x3c d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_pubnames
|
||||
0x0000024f 0x7c d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_pubnames
|
||||
0x000002cb 0x80 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_info 0x00000000 0x1e10
|
||||
*(.debug_info)
|
||||
.debug_info 0x00000000 0x85b main.o
|
||||
.debug_info 0x0000085b 0x1d5 ret_menu7_Gen.o
|
||||
.debug_info 0x00000a30 0x198 ret_menu7_R4.o
|
||||
.debug_info 0x00000bc8 0xdb ret_menu7_mse.o
|
||||
.debug_info 0x00000ca3 0x82 linkreset_arm7.o
|
||||
.debug_info 0x00000d25 0x74b d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_info 0x00001470 0x140 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_info 0x000015b0 0x615 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_info 0x00001bc5 0x24b d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_abbrev 0x00000000 0xa67
|
||||
*(.debug_abbrev)
|
||||
.debug_abbrev 0x00000000 0x2cc main.o
|
||||
.debug_abbrev 0x000002cc 0xb7 ret_menu7_Gen.o
|
||||
.debug_abbrev 0x00000383 0xf2 ret_menu7_R4.o
|
||||
.debug_abbrev 0x00000475 0x85 ret_menu7_mse.o
|
||||
.debug_abbrev 0x000004fa 0x14 linkreset_arm7.o
|
||||
.debug_abbrev 0x0000050e 0x1a8 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_abbrev 0x000006b6 0xa4 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_abbrev 0x0000075a 0x1d8 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_abbrev 0x00000932 0x135 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_line 0x00000000 0xe62
|
||||
*(.debug_line)
|
||||
.debug_line 0x00000000 0x2a6 main.o
|
||||
.debug_line 0x000002a6 0x14f ret_menu7_Gen.o
|
||||
.debug_line 0x000003f5 0x180 ret_menu7_R4.o
|
||||
.debug_line 0x00000575 0x109 ret_menu7_mse.o
|
||||
.debug_line 0x0000067e 0x69 linkreset_arm7.o
|
||||
.debug_line 0x000006e7 0x1e7 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_line 0x000008ce 0x118 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_line 0x000009e6 0x321 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_line 0x00000d07 0x15b d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_frame 0x00000000 0x4e8
|
||||
*(.debug_frame)
|
||||
.debug_frame 0x00000000 0x114 main.o
|
||||
.debug_frame 0x00000114 0x44 ret_menu7_Gen.o
|
||||
.debug_frame 0x00000158 0x50 ret_menu7_R4.o
|
||||
.debug_frame 0x000001a8 0x28 ret_menu7_mse.o
|
||||
.debug_frame 0x000001d0 0x144 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_frame 0x00000314 0x44 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_frame 0x00000358 0xe0 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_frame 0x00000438 0xb0 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_str 0x00000000 0x8b6
|
||||
*(.debug_str)
|
||||
.debug_str 0x00000000 0x33d main.o
|
||||
0x3c5 (size before relaxing)
|
||||
.debug_str 0x0000033d 0x87 ret_menu7_Gen.o
|
||||
0x179 (size before relaxing)
|
||||
.debug_str 0x000003c4 0x61 ret_menu7_R4.o
|
||||
0x148 (size before relaxing)
|
||||
.debug_str 0x00000425 0x44 ret_menu7_mse.o
|
||||
0x12b (size before relaxing)
|
||||
.debug_str 0x00000469 0x18b d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
0x3aa (size before relaxing)
|
||||
.debug_str 0x000005f4 0x71 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
0x173 (size before relaxing)
|
||||
.debug_str 0x00000665 0x18e d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
0x2fa (size before relaxing)
|
||||
.debug_str 0x000007f3 0xc3 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
0x1b4 (size before relaxing)
|
||||
|
||||
.debug_loc 0x00000000 0x1482
|
||||
*(.debug_loc)
|
||||
.debug_loc 0x00000000 0x346 main.o
|
||||
.debug_loc 0x00000346 0x2ac ret_menu7_Gen.o
|
||||
.debug_loc 0x000005f2 0x119 ret_menu7_R4.o
|
||||
.debug_loc 0x0000070b 0x5f ret_menu7_mse.o
|
||||
.debug_loc 0x0000076a 0x446 d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.debug_loc 0x00000bb0 0xf2 d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.debug_loc 0x00000ca2 0x6ab d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.debug_loc 0x0000134d 0x135 d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
|
||||
.debug_macinfo
|
||||
*(.debug_macinfo)
|
||||
|
||||
.debug_weaknames
|
||||
*(.debug_weaknames)
|
||||
|
||||
.debug_funcnames
|
||||
*(.debug_funcnames)
|
||||
|
||||
.debug_typenames
|
||||
*(.debug_typenames)
|
||||
|
||||
.debug_varnames
|
||||
*(.debug_varnames)
|
||||
|
||||
.stack 0x00080000 0x0
|
||||
0x00080000 _stack = .
|
||||
*(.stack)
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
LOAD main.o
|
||||
LOAD ret_menu7_Gen.o
|
||||
LOAD ret_menu7_R4.o
|
||||
LOAD ret_menu7_mse.o
|
||||
LOAD linkreset_arm7.o
|
||||
LOAD d:/devkitPro/libnds/lib\libnds7.a
|
||||
START GROUP
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libc.a
|
||||
END GROUP
|
||||
START GROUP
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libsysbase.a
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libc.a
|
||||
END GROUP
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
LOAD d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
OUTPUT(d:/NDSŠJ”/GBA_ExpLoader5/arm7/arm7.elf elf32-littlearm)
|
||||
|
||||
.ARM.attributes
|
||||
0x00000000 0x10
|
||||
.ARM.attributes
|
||||
0x00000000 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib/ds_arm7_crt0.o
|
||||
.ARM.attributes
|
||||
0x0000001e 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crti.o
|
||||
.ARM.attributes
|
||||
0x0000003c 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtbegin.o
|
||||
.ARM.attributes
|
||||
0x0000005a 0x1e main.o
|
||||
.ARM.attributes
|
||||
0x00000078 0x1e ret_menu7_Gen.o
|
||||
.ARM.attributes
|
||||
0x00000096 0x1e ret_menu7_R4.o
|
||||
.ARM.attributes
|
||||
0x000000b4 0x1e ret_menu7_mse.o
|
||||
.ARM.attributes
|
||||
0x000000d2 0x1e linkreset_arm7.o
|
||||
.ARM.attributes
|
||||
0x000000f0 0x1e d:/devkitPro/libnds/lib\libnds7.a(clock.o)
|
||||
.ARM.attributes
|
||||
0x0000010e 0x1e d:/devkitPro/libnds/lib\libnds7.a(spi.o)
|
||||
.ARM.attributes
|
||||
0x0000012c 0x1e d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
||||
.ARM.attributes
|
||||
0x0000014a 0x1e d:/devkitPro/libnds/lib\libnds7.a(interrupts.o)
|
||||
.ARM.attributes
|
||||
0x00000168 0x1e d:/devkitPro/libnds/lib\libnds7.a(biosCalls.o)
|
||||
.ARM.attributes
|
||||
0x00000186 0x1e d:/devkitPro/libnds/lib\libnds7.a(interruptDispatcher.o)
|
||||
.ARM.attributes
|
||||
0x000001a4 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_divsi3.o)
|
||||
.ARM.attributes
|
||||
0x000001c2 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_dvmd_tls.o)
|
||||
.ARM.attributes
|
||||
0x000001e0 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2\libgcc.a(_call_via_rX.o)
|
||||
.ARM.attributes
|
||||
0x000001fe 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-init.o)
|
||||
.ARM.attributes
|
||||
0x0000021c 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-memcpy.o)
|
||||
.ARM.attributes
|
||||
0x0000023a 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktime.o)
|
||||
.ARM.attributes
|
||||
0x00000258 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-mktm_r.o)
|
||||
.ARM.attributes
|
||||
0x00000276 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzlock.o)
|
||||
.ARM.attributes
|
||||
0x00000294 0x1c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-tzvars.o)
|
||||
.ARM.attributes
|
||||
0x000002b0 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-div.o)
|
||||
.ARM.attributes
|
||||
0x000002ce 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/../../../../arm-eabi/lib\libg.a(lib_a-gettzinfo.o)
|
||||
.ARM.attributes
|
||||
0x000002ec 0x1c d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtend.o
|
||||
.ARM.attributes
|
||||
0x00000308 0x1e d:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.2/crtn.o
|
||||
|
||||
.debug_ranges 0x00000000 0xd0
|
||||
.debug_ranges 0x00000000 0x88 main.o
|
||||
.debug_ranges 0x00000088 0x48 d:/devkitPro/libnds/lib\libnds7.a(touch.o)
|
18
arm7/source/linkreset_arm7.h
Normal file
18
arm7/source/linkreset_arm7.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void LinkReset_ARM7();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
--------------------------
|
||||
EDIY Studio
|
||||
http://www.gbalink.net
|
||||
http://www.ds-link.net
|
||||
--------------------------
|
||||
*/
|
20
arm7/source/linkreset_arm7.s
Normal file
20
arm7/source/linkreset_arm7.s
Normal file
@ -0,0 +1,20 @@
|
||||
.TEXT
|
||||
.ARM
|
||||
|
||||
@---------------------------------------------------------------------------------------
|
||||
.GLOBAL LinkReset_ARM7
|
||||
.func LinkReset_ARM7
|
||||
@---------------------------------------------------------------------------------------
|
||||
LinkReset_ARM7:
|
||||
MOV R12,#0x2800000
|
||||
LDR R1,[R12,#-0x1DC]
|
||||
ADD R1,R1,#0x1FC
|
||||
CMP R12, R1
|
||||
|
||||
SUBEQ R15,R12,#0x700000
|
||||
|
||||
BX LR
|
||||
|
||||
.endfunc
|
||||
|
||||
.end
|
297
arm7/source/main.c
Normal file
297
arm7/source/main.c
Normal file
@ -0,0 +1,297 @@
|
||||
#include <nds.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "linkreset_arm7.h"
|
||||
|
||||
|
||||
extern void ret_menu7_R4(void);
|
||||
extern void ret_menu7_Gen(void);
|
||||
extern void ret_menu7_mse(void);
|
||||
|
||||
|
||||
#define IPC_CMD_GBAMODE 1
|
||||
#define IPC_CMD_SLOT2 2
|
||||
#define IPC_CMD_TURNOFF 9
|
||||
#define IPC_CMD_SR_R4TF 11
|
||||
#define IPC_CMD_SR_DLMS 12
|
||||
#define IPC_CMD_SR_GEN 13
|
||||
#define IPC_CMD_SR_MSE 14
|
||||
|
||||
|
||||
void FIFOInit()
|
||||
{
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
}
|
||||
|
||||
|
||||
static void prepairReset()
|
||||
{
|
||||
vu32 vr;
|
||||
u32 i;
|
||||
|
||||
powerON(POWER_SOUND);
|
||||
|
||||
for(i = 0x040000B0; i < (0x040000B0+0x30); i+=4) {
|
||||
*((vu32*)i) = 0;
|
||||
}
|
||||
|
||||
REG_IME = IME_DISABLE;
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
|
||||
for(vr = 0; vr < 0x100; vr++); // Wait ARM9
|
||||
|
||||
swiSoftReset();
|
||||
}
|
||||
|
||||
|
||||
void gbaMode()
|
||||
{
|
||||
vu32 vr;
|
||||
|
||||
REG_IME = IME_DISABLE;
|
||||
for(vr = 0; vr < 0x1000; vr++); // Wait ARM9
|
||||
|
||||
if (((*(vu32*)0x027FFCE4 >> 3) & 0x01) == 0x01)
|
||||
writePowerManagement(0, PM_BACKLIGHT_BOTTOM | PM_SOUND_AMP);
|
||||
else writePowerManagement(0, PM_BACKLIGHT_TOP | PM_SOUND_AMP);
|
||||
|
||||
swiSwitchToGBAMode();
|
||||
// asm("mov r2, #0x40");
|
||||
// asm("swi 0x1F0000");
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
__attribute__((noinline)) u8 PM_GetRegister(int reg)
|
||||
{
|
||||
|
||||
// while(REG_SPICNT & SPI_BUSY)
|
||||
// SWI_WaitByLoop(1);
|
||||
SerialWaitBusy();
|
||||
|
||||
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER |SPI_BAUD_1MHz | SPI_CONTINUOUS;
|
||||
REG_SPIDATA = reg | 0x80;
|
||||
|
||||
SerialWaitBusy();
|
||||
// while(REG_SPICNT & SPI_BUSY)
|
||||
// SWI_WaitByLoop(1);
|
||||
|
||||
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER |SPI_BAUD_1MHz ;
|
||||
REG_SPIDATA = 0;
|
||||
|
||||
SerialWaitBusy();
|
||||
// while(REG_SPICNT & SPI_BUSY)
|
||||
// SWI_WaitByLoop(1);
|
||||
|
||||
|
||||
return REG_SPIDATA & 0xff;
|
||||
}
|
||||
|
||||
__attribute__((noinline)) void PM_SetRegister(int reg, int control)
|
||||
{
|
||||
|
||||
SerialWaitBusy();
|
||||
// while(REG_SPICNT & SPI_BUSY)
|
||||
// SWI_WaitByLoop(1);
|
||||
|
||||
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
|
||||
REG_SPIDATA = reg;
|
||||
|
||||
SerialWaitBusy();
|
||||
// while(REG_SPICNT & SPI_BUSY)
|
||||
// SWI_WaitByLoop(1);
|
||||
|
||||
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz;
|
||||
REG_SPIDATA = control;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PM_SetControl(int control)
|
||||
{
|
||||
PM_SetRegister(0, PM_GetRegister(0) | control);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void startSound(int sampleRate, const void* data, u32 bytes, u8 channel, u8 vol, u8 pan, u8 format) {
|
||||
//---------------------------------------------------------------------------------
|
||||
SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
|
||||
SCHANNEL_SOURCE(channel) = (u32)data;
|
||||
SCHANNEL_LENGTH(channel) = bytes >> 2 ;
|
||||
SCHANNEL_CR(channel) = SCHANNEL_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
s32 getFreeSoundChannel() {
|
||||
//---------------------------------------------------------------------------------
|
||||
int i;
|
||||
for (i=0; i<16; i++) {
|
||||
if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 ) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
touchPosition first,tempPos;
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void VcountHandler() {
|
||||
//---------------------------------------------------------------------------------
|
||||
static int lastbut = -1;
|
||||
|
||||
uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0;
|
||||
|
||||
but = REG_KEYXY;
|
||||
|
||||
if (!( (but ^ lastbut) & (1<<6))) {
|
||||
|
||||
tempPos = touchReadXY();
|
||||
|
||||
if ( tempPos.x == 0 || tempPos.y == 0 ) {
|
||||
but |= (1 <<6);
|
||||
lastbut = but;
|
||||
} else {
|
||||
x = tempPos.x;
|
||||
y = tempPos.y;
|
||||
xpx = tempPos.px;
|
||||
ypx = tempPos.py;
|
||||
z1 = tempPos.z1;
|
||||
z2 = tempPos.z2;
|
||||
}
|
||||
|
||||
} else {
|
||||
lastbut = but;
|
||||
but |= (1 <<6);
|
||||
}
|
||||
|
||||
IPC->touchX = x;
|
||||
IPC->touchY = y;
|
||||
IPC->touchXpx = xpx;
|
||||
IPC->touchYpx = ypx;
|
||||
IPC->touchZ1 = z1;
|
||||
IPC->touchZ2 = z2;
|
||||
IPC->buttons = but;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
#define READ_TIME_AND_DATE 0x65
|
||||
//---------------------------------------------------------------------------------
|
||||
void rtcGetTimeAndDate(uint8 * time) {
|
||||
//---------------------------------------------------------------------------------
|
||||
uint8 command, status;
|
||||
|
||||
command = READ_TIME_AND_DATE;
|
||||
rtcTransaction(&command, 1, time, 7);
|
||||
|
||||
command = READ_STATUS_REG1;
|
||||
rtcTransaction(&command, 1, &status, 1);
|
||||
|
||||
if ( status & STATUS_24HRS ) {
|
||||
time[4] &= 0x3f;
|
||||
} else {
|
||||
|
||||
}
|
||||
BCDToInteger(time,7);
|
||||
}
|
||||
**/
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void VblankHandler(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
|
||||
u32 fifo;
|
||||
|
||||
if(!(REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)) {
|
||||
fifo = REG_IPC_FIFO_RX;
|
||||
|
||||
if(fifo == IPC_CMD_GBAMODE)
|
||||
gbaMode();
|
||||
if(fifo == IPC_CMD_SLOT2) {
|
||||
prepairReset();
|
||||
}
|
||||
if(fifo == IPC_CMD_TURNOFF) {
|
||||
PM_SetControl(1<<6);
|
||||
while(1);
|
||||
}
|
||||
|
||||
if(fifo == IPC_CMD_SR_R4TF)
|
||||
ret_menu7_R4();
|
||||
if(fifo == IPC_CMD_SR_DLMS)
|
||||
LinkReset_ARM7();
|
||||
if(fifo == IPC_CMD_SR_GEN)
|
||||
ret_menu7_Gen();
|
||||
if(fifo == IPC_CMD_SR_MSE)
|
||||
ret_menu7_mse();
|
||||
}
|
||||
|
||||
|
||||
u32 i;
|
||||
|
||||
//sound code :)
|
||||
TransferSound *snd = IPC->soundData;
|
||||
IPC->soundData = 0;
|
||||
|
||||
if (0 != snd) {
|
||||
|
||||
for (i=0; i<snd->count; i++) {
|
||||
s32 chan = getFreeSoundChannel();
|
||||
|
||||
if (chan >= 0) {
|
||||
startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8 ct[sizeof(IPC->time.curtime)];
|
||||
int t1, t2;
|
||||
|
||||
rtcGetTimeAndDate((uint8 *)ct);
|
||||
IPC->time.rtc.year = ct[0];
|
||||
IPC->time.rtc.month = ct[1];
|
||||
IPC->time.rtc.day = ct[2];
|
||||
IPC->time.rtc.weekday = ct[3];
|
||||
IPC->time.rtc.hours = (ct[4]<12) ? ct[4] : ct[4]+40;
|
||||
IPC->time.rtc.minutes = ct[5];
|
||||
IPC->time.rtc.seconds = ct[6];
|
||||
|
||||
IPC->temperature = touchReadTemperature(&t1, &t2);
|
||||
IPC->tdiode1 = t1;
|
||||
IPC->tdiode2 = t2;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int main(int argc, char ** argv) {
|
||||
//---------------------------------------------------------------------------------
|
||||
|
||||
// memset((void*)IPC, 0, sizeof(IPC));
|
||||
|
||||
// rtcReset();
|
||||
FIFOInit();
|
||||
|
||||
//enable sound
|
||||
powerON(POWER_SOUND);
|
||||
SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);
|
||||
IPC->soundData = 0;
|
||||
|
||||
irqInit();
|
||||
|
||||
// Start the RTC tracking IRQ
|
||||
initClockIRQ();
|
||||
|
||||
SetYtrigger(80);
|
||||
irqSet(IRQ_VBLANK, VblankHandler);
|
||||
irqSet(IRQ_VCOUNT, VcountHandler);
|
||||
|
||||
irqEnable(IRQ_VBLANK | IRQ_VCOUNT);
|
||||
|
||||
while(1) {
|
||||
swiWaitForVBlank();
|
||||
}
|
||||
}
|
||||
|
163
arm7/source/ret_menu7_Gen.c
Normal file
163
arm7/source/ret_menu7_Gen.c
Normal file
@ -0,0 +1,163 @@
|
||||
/***********************************************************
|
||||
Arm7 Soft rest for General purpose
|
||||
|
||||
by Rudolph (<EFBFBD>c’é)
|
||||
***************************************************************/
|
||||
|
||||
#include <nds.h>
|
||||
//#include <nds/registers_alt.h> // devkitPror20
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define ARM7_PROG (0x03810000 - 0xA00)
|
||||
typedef void (* FN_MEDIUM_ARM7)(void);
|
||||
FN_MEDIUM_ARM7 _menu7_Gen;
|
||||
|
||||
extern void _menu7_Gen_s();
|
||||
|
||||
void ret_menu7_Gen()
|
||||
{
|
||||
u32 *adr;
|
||||
u32 *buf;
|
||||
u32 i;
|
||||
|
||||
while((*(vu32*)0x027FFDFC) != 0x027FFDF8) { // Timing adjustment with ARM9
|
||||
vu32 w;
|
||||
for(w=0;w<0x100;w++){
|
||||
}
|
||||
}
|
||||
|
||||
REG_IME = IME_DISABLE; // Disable interrupts
|
||||
REG_IF = REG_IF; // Acknowledge interrupt
|
||||
|
||||
// REG_IME = 0;
|
||||
|
||||
for (i = 0x04000400; i < 0x04000500; i+=4) {
|
||||
*((u32*)i) = 0;
|
||||
}
|
||||
SOUND_CR = 0;
|
||||
|
||||
for(i = 0x040000B0; i < (0x040000B0+0x30); i+=4) {
|
||||
*((vu32*)i) = 0;
|
||||
}
|
||||
for(i = 0x04000100; i < 0x04000110; i+=2) {
|
||||
*((u16*)i) = 0;
|
||||
}
|
||||
|
||||
//switch to user mode
|
||||
asm("mov r0, #0x1F");
|
||||
asm("msr cpsr, r0");
|
||||
|
||||
|
||||
adr = (u32*)ARM7_PROG;
|
||||
buf = (u32*)_menu7_Gen_s;
|
||||
for(i = 0; i < 0x200/4; i++) {
|
||||
*adr = *buf;
|
||||
adr++;
|
||||
buf++;
|
||||
}
|
||||
|
||||
_menu7_Gen = (FN_MEDIUM_ARM7)ARM7_PROG;
|
||||
_menu7_Gen();
|
||||
|
||||
while(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _menu7_Gen_s()
|
||||
{
|
||||
u32 *adr;
|
||||
u32 *bufh, *buf7, *buf9;
|
||||
u32 siz;
|
||||
u32 i;
|
||||
u32 *arm9s, *arm9e;
|
||||
u32 *arm7s, *arm7e;
|
||||
|
||||
|
||||
bufh = (u32*)(*(vu32*)0x027FFDF4);
|
||||
|
||||
adr = (u32*)0x027FFE00;
|
||||
for(i = 0; i < 512/4; i++) { // Header
|
||||
*adr = *bufh;
|
||||
adr++;
|
||||
bufh++;
|
||||
}
|
||||
|
||||
buf9 = bufh;
|
||||
buf7 = buf9 + ((*(vu32*)0x027FFE2C) / 4);
|
||||
|
||||
|
||||
adr = (u32*)(*(vu32*)0x027FFE38);
|
||||
siz = (*(vu32*)0x027FFE3C);
|
||||
for(i = 0; i < siz/4; i++) { // ARM7
|
||||
*adr = *buf7;
|
||||
adr++;
|
||||
buf7++;
|
||||
}
|
||||
arm7e = adr;
|
||||
|
||||
|
||||
adr = (u32*)(*(vu32*)0x027FFE28);
|
||||
siz = (*(vu32*)0x027FFE2C);
|
||||
if(adr < buf9) { // ARM9
|
||||
for(i = 0; i < siz/4; i++) {
|
||||
*adr = *buf9;
|
||||
adr++;
|
||||
buf9++;
|
||||
}
|
||||
arm9e = adr;
|
||||
} else {
|
||||
adr += (siz/4 - 1);
|
||||
buf9 += (siz/4 - 1);
|
||||
arm9e = adr + 1;
|
||||
for(i = 0; i < siz/4; i++) {
|
||||
*adr = *buf9;
|
||||
adr--;
|
||||
buf9--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
arm7s = (u32*)(*(vu32*)0x027FFE38);
|
||||
if(arm7s > (u32*)0x023FF800)
|
||||
arm7s = (u32*)0x023FF800;
|
||||
arm9s = (u32*)(*(vu32*)0x027FFE28);
|
||||
if(arm9s > arm7s) {
|
||||
adr = arm9s;
|
||||
arm9s = arm7s;
|
||||
arm7s = adr;
|
||||
adr = arm9e;
|
||||
arm9e = arm7e;
|
||||
arm7e = adr;
|
||||
}
|
||||
|
||||
adr = (u32*)0x02000000;
|
||||
while(adr < arm9s) {
|
||||
*adr = 0x00000000;
|
||||
adr++;
|
||||
}
|
||||
|
||||
while(arm9e < arm7s) {
|
||||
*arm9e = 0x00000000;
|
||||
arm9e++;
|
||||
}
|
||||
|
||||
while(arm7e < (u32*)0x023FF800) {
|
||||
*arm7e = 0x00000000;
|
||||
arm7e++;
|
||||
}
|
||||
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
(*(vu32*)(0x04000000-4)) = 0; //IRQ_HANDLER ARM7 version
|
||||
(*(vu32*)(0x04000000-8)) = ~0; //VBLANK_INTR_WAIT_FLAGS, ARM7 version
|
||||
REG_POWERCNT = 1; //turn off power to stuffs
|
||||
|
||||
*(vu32*)0x027FFDFC = *(vu32*)0x027FFE24;
|
||||
asm("swi 0x00"); // JUMP 0x027FFE34
|
||||
|
||||
while(1);
|
||||
// swiSoftReset();
|
||||
}
|
156
arm7/source/ret_menu7_R4.c
Normal file
156
arm7/source/ret_menu7_R4.c
Normal file
@ -0,0 +1,156 @@
|
||||
/***********************************************************
|
||||
|
||||
by Rudolph (<EFBFBD>c’é)
|
||||
2007/05/24 First release
|
||||
2007/05/27 Timing adjustment with ARM9
|
||||
|
||||
------------------------------------------------------------
|
||||
SoftwareReset Routines for R4DS or M3SimplyDS.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
Only the Homebrew application can be used.
|
||||
It is not possible to use it by a business purpose.
|
||||
|
||||
This software is made based on information obtained
|
||||
by Reverse engineering.
|
||||
|
||||
Please use that at once when a source code that is
|
||||
more formal than the official is open to the public.
|
||||
***************************************************************/
|
||||
|
||||
#include <nds.h>
|
||||
//#include <nds/registers_alt.h> // devkitPror20
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static int _set_r4menu()
|
||||
{
|
||||
u32 add;
|
||||
|
||||
add = (*(vu32*)0x027FFE18);
|
||||
|
||||
while(CARD_CR2 & CARD_BUSY);
|
||||
|
||||
CARD_CR1H = 0xC0;
|
||||
CARD_COMMAND[0] = 0xB4;
|
||||
CARD_COMMAND[1] = (add >> 24) & 0xFF;
|
||||
CARD_COMMAND[2] = (add >> 16) & 0xFF;
|
||||
CARD_COMMAND[3] = (add >> 8) & 0xFF;
|
||||
CARD_COMMAND[4] = add & 0xFF;
|
||||
// CARD_COMMAND[5] = 0x00;
|
||||
// CARD_COMMAND[6] = 0x00;
|
||||
// CARD_COMMAND[7] = 0x00;
|
||||
|
||||
CARD_CR2 = 0xA7586000;
|
||||
while(!(CARD_CR2 & CARD_DATA_READY));
|
||||
|
||||
return(CARD_DATA_RD);
|
||||
}
|
||||
|
||||
|
||||
static int _read_r4menu(char *buf, u32 blk)
|
||||
{
|
||||
int s = 0;
|
||||
u32 *buf32;
|
||||
|
||||
buf32 = (u32*)buf;
|
||||
blk *= 2;
|
||||
do {
|
||||
while(CARD_CR2 & CARD_BUSY);
|
||||
CARD_CR1H = 0xC0;
|
||||
CARD_COMMAND[0] = 0xB6;
|
||||
CARD_COMMAND[1] = (blk >> 16) & 0xFF;
|
||||
CARD_COMMAND[2] = (blk >> 8) & 0xFF;
|
||||
CARD_COMMAND[3] = blk & 0xFF;
|
||||
CARD_COMMAND[4] = 0x00;
|
||||
// CARD_COMMAND[5] = 0x00;
|
||||
// CARD_COMMAND[6] = 0x00;
|
||||
// CARD_COMMAND[7] = 0x00;
|
||||
CARD_CR2 = 0xA7586000;
|
||||
while(!(CARD_CR2 & CARD_DATA_READY));
|
||||
} while(CARD_DATA_RD);
|
||||
|
||||
while(CARD_CR2 & CARD_BUSY);
|
||||
CARD_CR1H = 0xC0;
|
||||
CARD_COMMAND[0] = 0xBF;
|
||||
CARD_COMMAND[1] = (blk >> 16) & 0xFF;
|
||||
CARD_COMMAND[2] = (blk >> 8) & 0xFF;
|
||||
CARD_COMMAND[3] = blk & 0xFF;
|
||||
CARD_COMMAND[4] = 0x00;
|
||||
// CARD_COMMAND[5] = 0x00;
|
||||
// CARD_COMMAND[6] = 0x00;
|
||||
// CARD_COMMAND[7] = 0x00;
|
||||
CARD_CR2 = 0xA1586000;
|
||||
|
||||
do {
|
||||
while(!(CARD_CR2 & CARD_DATA_READY));
|
||||
*buf32 = CARD_DATA_RD;
|
||||
buf32++;
|
||||
s += 4;
|
||||
} while(CARD_CR2 & CARD_BUSY);
|
||||
|
||||
return(s);
|
||||
}
|
||||
|
||||
|
||||
void ret_menu7_R4()
|
||||
{
|
||||
char *adr;
|
||||
u32 blk, siz;
|
||||
u32 i;
|
||||
u32 *mem;
|
||||
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_IF = REG_IF;
|
||||
|
||||
REG_IPC_SYNC = 0;
|
||||
DMA0_CR = 0;
|
||||
DMA1_CR = 0;
|
||||
DMA2_CR = 0;
|
||||
DMA3_CR = 0;
|
||||
|
||||
while((*(vu32*)0x027FFDFC) != 0x027FFDF8); // Timing adjustment with ARM9
|
||||
|
||||
mem = (u32*)0x02000000;
|
||||
for(i = 0; i < 0x3FF800/4; i++) {
|
||||
*mem = 0x00000000;
|
||||
mem++;
|
||||
}
|
||||
// memset((u8*)0x2000000, 0x00, 0x3FF800);
|
||||
|
||||
while(_set_r4menu());
|
||||
|
||||
adr = (char*)0x027FFE00;
|
||||
_read_r4menu(adr, 0); // Header
|
||||
|
||||
|
||||
blk = (*(vu32*)0x027FFE20) / 512;
|
||||
adr = (char*)(*(vu32*)0x027FFE28);
|
||||
siz = (*(vu32*)0x027FFE2C);
|
||||
for(i = 0; i < siz; i += 512) { // ARM9
|
||||
_read_r4menu(adr, blk);
|
||||
blk++;
|
||||
adr += 512;
|
||||
}
|
||||
|
||||
blk = (*(vu32*)0x027FFE30) / 512;
|
||||
adr = (char*)(*(vu32*)0x027FFE38);
|
||||
siz = (*(vu32*)0x027FFE3C);
|
||||
for(i = 0; i < siz; i += 512) { // ARM7
|
||||
_read_r4menu(adr, blk);
|
||||
blk++;
|
||||
adr += 512;
|
||||
}
|
||||
|
||||
*(vu32*)0x027FFDFC = *(vu32*)0x027FFE24;
|
||||
asm("swi 0x00"); // JUMP 0x027FFE34
|
||||
|
||||
while(1);
|
||||
|
||||
}
|
58
arm7/source/ret_menu7_mse.c
Normal file
58
arm7/source/ret_menu7_mse.c
Normal file
@ -0,0 +1,58 @@
|
||||
/***********************************************************
|
||||
Arm7 Soft rest for reset.mse
|
||||
|
||||
by Rudolph (<EFBFBD>c’é)
|
||||
***************************************************************/
|
||||
|
||||
#include <nds.h>
|
||||
//#include <nds/registers_alt.h> // devkitPror20
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void ret_menu7_mse()
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
||||
|
||||
while(*((vu32*)0x027FFDFC) != 0x06000000) { // Timing adjustment with ARM9
|
||||
vu32 w;
|
||||
for(w=0;w<0x100;w++){
|
||||
}
|
||||
}
|
||||
|
||||
REG_IME = IME_DISABLE; // Disable interrupts
|
||||
REG_IF = REG_IF; // Acknowledge interrupt
|
||||
|
||||
|
||||
for (i = 0x04000400; i < 0x04000500; i+=4) {
|
||||
*((u32*)i) = 0;
|
||||
}
|
||||
SOUND_CR = 0;
|
||||
|
||||
for(i = 0x040000B0; i < (0x040000B0+0x30); i+=4) {
|
||||
*((vu32*)i) = 0;
|
||||
}
|
||||
for(i = 0x04000100; i < 0x04000110; i+=2) {
|
||||
*((u16*)i) = 0;
|
||||
}
|
||||
|
||||
//switch to user mode
|
||||
asm("mov r0, #0x1F");
|
||||
asm("msr cpsr, r0");
|
||||
|
||||
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
(*(vu32*)(0x04000000-4)) = 0; //IRQ_HANDLER ARM7 version
|
||||
(*(vu32*)(0x04000000-8)) = ~0; //VBLANK_INTR_WAIT_FLAGS, ARM7 version
|
||||
REG_POWERCNT = 1; //turn off power to stuffs
|
||||
|
||||
*((vu32*)0x027FFE34) = *((vu32*)0x027FFDFC); // Bootloader start address
|
||||
// asm("swi 0x00"); // JUMP 0x027FFE34
|
||||
swiSoftReset();
|
||||
while(1);
|
||||
}
|
||||
|
140
arm9/Makefile
Normal file
140
arm9/Makefile
Normal file
@ -0,0 +1,140 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := source data \
|
||||
source/tarosa
|
||||
|
||||
INCLUDES := include build source/tarosa source/libfat
|
||||
|
||||
DATA := data
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
#
|
||||
|
||||
# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
|
||||
# *insists* it has a FPU or VFP, and it won't take no for an answer!
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
#--ansi
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,../arm9.map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lfat -lnds9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(LIBIORPG) $(LIBFAT)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export ARM9BIN := $(CURDIR)/arm9.bin
|
||||
export ARM9ELF := $(CURDIR)/arm9.elf
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf *.nds* *.bin
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(ARM9BIN) : $(ARM9ELF)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
$(ARM9ELF) : $(OFILES)
|
||||
@echo linking $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
2528
arm9/arm9.map
Normal file
2528
arm9/arm9.map
Normal file
File diff suppressed because it is too large
Load Diff
68
arm9/include/dsCard.h
Normal file
68
arm9/include/dsCard.h
Normal file
@ -0,0 +1,68 @@
|
||||
/**************************************************************************************************************
|
||||
* 此文件为 dsCard.h 文件的第二版
|
||||
* 日期:2006年11月27日11点33分 第一版 version 1.0
|
||||
* 作者:aladdin
|
||||
* CopyRight : EZFlash Group
|
||||
*
|
||||
**************************************************************************************************************/
|
||||
|
||||
#ifndef NDS_DSCARD_V2_INCLUDE
|
||||
#define NDS_DSCARD_V2_INCLUDE
|
||||
|
||||
#include "nds.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
#ifndef WORD
|
||||
typedef unsigned short WORD;
|
||||
#endif
|
||||
|
||||
#ifndef DWORD
|
||||
typedef unsigned long DWORD;
|
||||
#endif
|
||||
|
||||
#ifndef BOOL
|
||||
typedef bool BOOL ;
|
||||
#endif
|
||||
// export interface
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
//DS 卡 基本操作
|
||||
//Arm9 方面基本操作容许ARM7访问slot1
|
||||
void Enable_Arm7DS(void);
|
||||
|
||||
//Arm9 方面基本操作容许ARM9访问slot1
|
||||
void Enable_Arm9DS(void);
|
||||
|
||||
|
||||
//下面是访问震动卡的函数
|
||||
#define FlashBase 0x08000000
|
||||
#define _Ez5PsRAM 0x08000000
|
||||
void OpenNorWrite();
|
||||
void CloseNorWrite();
|
||||
void SetRompage(u16 page);
|
||||
void SetRampage(u16 page);
|
||||
void OpenRamWrite();
|
||||
void CloseRamWrite();
|
||||
void SetSerialMode();
|
||||
uint32 ReadNorFlashID();
|
||||
void chip_reset();
|
||||
void Block_Erase(u32 blockAdd);
|
||||
void ReadNorFlash(u8* pBuf,u32 address,u16 len);
|
||||
void WriteNorFlash(u32 address,u8 *buffer,u32 size);
|
||||
void WriteSram(uint32 address, u8* data , uint32 size );
|
||||
void ReadSram(uint32 address, u8* data , uint32 size );
|
||||
void SetShake(u16 data);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
BIN
arm9/logo32.bmp
Normal file
BIN
arm9/logo32.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 630 B |
130
arm9/source/GBA_ini.cpp
Normal file
130
arm9/source/GBA_ini.cpp
Normal file
@ -0,0 +1,130 @@
|
||||
#include <nds.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fat.h>
|
||||
#include <sys/iosupport.h>
|
||||
|
||||
#include "GBA_ini.h"
|
||||
|
||||
struct ini_file ini;
|
||||
|
||||
extern u8 *rwbuf;
|
||||
|
||||
void GBA_ini()
|
||||
{
|
||||
FILE *fini;
|
||||
int len, p, s;
|
||||
char key[20];
|
||||
|
||||
ini.multi = 1;
|
||||
strcpy(ini.save_dir, "/GBA_SAVE");
|
||||
strcpy(ini.sign_dir, "/GBA_SIGN");
|
||||
|
||||
|
||||
fini = fopen("/GBA_ExpLoader.ini", "rb");
|
||||
if(fini == NULL) {
|
||||
mkdir(ini.save_dir, 0777);
|
||||
mkdir(ini.sign_dir, 0777);
|
||||
return;
|
||||
}
|
||||
|
||||
len = fread(rwbuf, 1, 0x1000, fini);
|
||||
|
||||
p = 0;
|
||||
while(p < len) {
|
||||
if(rwbuf[p] == '#' || rwbuf[p] == '!') {
|
||||
while(p < len) {
|
||||
if(rwbuf[p] == 0x0A)
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
s = 0;
|
||||
while(rwbuf[p] >= 0x20 && rwbuf[p] < 0x7F) {
|
||||
key[s] = rwbuf[p];
|
||||
s++;
|
||||
p++;
|
||||
}
|
||||
key[s] = 0;
|
||||
|
||||
if(strcmp(key, "SaveDir") == 0) {
|
||||
s = 0;
|
||||
while(p < len) {
|
||||
if(rwbuf[p] == 0x20 || rwbuf[p] == '\t')
|
||||
p++;
|
||||
else break;
|
||||
}
|
||||
if(rwbuf[p] == 0x22) {
|
||||
p++;
|
||||
while((p < len) && (rwbuf[p] != 0x22)) {
|
||||
if(s < 63)
|
||||
ini.save_dir[s] = rwbuf[p];
|
||||
s++;
|
||||
p++;
|
||||
}
|
||||
} else {
|
||||
while(p < len) {
|
||||
if(rwbuf[p] <= 0x20 || rwbuf[p] >= 0x7F)
|
||||
break;
|
||||
if(s < 63)
|
||||
ini.save_dir[s] = rwbuf[p];
|
||||
s++;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
ini.save_dir[s] = 0;
|
||||
}
|
||||
|
||||
if(strcmp(key, "SignDir") == 0) {
|
||||
s = 0;
|
||||
while(p < len) {
|
||||
if(rwbuf[p] == 0x20 || rwbuf[p] == '\t')
|
||||
p++;
|
||||
else break;
|
||||
}
|
||||
if(rwbuf[p] == 0x22) {
|
||||
p++;
|
||||
while((p < len) && (rwbuf[p] != 0x22)) {
|
||||
if(s < 63)
|
||||
ini.sign_dir[s] = rwbuf[p];
|
||||
s++;
|
||||
p++;
|
||||
}
|
||||
} else {
|
||||
while(p < len) {
|
||||
if(rwbuf[p] <= 0x20 || rwbuf[p] >= 0x7F)
|
||||
break;
|
||||
if(s < 63)
|
||||
ini.sign_dir[s] = rwbuf[p];
|
||||
s++;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
ini.sign_dir[s] = 0;
|
||||
}
|
||||
if(strcmp(key, "No_MultiSave") == 0) {
|
||||
ini.multi = 0;
|
||||
}
|
||||
|
||||
while(p < len) {
|
||||
p++;
|
||||
if(rwbuf[p - 1] == 0x0A)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fini);
|
||||
|
||||
if(ini.save_dir[0] != '/')
|
||||
strcpy(ini.save_dir, "/GBA_SAVE");
|
||||
if(ini.sign_dir[0] != '/')
|
||||
strcpy(ini.sign_dir, "/GBA_SIGN");
|
||||
|
||||
mkdir(ini.save_dir, 0777);
|
||||
mkdir(ini.sign_dir, 0777);
|
||||
}
|
||||
|
19
arm9/source/GBA_ini.h
Normal file
19
arm9/source/GBA_ini.h
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
struct ini_file {
|
||||
char save_dir[64];
|
||||
char sign_dir[64];
|
||||
u32 multi;
|
||||
};
|
||||
|
||||
extern struct ini_file ini;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void GBA_ini();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
118
arm9/source/cache.h
Normal file
118
arm9/source/cache.h
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
cache.h
|
||||
The cache is not visible to the user. It should be flushed
|
||||
when any file is closed or changes are made to the filesystem.
|
||||
|
||||
This cache implements a least-used-page replacement policy. This will
|
||||
distribute sectors evenly over the pages, so if less than the maximum
|
||||
pages are used at once, they should all eventually remain in the cache.
|
||||
This also has the benefit of throwing out old sectors, so as not to keep
|
||||
too many stale pages around.
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
*/
|
||||
|
||||
#ifndef _CACHE_H
|
||||
#define _CACHE_H
|
||||
|
||||
#include "common.h"
|
||||
#include "disc_io/disc_io.h"
|
||||
|
||||
#define CACHE_PAGE_SIZE BYTES_PER_READ
|
||||
|
||||
typedef struct {
|
||||
u32 sector;
|
||||
u32 count;
|
||||
bool dirty;
|
||||
} CACHE_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
const IO_INTERFACE* disc;
|
||||
u32 numberOfPages;
|
||||
CACHE_ENTRY* cacheEntries;
|
||||
u8* pages;
|
||||
} CACHE;
|
||||
|
||||
|
||||
/*
|
||||
Read data from a sector in the cache
|
||||
If the sector is not in the cache, it will be swapped in
|
||||
offset is the position to start reading from
|
||||
size is the amount of data to read
|
||||
Precondition: offset + size <= BYTES_PER_READ
|
||||
*/
|
||||
bool _FAT_cache_readPartialSector (CACHE* cache, void* buffer, u32 sector, u32 offset, u32 size);
|
||||
|
||||
/*
|
||||
Write data to a sector in the cache
|
||||
If the sector is not in the cache, it will be swapped in.
|
||||
When the sector is swapped out, the data will be written to the disc
|
||||
offset is the position to start reading from
|
||||
size is the amount of data to read
|
||||
Precondition: offset + size <= BYTES_PER_READ
|
||||
*/
|
||||
bool _FAT_cache_writePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
|
||||
|
||||
/*
|
||||
Write data to a sector in the cache, zeroing the sector first
|
||||
If the sector is not in the cache, it will be swapped in.
|
||||
When the sector is swapped out, the data will be written to the disc
|
||||
offset is the position to start reading from
|
||||
size is the amount of data to read
|
||||
Precondition: offset + size <= BYTES_PER_READ
|
||||
*/
|
||||
bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
|
||||
|
||||
/*
|
||||
Read a full sector from the cache
|
||||
*/
|
||||
static inline bool _FAT_cache_readSector (CACHE* cache, void* buffer, u32 sector) {
|
||||
return _FAT_cache_readPartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
|
||||
}
|
||||
|
||||
/*
|
||||
Write a full sector to the cache
|
||||
*/
|
||||
static inline bool _FAT_cache_writeSector (CACHE* cache, const void* buffer, u32 sector) {
|
||||
return _FAT_cache_writePartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
|
||||
}
|
||||
|
||||
/*
|
||||
Write any dirty sectors back to disc and clear out the contents of the cache
|
||||
*/
|
||||
bool _FAT_cache_flush (CACHE* cache);
|
||||
|
||||
/*
|
||||
Clear out the contents of the cache without writing any dirty sectors first
|
||||
*/
|
||||
void _FAT_cache_invalidate (CACHE* cache);
|
||||
|
||||
CACHE* _FAT_cache_constructor (u32 numberOfPages, const IO_INTERFACE* discInterface);
|
||||
|
||||
void _FAT_cache_destructor (CACHE* cache);
|
||||
|
||||
#endif // _CACHE_H
|
54
arm9/source/common.h
Normal file
54
arm9/source/common.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
common.h
|
||||
Common definitions and included files for the FATlib
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
*/
|
||||
|
||||
#ifndef _COMMON_H
|
||||
#define _COMMON_H
|
||||
|
||||
// When compiling for NDS, make sure NDS is defined
|
||||
#ifndef NDS
|
||||
#if defined ARM9 || defined ARM7
|
||||
#define NDS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NDS
|
||||
#include <nds/jtypes.h>
|
||||
#else
|
||||
#include "gba_types.h"
|
||||
#endif
|
||||
|
||||
#define BYTES_PER_READ 512
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#endif // _COMMON_H
|
74
arm9/source/ctrl_tbl.cpp
Normal file
74
arm9/source/ctrl_tbl.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
#include <nds.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fat.h>
|
||||
#include <sys/iosupport.h>
|
||||
|
||||
#include "dsCard.h"
|
||||
#include "GBA_ini.h"
|
||||
#include "ctrl_tbl.h"
|
||||
|
||||
struct ctrl_tbl ctrl;
|
||||
|
||||
#define SRAM_ADDR 0x0A000000
|
||||
|
||||
|
||||
extern int carttype;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void _RamPG(void);
|
||||
extern void _RamSave(int bnk);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ctrl_get()
|
||||
{
|
||||
FILE *exp;
|
||||
char expfile[64];
|
||||
|
||||
memset((u8*)&ctrl, 0, sizeof(struct ctrl_tbl));
|
||||
|
||||
if(carttype != 5) {
|
||||
_RamPG();
|
||||
ReadSram(SRAM_ADDR, (u8*)&ctrl, sizeof(struct ctrl_tbl));
|
||||
_RamSave(0);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(expfile, "%s/EXP128K.dat", ini.sign_dir);
|
||||
exp = fopen(expfile, "rb");
|
||||
if(exp != NULL) {
|
||||
fread(&ctrl, 1, sizeof(struct ctrl_tbl), exp);
|
||||
fclose(exp);
|
||||
}
|
||||
}
|
||||
|
||||
void ctrl_set()
|
||||
{
|
||||
FILE *exp;
|
||||
char expfile[64];
|
||||
|
||||
|
||||
if(carttype != 5) {
|
||||
_RamPG();
|
||||
WriteSram(SRAM_ADDR, (u8*)&ctrl, sizeof(struct ctrl_tbl));
|
||||
_RamSave(0);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(expfile, "%s/EXP128K.dat", ini.sign_dir);
|
||||
exp = fopen(expfile, "wb");
|
||||
if(exp != NULL) {
|
||||
fwrite(&ctrl, 1, sizeof(struct ctrl_tbl), exp);
|
||||
fclose(exp);
|
||||
}
|
||||
}
|
||||
|
26
arm9/source/ctrl_tbl.h
Normal file
26
arm9/source/ctrl_tbl.h
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
struct ctrl_tbl {
|
||||
u8 sign[128];
|
||||
u16 mode;
|
||||
u8 save_flg[2];
|
||||
u32 save_siz[2];
|
||||
|
||||
char filer[116];
|
||||
|
||||
u8 sav_nam[2][512];
|
||||
u8 path[256];
|
||||
};
|
||||
|
||||
extern struct ctrl_tbl ctrl;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void ctrl_get();
|
||||
extern void ctrl_set();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
171
arm9/source/directory.h
Normal file
171
arm9/source/directory.h
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
directory.h
|
||||
Reading, writing and manipulation of the directory structure on
|
||||
a FAT partition
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
*/
|
||||
|
||||
#ifndef _DIRECTORY_H
|
||||
#define _DIRECTORY_H
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "partition.h"
|
||||
|
||||
#define DIR_ENTRY_DATA_SIZE 0x20
|
||||
#define MAX_FILENAME_LENGTH 256
|
||||
#define MAX_ALIAS_LENGTH 13
|
||||
#define LFN_ENTRY_LENGTH 13
|
||||
#define FAT16_ROOT_DIR_CLUSTER 0
|
||||
|
||||
#define DIR_SEPARATOR '/'
|
||||
|
||||
// File attributes
|
||||
#define ATTRIB_ARCH 0x20 // Archive
|
||||
#define ATTRIB_DIR 0x10 // Directory
|
||||
#define ATTRIB_LFN 0x0F // Long file name
|
||||
#define ATTRIB_VOL 0x08 // Volume
|
||||
#define ATTRIB_SYS 0x04 // System
|
||||
#define ATTRIB_HID 0x02 // Hidden
|
||||
#define ATTRIB_RO 0x01 // Read only
|
||||
|
||||
typedef enum {FT_DIRECTORY, FT_FILE} FILE_TYPE;
|
||||
|
||||
typedef struct {
|
||||
u32 cluster;
|
||||
u32 sector;
|
||||
s32 offset;
|
||||
} DIR_ENTRY_POSITION;
|
||||
|
||||
typedef struct {
|
||||
u8 entryData[DIR_ENTRY_DATA_SIZE];
|
||||
DIR_ENTRY_POSITION dataStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
|
||||
DIR_ENTRY_POSITION dataEnd; // Always points to the file/directory's alias entry
|
||||
char filename[MAX_FILENAME_LENGTH];
|
||||
} DIR_ENTRY;
|
||||
|
||||
// Directory entry offsets
|
||||
enum DIR_ENTRY_offset {
|
||||
DIR_ENTRY_name = 0x00,
|
||||
DIR_ENTRY_extension = 0x08,
|
||||
DIR_ENTRY_attributes = 0x0B,
|
||||
DIR_ENTRY_reserved = 0x0C,
|
||||
DIR_ENTRY_cTime_ms = 0x0D,
|
||||
DIR_ENTRY_cTime = 0x0E,
|
||||
DIR_ENTRY_cDate = 0x10,
|
||||
DIR_ENTRY_aDate = 0x12,
|
||||
DIR_ENTRY_clusterHigh = 0x14,
|
||||
DIR_ENTRY_mTime = 0x16,
|
||||
DIR_ENTRY_mDate = 0x18,
|
||||
DIR_ENTRY_cluster = 0x1A,
|
||||
DIR_ENTRY_fileSize = 0x1C
|
||||
};
|
||||
|
||||
/*
|
||||
Returns true if the file specified by entry is a directory
|
||||
*/
|
||||
static inline bool _FAT_directory_isDirectory (DIR_ENTRY* entry) {
|
||||
return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) != 0);
|
||||
}
|
||||
|
||||
static inline bool _FAT_directory_isWritable (DIR_ENTRY* entry) {
|
||||
return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_RO) == 0);
|
||||
}
|
||||
|
||||
static inline bool _FAT_directory_isDot (DIR_ENTRY* entry) {
|
||||
return ((entry->filename[0] == '.') && ((entry->filename[1] == '\0') ||
|
||||
((entry->filename[1] == '.') && entry->filename[2] == '\0')));
|
||||
}
|
||||
|
||||
/*
|
||||
Reads the first directory entry from the directory starting at dirCluster
|
||||
Places result in entry
|
||||
entry will be destroyed even if no directory entry is found
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_getFirstEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
|
||||
|
||||
/*
|
||||
Reads the next directory entry after the one already pointed to by entry
|
||||
Places result in entry
|
||||
entry will be destroyed even if no directory entry is found
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_getNextEntry (PARTITION* partition, DIR_ENTRY* entry);
|
||||
|
||||
/*
|
||||
Gets the directory entry corrsponding to the supplied path
|
||||
entry will be destroyed even if no directory entry is found
|
||||
pathEnd specifies the end of the path string, for cutting strings short if needed
|
||||
specify NULL to use the full length of path
|
||||
pathEnd is only a suggestion, and the path string will be searched up until the next PATH_SEPARATOR
|
||||
after pathEND.
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const char* path, const char* pathEnd);
|
||||
|
||||
/*
|
||||
Changes the current directory to the one specified by path
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_chdir (PARTITION* partition, const char* path);
|
||||
|
||||
/*
|
||||
Removes the directory entry specified by entry
|
||||
Assumes that entry is valid
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_removeEntry (PARTITION* partition, DIR_ENTRY* entry);
|
||||
|
||||
/*
|
||||
Add a directory entry to the directory specified by dirCluster
|
||||
The fileData, dataStart and dataEnd elements of the DIR_ENTRY struct are
|
||||
updated with the new directory entry position and alias.
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_addEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
|
||||
|
||||
/*
|
||||
Get the start cluster of a file from it's entry data
|
||||
*/
|
||||
u32 _FAT_directory_entryGetCluster (const u8* entryData);
|
||||
|
||||
/*
|
||||
Fill in the file name and entry data of DIR_ENTRY* entry.
|
||||
Assumes that the entry's dataStart and dataEnd are correct
|
||||
Returns true on success, false on failure
|
||||
*/
|
||||
bool _FAT_directory_entryFromPosition (PARTITION* partition, DIR_ENTRY* entry);
|
||||
|
||||
/*
|
||||
Fill in a stat struct based on a file entry
|
||||
*/
|
||||
void _FAT_directory_entryStat (PARTITION* partition, DIR_ENTRY* entry, struct stat *st);
|
||||
|
||||
#endif // _DIRECTORY_H
|
126
arm9/source/disc_io/disc.h
Normal file
126
arm9/source/disc_io/disc.h
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
disc.h
|
||||
Interface to the low level disc functions. Used by the higher level
|
||||
file system code.
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
|
||||
*/
|
||||
#ifndef _DISC_H
|
||||
#define _DISC_H
|
||||
|
||||
#include "../common.h"
|
||||
#include "disc_io.h"
|
||||
|
||||
/*
|
||||
Search for a block based device in the GBA slot.
|
||||
Return a pointer to a usable interface if one is found,
|
||||
NULL if not.
|
||||
*/
|
||||
extern const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void);
|
||||
|
||||
/*
|
||||
Search for a block based device in the DS slot.
|
||||
Return a pointer to a usable interface if one is found,
|
||||
NULL if not.
|
||||
*/
|
||||
#ifdef NDS
|
||||
extern const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
Search for a block based device in the both slots.
|
||||
Return a pointer to a usable interface if one is found,
|
||||
NULL if not.
|
||||
*/
|
||||
extern const IO_INTERFACE* _FAT_disc_findInterface (void);
|
||||
|
||||
/*
|
||||
Check if a disc is inserted
|
||||
Return true if a disc is inserted and ready, false otherwise
|
||||
*/
|
||||
static inline bool _FAT_disc_isInserted (const IO_INTERFACE* disc) {
|
||||
return disc->fn_isInserted();
|
||||
}
|
||||
|
||||
/*
|
||||
Read numSectors sectors from a disc, starting at sector.
|
||||
numSectors is between 1 and 256
|
||||
sector is from 0 to 2^28
|
||||
buffer is a pointer to the memory to fill
|
||||
*/
|
||||
static inline bool _FAT_disc_readSectors (const IO_INTERFACE* disc, u32 sector, u32 numSectors, void* buffer) {
|
||||
return disc->fn_readSectors (sector, numSectors, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
Write numSectors sectors to a disc, starting at sector.
|
||||
numSectors is between 1 and 256
|
||||
sector is from 0 to 2^28
|
||||
buffer is a pointer to the memory to read from
|
||||
*/
|
||||
static inline bool _FAT_disc_writeSectors (const IO_INTERFACE* disc, u32 sector, u32 numSectors, const void* buffer) {
|
||||
return disc->fn_writeSectors (sector, numSectors, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
Reset the card back to a ready state
|
||||
*/
|
||||
static inline bool _FAT_disc_clearStatus (const IO_INTERFACE* disc) {
|
||||
return disc->fn_clearStatus();
|
||||
}
|
||||
|
||||
/*
|
||||
Initialise the disc to a state ready for data reading or writing
|
||||
*/
|
||||
static inline bool _FAT_disc_startup (const IO_INTERFACE* disc) {
|
||||
return disc->fn_startup();
|
||||
}
|
||||
|
||||
/*
|
||||
Put the disc in a state ready for power down.
|
||||
Complete any pending writes and disable the disc if necessary
|
||||
*/
|
||||
static inline bool _FAT_disc_shutdown (const IO_INTERFACE* disc) {
|
||||
return disc->fn_shutdown();
|
||||
}
|
||||
|
||||
/*
|
||||
Return a 32 bit value unique to each type of interface
|
||||
*/
|
||||
static inline u32 _FAT_disc_hostType (const IO_INTERFACE* disc) {
|
||||
return disc->ioType;
|
||||
}
|
||||
|
||||
/*
|
||||
Return a 32 bit value that specifies the capabilities of the disc
|
||||
*/
|
||||
static inline u32 _FAT_disc_features (const IO_INTERFACE* disc) {
|
||||
return disc->features;
|
||||
}
|
||||
|
||||
#endif // _DISC_H
|
81
arm9/source/disc_io/disc_io.h
Normal file
81
arm9/source/disc_io/disc_io.h
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
disc_io.h
|
||||
Interface template for low level disc functions.
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
|
||||
2006-07-16 - Chishm
|
||||
* Renamed _CF_USE_DMA to _IO_USE_DMA
|
||||
* Renamed _CF_ALLOW_UNALIGNED to _IO_ALLOW_UNALIGNED
|
||||
*/
|
||||
|
||||
#ifndef _DISC_IO_H
|
||||
#define _DISC_IO_H
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Customisable features
|
||||
|
||||
// Use DMA to read the card, remove this line to use normal reads/writes
|
||||
// #define _IO_USE_DMA
|
||||
|
||||
// Allow buffers not alligned to 16 bits when reading files.
|
||||
// Note that this will slow down access speed, so only use if you have to.
|
||||
// It is also incompatible with DMA
|
||||
#define _IO_ALLOW_UNALIGNED
|
||||
|
||||
#if defined _IO_USE_DMA && defined _IO_ALLOW_UNALIGNED
|
||||
#error You can't use both DMA and unaligned memory
|
||||
#endif
|
||||
|
||||
#define FEATURE_MEDIUM_CANREAD 0x00000001
|
||||
#define FEATURE_MEDIUM_CANWRITE 0x00000002
|
||||
#define FEATURE_SLOT_GBA 0x00000010
|
||||
#define FEATURE_SLOT_NDS 0x00000020
|
||||
|
||||
typedef bool (* FN_MEDIUM_STARTUP)(void) ;
|
||||
typedef bool (* FN_MEDIUM_ISINSERTED)(void) ;
|
||||
typedef bool (* FN_MEDIUM_READSECTORS)(u32 sector, u32 numSectors, void* buffer) ;
|
||||
typedef bool (* FN_MEDIUM_WRITESECTORS)(u32 sector, u32 numSectors, const void* buffer) ;
|
||||
typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ;
|
||||
typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ;
|
||||
|
||||
struct IO_INTERFACE_STRUCT {
|
||||
unsigned long ioType ;
|
||||
unsigned long features ;
|
||||
FN_MEDIUM_STARTUP fn_startup ;
|
||||
FN_MEDIUM_ISINSERTED fn_isInserted ;
|
||||
FN_MEDIUM_READSECTORS fn_readSectors ;
|
||||
FN_MEDIUM_WRITESECTORS fn_writeSectors ;
|
||||
FN_MEDIUM_CLEARSTATUS fn_clearStatus ;
|
||||
FN_MEDIUM_SHUTDOWN fn_shutdown ;
|
||||
} ;
|
||||
|
||||
typedef struct IO_INTERFACE_STRUCT IO_INTERFACE ;
|
||||
|
||||
#endif // define _DISC_IO_H
|
44
arm9/source/disc_io/io_dldi.h
Normal file
44
arm9/source/disc_io/io_dldi.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
io_dldi.h
|
||||
|
||||
Reserved space for post-compilation adding of an extra driver
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-12-22 - Chishm
|
||||
* Original release
|
||||
*/
|
||||
|
||||
#ifndef IO_DLDI_H
|
||||
#define IO_DLDI_H
|
||||
|
||||
// 'DLDD'
|
||||
#define DEVICE_TYPE_DLDD 0x49444C44
|
||||
|
||||
#include "disc_io.h"
|
||||
|
||||
// export interface
|
||||
extern const IO_INTERFACE _io_dldi ;
|
||||
|
||||
#endif // define IO_DLDI_H
|
384
arm9/source/dsCard.cpp
Normal file
384
arm9/source/dsCard.cpp
Normal file
@ -0,0 +1,384 @@
|
||||
/**************************************************************************************************************
|
||||
* 此文件为 dsCard.cpp 文件的第二版
|
||||
* 日期:2006年11月27日11点33分 第一版 version 1.0
|
||||
* 作者:aladdin
|
||||
* CopyRight : EZFlash Group
|
||||
*
|
||||
**************************************************************************************************************/
|
||||
#include "dscard.h"
|
||||
#include "string.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static u32 ID = 0x227E2218;
|
||||
|
||||
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||||
//---------------------------------------------------
|
||||
//DS 卡 基本操作
|
||||
/************
|
||||
void Enable_Arm9DS()
|
||||
{
|
||||
WAIT_CR &= ~0x0800;
|
||||
}
|
||||
|
||||
void Enable_Arm7DS()
|
||||
{
|
||||
WAIT_CR |= 0x0800;
|
||||
}
|
||||
*************/
|
||||
void OpenNorWrite()
|
||||
{
|
||||
*(vuint16 *)0x9fe0000 = 0xd200;
|
||||
*(vuint16 *)0x8000000 = 0x1500;
|
||||
*(vuint16 *)0x8020000 = 0xd200;
|
||||
*(vuint16 *)0x8040000 = 0x1500;
|
||||
*(vuint16 *)0x9C40000 = 0x1500;
|
||||
*(vuint16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
|
||||
|
||||
void CloseNorWrite()
|
||||
{
|
||||
*(vuint16 *)0x9fe0000 = 0xd200;
|
||||
*(vuint16 *)0x8000000 = 0x1500;
|
||||
*(vuint16 *)0x8020000 = 0xd200;
|
||||
*(vuint16 *)0x8040000 = 0x1500;
|
||||
*(vuint16 *)0x9C40000 = 0xd200;
|
||||
*(vuint16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
|
||||
void SetRompage(u16 page)
|
||||
{
|
||||
*(vuint16 *)0x9fe0000 = 0xd200;
|
||||
*(vuint16 *)0x8000000 = 0x1500;
|
||||
*(vuint16 *)0x8020000 = 0xd200;
|
||||
*(vuint16 *)0x8040000 = 0x1500;
|
||||
*(vuint16 *)0x9880000 = page;
|
||||
*(vuint16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
void SetRampage(u16 page)
|
||||
{
|
||||
*(vu16 *)0x9fe0000 = 0xd200;
|
||||
*(vu16 *)0x8000000 = 0x1500;
|
||||
*(vu16 *)0x8020000 = 0xd200;
|
||||
*(vu16 *)0x8040000 = 0x1500;
|
||||
*(vu16 *)0x9c00000 = page;
|
||||
*(vu16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
void SetSerialMode()
|
||||
{
|
||||
|
||||
*(vu16 *)0x9fe0000 = 0xd200;
|
||||
*(vu16 *)0x8000000 = 0x1500;
|
||||
*(vu16 *)0x8020000 = 0xd200;
|
||||
*(vu16 *)0x8040000 = 0x1500;
|
||||
*(vu16 *)0x9A40000 = 0xe200;
|
||||
*(vu16 *)0x9fc0000 = 0x1500;
|
||||
|
||||
}
|
||||
uint32 ReadNorFlashID()
|
||||
{
|
||||
vuint16 id1,id2; //,id3,id4;
|
||||
ID=0;
|
||||
*((vuint16 *)(FlashBase+0x555*2)) = 0xAA ;
|
||||
*((vuint16 *)(FlashBase+0x2AA*2)) = 0x55 ;
|
||||
*((vuint16 *)(FlashBase+0x555*2)) = 0x90 ;
|
||||
|
||||
*((vuint16 *)(FlashBase+0x1555*2)) = 0xAA ;
|
||||
*((vuint16 *)(FlashBase+0x12AA*2)) = 0x55 ;
|
||||
*((vuint16 *)(FlashBase+0x1555*2)) = 0x90 ;
|
||||
|
||||
id1 = *((vuint16 *)(FlashBase+0x2)) ;
|
||||
id2 = *((vuint16 *)(FlashBase+0x2002)) ;
|
||||
if( (id1!=0x227E)|| (id2!=0x227E))
|
||||
return 0;
|
||||
|
||||
id1 = *((vuint16 *)(FlashBase+0xE*2)) ;
|
||||
id2 = *((vuint16 *)(FlashBase+0x100e*2)) ;
|
||||
if(id1==0x2218 && id2==0x2218) //H6H6
|
||||
{
|
||||
ID = 0x227E2218;
|
||||
return 0x227E2218;
|
||||
}
|
||||
|
||||
if(id1==0x2202 && id2==0x2202) //VZ064
|
||||
{
|
||||
ID = 0x227E2202;
|
||||
return 0x227E2202;
|
||||
}
|
||||
if(id1==0x2202 && id2==0x2220) //VZ064
|
||||
{
|
||||
ID = 0x227E2202;
|
||||
return 0x227E2202;
|
||||
}
|
||||
if(id1==0x2202 && id2==0x2215) //VZ064
|
||||
{
|
||||
ID = 0x227E2202;
|
||||
return 0x227E2202;
|
||||
}
|
||||
return 0x227E2220;
|
||||
}
|
||||
void chip_reset()
|
||||
{
|
||||
*((vu16 *)(FlashBase)) = 0xF0 ;
|
||||
*((vu16 *)(FlashBase+0x1000*2)) = 0xF0 ;
|
||||
|
||||
if(ID==0x227E2202)
|
||||
{
|
||||
*((vu16 *)(FlashBase+0x1000000)) = 0xF0 ;
|
||||
*((vu16 *)(FlashBase+0x1000000+0x1000*2)) = 0xF0 ;
|
||||
}
|
||||
}
|
||||
|
||||
void Block_Erase(u32 blockAdd)
|
||||
{
|
||||
vu16 page,v1,v2;
|
||||
u32 Address;
|
||||
u32 loop;
|
||||
u32 off=0;
|
||||
if( (blockAdd>=0x1000000) && (ID==0x227E2202))
|
||||
{
|
||||
off=0x1000000;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xF0 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xF0 ;
|
||||
}
|
||||
else
|
||||
off=0;
|
||||
Address=blockAdd;
|
||||
*((vu16 *)(FlashBase+0x555*2)) = 0xF0 ;
|
||||
*((vu16 *)(FlashBase+0x1555*2)) = 0xF0 ;
|
||||
|
||||
|
||||
if( (blockAdd==0) || (blockAdd==0x1FC0000) || (blockAdd==0xFC0000) || (blockAdd==0x1000000))
|
||||
{
|
||||
for(loop=0;loop<0x40000;loop+=0x8000)
|
||||
{
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+Address+loop)) = 0x30 ;
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+Address+loop+0x2000)) = 0x30 ;
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x2555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x22AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x2555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x2555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x22AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+Address+loop+0x4000)) = 0x30 ;
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x3555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x32AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x3555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x3555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x32AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+Address+loop+0x6000)) = 0x30 ;
|
||||
do
|
||||
{
|
||||
|
||||
v1 = *((vu16 *)(FlashBase+Address+loop)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+loop)) ;
|
||||
}while(v1!=v2);
|
||||
do
|
||||
{
|
||||
|
||||
v1 = *((vu16 *)(FlashBase+Address+loop+0x2000)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+loop+0x2000)) ;
|
||||
}while(v1!=v2);
|
||||
do
|
||||
{
|
||||
|
||||
v1 = *((vu16 *)(FlashBase+Address+loop+0x4000)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+loop+0x4000)) ;
|
||||
}while(v1!=v2);
|
||||
do
|
||||
{
|
||||
|
||||
v1 = *((vu16 *)(FlashBase+Address+loop+0x6000)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+loop+0x6000)) ;
|
||||
}while(v1!=v2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55;
|
||||
*((vu16 *)(FlashBase+Address)) = 0x30 ;
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+Address+0x2000)) = 0x30 ;
|
||||
|
||||
do
|
||||
{
|
||||
v1 = *((vu16 *)(FlashBase+Address)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address)) ;
|
||||
}while(v1!=v2);
|
||||
do
|
||||
{
|
||||
v1 = *((vu16 *)(FlashBase+Address+0x2000)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+0x2000)) ;
|
||||
}while(v1!=v2);
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55;
|
||||
*((vu16 *)(FlashBase+Address+0x20000)) = 0x30 ;
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0x80 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+Address+0x2000+0x20000)) = 0x30 ;
|
||||
|
||||
do
|
||||
{
|
||||
v1 = *((vu16 *)(FlashBase+Address+0x20000)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+0x20000)) ;
|
||||
}while(v1!=v2);
|
||||
do
|
||||
{
|
||||
v1 = *((vu16 *)(FlashBase+Address+0x2000+0x20000)) ;
|
||||
v2 = *((vu16 *)(FlashBase+Address+0x2000+0x20000)) ;
|
||||
}while(v1!=v2);
|
||||
}
|
||||
}
|
||||
void ReadNorFlash(u8* pBuf,u32 address,u16 len)
|
||||
{
|
||||
vu16 *p = (vu16 *)pBuf;
|
||||
u32 loop;
|
||||
for(loop=0;loop<len/2;loop++)
|
||||
{
|
||||
p[loop]=*((vu16 *)(FlashBase+address+loop*2) );
|
||||
}
|
||||
}
|
||||
|
||||
void WriteNorFlash(u32 address,u8 *buffer,u32 size)
|
||||
{
|
||||
vu16 v1,v2;
|
||||
register u32 loopwrite ;
|
||||
vu16* buf = (vu16*)buffer ;
|
||||
u32 size2,lop;
|
||||
u32 mapaddress;
|
||||
u32 j;
|
||||
v1=0;v2=1;
|
||||
u32 off=0;
|
||||
if( (address>=0x1000000) && (ID==0x227E2202))
|
||||
{
|
||||
off=0x1000000;
|
||||
}
|
||||
else
|
||||
off=0;
|
||||
if(size>0x4000)
|
||||
{
|
||||
size2 = size >>1 ;
|
||||
lop = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
size2 = size ;
|
||||
lop = 1;
|
||||
}
|
||||
mapaddress = address;
|
||||
for(j=0;j<lop;j++)
|
||||
{
|
||||
if(j!=0)
|
||||
{
|
||||
mapaddress += 0x4000;
|
||||
buf = (vu16*)(buffer+0x4000);
|
||||
}
|
||||
for(loopwrite=0;loopwrite<(size2>>2);loopwrite++)
|
||||
{
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x2AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x555*2)) = 0xA0 ;
|
||||
*((vu16 *)(FlashBase+mapaddress+loopwrite*2)) = buf[loopwrite];
|
||||
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xAA ;
|
||||
*((vu16 *)(FlashBase+off+0x12AA*2)) = 0x55 ;
|
||||
*((vu16 *)(FlashBase+off+0x1555*2)) = 0xA0 ;
|
||||
*((vu16 *)(FlashBase+mapaddress+0x2000+loopwrite*2)) = buf[0x1000+loopwrite];
|
||||
do
|
||||
{
|
||||
v1 = *((vu16 *)(FlashBase+mapaddress+loopwrite*2)) ;
|
||||
v2 = *((vu16 *)(FlashBase+mapaddress+loopwrite*2)) ;
|
||||
}while(v1!=v2);
|
||||
do
|
||||
{
|
||||
v1 = *((vu16 *)(FlashBase+mapaddress+0x2000+loopwrite*2)) ;
|
||||
v2 = *((vu16 *)(FlashBase+mapaddress+0x2000+loopwrite*2)) ;
|
||||
}while(v1!=v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteSram(uint32 address, u8* data , uint32 size )
|
||||
{
|
||||
uint32 i ;
|
||||
for(i=0;i<size;i++)
|
||||
*(u8*)(address+i)=data[i];
|
||||
}
|
||||
void ReadSram(uint32 address, u8* data , uint32 size )
|
||||
{
|
||||
uint32 i ;
|
||||
|
||||
for(i=0;i<size;i++)
|
||||
data[i] = *(u8*)(address+i);
|
||||
|
||||
/***
|
||||
u16* pData = (u16*)data;
|
||||
|
||||
for(i=0;i<size;i+=2)
|
||||
{
|
||||
pData[i>>1]=*(u8*)(address+i)+(*(u8*)(address+i+1)*0x100);
|
||||
}
|
||||
**/
|
||||
}
|
||||
void OpenRamWrite()
|
||||
{
|
||||
*(vu16 *)0x9fe0000 = 0xd200;
|
||||
*(vu16 *)0x8000000 = 0x1500;
|
||||
*(vu16 *)0x8020000 = 0xd200;
|
||||
*(vu16 *)0x8040000 = 0x1500;
|
||||
*(vu16 *)0x9C40000 = 0xA500;
|
||||
*(vu16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
|
||||
void CloseRamWrite()
|
||||
{
|
||||
*(vu16 *)0x9fe0000 = 0xd200;
|
||||
*(vu16 *)0x8000000 = 0x1500;
|
||||
*(vu16 *)0x8020000 = 0xd200;
|
||||
*(vu16 *)0x8040000 = 0x1500;
|
||||
*(vu16 *)0x9C40000 = 0xA200;
|
||||
*(vu16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
void SetShake(u16 data)
|
||||
{
|
||||
*(vuint16 *)0x9fe0000 = 0xd200;
|
||||
*(vuint16 *)0x8000000 = 0x1500;
|
||||
*(vuint16 *)0x8020000 = 0xd200;
|
||||
*(vuint16 *)0x8040000 = 0x1500;
|
||||
*(vuint16 *)0x9E20000 = data;
|
||||
*(vuint16 *)0x9fc0000 = 0x1500;
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
68
arm9/source/dsCard.h
Normal file
68
arm9/source/dsCard.h
Normal file
@ -0,0 +1,68 @@
|
||||
/**************************************************************************************************************
|
||||
* 此文件为 dsCard.h 文件的第二版
|
||||
* 日期:2006年11月27日11点33分 第一版 version 1.0
|
||||
* 作者:aladdin
|
||||
* CopyRight : EZFlash Group
|
||||
*
|
||||
**************************************************************************************************************/
|
||||
|
||||
#ifndef NDS_DSCARD_V2_INCLUDE
|
||||
#define NDS_DSCARD_V2_INCLUDE
|
||||
|
||||
#include "nds.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
#ifndef WORD
|
||||
typedef unsigned short WORD;
|
||||
#endif
|
||||
|
||||
#ifndef DWORD
|
||||
typedef unsigned long DWORD;
|
||||
#endif
|
||||
|
||||
#ifndef BOOL
|
||||
typedef bool BOOL ;
|
||||
#endif
|
||||
// export interface
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
//DS 卡 基本操作
|
||||
//Arm9 方面基本操作容许ARM7访问slot1
|
||||
void Enable_Arm7DS(void);
|
||||
|
||||
//Arm9 方面基本操作容许ARM9访问slot1
|
||||
void Enable_Arm9DS(void);
|
||||
|
||||
|
||||
//下面是访问震动卡的函数
|
||||
#define FlashBase 0x08000000
|
||||
#define _Ez5PsRAM 0x08000000
|
||||
void OpenNorWrite();
|
||||
void CloseNorWrite();
|
||||
void SetRompage(u16 page);
|
||||
void SetRampage(u16 page);
|
||||
void OpenRamWrite();
|
||||
void CloseRamWrite();
|
||||
void SetSerialMode();
|
||||
uint32 ReadNorFlashID();
|
||||
void chip_reset();
|
||||
void Block_Erase(u32 blockAdd);
|
||||
void ReadNorFlash(u8* pBuf,u32 address,u16 len);
|
||||
void WriteNorFlash(u32 address,u8 *buffer,u32 size);
|
||||
void WriteSram(uint32 address, u8* data , uint32 size );
|
||||
void ReadSram(uint32 address, u8* data , uint32 size );
|
||||
void SetShake(u16 data);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
80
arm9/source/fatdir.h
Normal file
80
arm9/source/fatdir.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
fatdir.h
|
||||
|
||||
Functions used by the newlib disc stubs to interface with
|
||||
this library
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-08-13 - Chishm
|
||||
* Moved all externally visible directory related functions to fatdir
|
||||
* Added _FAT_mkdir_r
|
||||
|
||||
2006-08-14 - Chishm
|
||||
* Added directory iterator functions
|
||||
|
||||
2007-01-10 - Chishm
|
||||
* Updated directory iterator functions for DevkitPro r20
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FATDIR_H
|
||||
#define _FATDIR_H
|
||||
|
||||
#include <sys/reent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/iosupport.h>
|
||||
#include "common.h"
|
||||
#include "directory.h"
|
||||
|
||||
typedef struct {
|
||||
PARTITION* partition;
|
||||
DIR_ENTRY currentEntry;
|
||||
u32 startCluster;
|
||||
bool inUse;
|
||||
bool validEntry;
|
||||
} DIR_STATE_STRUCT;
|
||||
|
||||
extern int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
|
||||
|
||||
extern int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
|
||||
|
||||
extern int _FAT_unlink_r (struct _reent *r, const char *name);
|
||||
|
||||
extern int _FAT_chdir_r (struct _reent *r, const char *name);
|
||||
|
||||
extern int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
|
||||
|
||||
extern int _FAT_mkdir_r (struct _reent *r, const char *path, int mode);
|
||||
|
||||
/*
|
||||
Directory iterator functions
|
||||
*/
|
||||
extern DIR_ITER* _FAT_diropen_r(struct _reent *r, DIR_ITER *dirState, const char *path);
|
||||
extern int _FAT_dirreset_r (struct _reent *r, DIR_ITER *dirState);
|
||||
extern int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *filestat);
|
||||
extern int _FAT_dirclose_r (struct _reent *r, DIR_ITER *dirState);
|
||||
|
||||
|
||||
#endif // _FATDIR_H
|
18
arm9/source/fatdir_ex.h
Normal file
18
arm9/source/fatdir_ex.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef _FATDIR_EX_H_
|
||||
#define _FATDIR_EX_H_
|
||||
|
||||
#include "fatdir.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int dirnextl (DIR_ITER *dirState, char *filename, char *longFilename, struct stat *filestat);
|
||||
int renamex( const char *oldName, const char *newName );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif//_FATDIR_EX_H_
|
88
arm9/source/fatfile.h
Normal file
88
arm9/source/fatfile.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
fatfile.h
|
||||
|
||||
Functions used by the newlib disc stubs to interface with
|
||||
this library
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
|
||||
2006-07-17 - Chishm
|
||||
* Made all path inputs const char*
|
||||
* Added _FAT_rename_r
|
||||
|
||||
2006-07-24 - Chishm
|
||||
* Removed padding workaround from FILE_STRUCT
|
||||
|
||||
2006-08-13 - Chishm
|
||||
* Moved all externally visible directory related functions to fatdir
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FATFILE_H
|
||||
#define _FATFILE_H
|
||||
|
||||
#include <sys/reent.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "partition.h"
|
||||
#include "directory.h"
|
||||
|
||||
typedef struct {
|
||||
u32 cluster;
|
||||
u32 sector;
|
||||
s32 byte;
|
||||
} FILE_POSITION;
|
||||
|
||||
typedef struct {
|
||||
u32 filesize;
|
||||
u32 startCluster;
|
||||
u32 currentPosition;
|
||||
FILE_POSITION rwPosition;
|
||||
FILE_POSITION appendPosition;
|
||||
bool read;
|
||||
bool write;
|
||||
bool append;
|
||||
bool inUse;
|
||||
PARTITION* partition;
|
||||
DIR_ENTRY_POSITION dirEntryStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
|
||||
DIR_ENTRY_POSITION dirEntryEnd; // Always points to the file's alias entry
|
||||
} FILE_STRUCT;
|
||||
|
||||
extern int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
|
||||
|
||||
extern int _FAT_close_r (struct _reent *r, int fd);
|
||||
|
||||
extern int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len);
|
||||
|
||||
extern int _FAT_read_r (struct _reent *r, int fd, char *ptr, int len);
|
||||
|
||||
extern int _FAT_seek_r (struct _reent *r, int fd,int pos, int dir);
|
||||
|
||||
extern int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st);
|
||||
|
||||
#endif // _FATFILE_H
|
19
arm9/source/fatfile_ex.h
Normal file
19
arm9/source/fatfile_ex.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _FATFILE_EX_H_
|
||||
#define _FATFILE_EX_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "fatfile.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int freadex( void * buffer, int _size, int _n, FILE * f );
|
||||
int fwritex( const void * buffer, int _size, int _n, FILE * f );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif//_FATFILE_EX_H_
|
2195
arm9/source/gba_patch.cpp
Normal file
2195
arm9/source/gba_patch.cpp
Normal file
File diff suppressed because it is too large
Load Diff
14
arm9/source/gba_patch.h
Normal file
14
arm9/source/gba_patch.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void gba_check_int(char *name);
|
||||
extern u32 gba_check_Ram1(u8 *buf, u32 bufsize, u32 size, u32 ofs);
|
||||
extern void gba_check_Ram2(u32 exp, u8 *buf, u32 bufsize, u32 size);
|
||||
extern u32 gba_check(FILE *gbaFile, u32 size, u8 *buf, u32 bufsize);
|
||||
extern void gba_patch_Ram(u32 exp, char *name, int cart);
|
||||
extern void gba_patch(u8 *buf, u32 add, u32 bufsize, int GBAmode, char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
1210
arm9/source/gbaldr.cpp
Normal file
1210
arm9/source/gbaldr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
49
arm9/source/header_rep.cpp
Normal file
49
arm9/source/header_rep.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include <nds.h>
|
||||
|
||||
#include <fat.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "GBA_ini.h"
|
||||
#include "header_rep.h"
|
||||
|
||||
u8 _comple(u8 *buf, u32 st, u32 en)
|
||||
{
|
||||
u8 crc;
|
||||
u32 i;
|
||||
|
||||
crc = 0;
|
||||
for(i = st; i <= en; i++)
|
||||
crc -= buf[i];
|
||||
|
||||
crc = (crc - 0x19) & 0xff;
|
||||
return(crc);
|
||||
}
|
||||
|
||||
void header_rep(u8 *rwbuf)
|
||||
{
|
||||
char buf[256];
|
||||
FILE *hed;
|
||||
int i;
|
||||
|
||||
rwbuf[0xBD] = _comple(rwbuf, 0xA0, 0xBC);
|
||||
// rwbuf[0xBE] = _comple(rwbuf, 0x04, 0x9F);
|
||||
|
||||
if(_comple(rwbuf, 0x04, 0x9F) == 0xCC)
|
||||
return;
|
||||
|
||||
sprintf(buf, "%s/header.dat", ini.sign_dir);
|
||||
hed = fopen(buf, "rb");
|
||||
if(hed == NULL) return;
|
||||
|
||||
fread(buf, 1, 256, hed);
|
||||
if(_comple((u8*)buf, 0x04, 0x9F) != 0xCC)
|
||||
return;
|
||||
|
||||
for(i = 0x04; i < 0xA0; i++)
|
||||
rwbuf[i] = buf[i];
|
||||
|
||||
fclose(hed);
|
||||
}
|
||||
|
9
arm9/source/header_rep.h
Normal file
9
arm9/source/header_rep.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void header_rep(u8 *rwbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
18
arm9/source/linkreset_arm9.h
Normal file
18
arm9/source/linkreset_arm9.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void LinkReset_ARM9();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
--------------------------
|
||||
EDIY Studio
|
||||
http://www.gbalink.net
|
||||
http://www.ds-link.net
|
||||
--------------------------
|
||||
*/
|
100
arm9/source/linkreset_arm9.s
Normal file
100
arm9/source/linkreset_arm9.s
Normal file
@ -0,0 +1,100 @@
|
||||
.TEXT
|
||||
.ARM
|
||||
.ALIGN
|
||||
|
||||
@---------------------------------------------------------------------------------------
|
||||
.GLOBAL LinkReset_ARM9
|
||||
.func LinkReset_ARM9
|
||||
@---------------------------------------------------------------------------------------
|
||||
LinkReset_ARM9:
|
||||
MOV R12, #0x4000000
|
||||
LDR R1, [R12,#0x130]
|
||||
@ ANDS R1,R1,#0x30C @L+R+START+SELECT
|
||||
@ BXNE LR
|
||||
|
||||
MOV R10, #0
|
||||
MCR p15, 0, R10,c7,c5,0
|
||||
MCR p15, 0, R10,c7,c6,0
|
||||
MCR p15, 0, R10,c7,c10, 4
|
||||
|
||||
MCR p15, 0, R10,c3,c0,0
|
||||
MCR p15, 0, R10,c1,c0
|
||||
|
||||
LDR R6,=0x40001A4
|
||||
MOV R2,#0xC0
|
||||
STRB R2,[R6,#-3]
|
||||
|
||||
LDR R2,=0xededdede
|
||||
STR R2, [R6,#4]
|
||||
MOV R0,#0x2
|
||||
MOV R0,R0,LSL #24
|
||||
STR R0, [R6,#8]
|
||||
|
||||
MOV R0,#0xA0000000
|
||||
STR R0,[R6]
|
||||
Wait_Busy00:
|
||||
LDR R0,[R6]
|
||||
TST R0,#0x80000000
|
||||
BNE Wait_Busy00
|
||||
|
||||
ADD R7,R12,#0x200
|
||||
ADR R0,reset+1
|
||||
BX R0
|
||||
|
||||
.LTORG
|
||||
.ALIGN
|
||||
|
||||
|
||||
.THUMB
|
||||
.ALIGN
|
||||
@---------------------------------------------------------------------------------------
|
||||
reset:
|
||||
MOV R1,#0x21
|
||||
LSL R1,R1,#20 @LDR R1,=0x2100000
|
||||
|
||||
STRH R1, [R7,#0x8] @[4000208]=0
|
||||
STRH R1, [R7,#0x4]
|
||||
|
||||
MOV R4,#0x5C
|
||||
SUB R6,R7,R4
|
||||
|
||||
LDR R0,=0x100200A4
|
||||
STR R0,[R6,#4]
|
||||
STRB R1,[R6,#8]
|
||||
|
||||
MOV R4,#0xAA
|
||||
LSL R4,R4,#24
|
||||
STR R4,[R6]
|
||||
|
||||
MOV R5,#0x40
|
||||
LSL R3,R5,#17
|
||||
LSL R5,R5,#4
|
||||
|
||||
MOV R4,#0x41
|
||||
LSL R4,R4,#20
|
||||
|
||||
Wait_Ready:
|
||||
LDR R0,[R6]
|
||||
TST R0,R3
|
||||
BEQ Wait_Ready
|
||||
|
||||
LDR R0,[R4,#0x10]
|
||||
STR R0,[R1]
|
||||
ADD R1,R1,#4
|
||||
|
||||
SUB R5,R5,#4
|
||||
BNE Wait_Ready
|
||||
|
||||
LDR R0,=0xE880
|
||||
STRH R0,[R7,#0x4] @WAIT_CR=0xE880
|
||||
|
||||
LDR R0, =0xE59FF018
|
||||
LDR R2, =0x27FFE04
|
||||
STR R0, [R2]
|
||||
STR R2, [R2,#0x20]
|
||||
|
||||
BX R2
|
||||
|
||||
.endfunc
|
||||
|
||||
.end
|
1318
arm9/source/main.c
Normal file
1318
arm9/source/main.c
Normal file
File diff suppressed because it is too large
Load Diff
10
arm9/source/maindef.h
Normal file
10
arm9/source/maindef.h
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
#ifndef maindef_h
|
||||
#define maindef_h
|
||||
|
||||
#define ROMTITLE "GBA ExpLoader"
|
||||
#define ROMVERSION "Version 0.57 by Rudolph."
|
||||
#define ROMDATE ""__DATE__" "__TIME__
|
||||
|
||||
#endif
|
||||
|
92
arm9/source/memcleaner.cpp
Normal file
92
arm9/source/memcleaner.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Copyright (C) 2007 Acekard, www.acekard.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <nds.h>
|
||||
#include <nds/registers_alt.h>
|
||||
|
||||
#include "memcleaner.h"
|
||||
|
||||
/*
|
||||
static inline void dmaFillWords(const void* src, void* dest, uint32 size) {
|
||||
DMA_SRC(3) = (uint32)src;
|
||||
DMA_DEST(3) = (uint32)dest;
|
||||
DMA_CR(3) = DMA_COPY_WORDS | DMA_SRC_FIX | (size>>2);
|
||||
while(DMA_CR(3) & DMA_BUSY);
|
||||
}
|
||||
*/
|
||||
|
||||
void resetARM9Memory()
|
||||
{
|
||||
// DMA
|
||||
for (u8 i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
DMA_DEST(i) = 0;
|
||||
TIMER_CR(i) = 0;
|
||||
TIMER_DATA(i) = 0;
|
||||
}
|
||||
|
||||
swiWaitForVBlank(); // wait for VBLANK to avoid screen picture break
|
||||
//PALETTE[0] = 0xFFFF;
|
||||
|
||||
// VIDEO
|
||||
// trun on vram banks for clear
|
||||
VRAM_CR = 0x80808080;
|
||||
(*(vu32*)0x027FFE04) = 0; // temporary variable
|
||||
PALETTE[0] = 0xFFFF;
|
||||
dmaFillWords((void*)0x027FFE04, PALETTE+1, (2*1024)-2);
|
||||
dmaFillWords((void*)0x027FFE04, OAM, 2*1024);
|
||||
dmaFillWords((void*)0x027FFE04, (void*)0x04000000, 0x56); //clear main display registers
|
||||
dmaFillWords((void*)0x027FFE04, (void*)0x04001000, 0x56); //clear sub display registers
|
||||
|
||||
// clear video registers
|
||||
REG_DISPCNT = 0;
|
||||
REG_DISPCNT_SUB = 0;
|
||||
VRAM_A_CR = 0;
|
||||
VRAM_B_CR = 0;
|
||||
VRAM_C_CR = 0;
|
||||
VRAM_D_CR = 0;
|
||||
VRAM_E_CR = 0;
|
||||
VRAM_F_CR = 0;
|
||||
VRAM_G_CR = 0;
|
||||
VRAM_H_CR = 0;
|
||||
VRAM_I_CR = 0;
|
||||
VRAM_CR = 0x00000000;
|
||||
POWER_CR = 0x820F; // turn on all engines
|
||||
|
||||
// Interrupt
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
}
|
51
arm9/source/memcleaner.h
Normal file
51
arm9/source/memcleaner.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Copyright (C) 2007 Acekard, www.acekard.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _MEMCLEANER_H_
|
||||
#define _MEMCLEANER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void resetARM9Memory();
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//_MEMCLEANER_H_
|
251
arm9/source/message.cpp
Normal file
251
arm9/source/message.cpp
Normal file
@ -0,0 +1,251 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <NDS.h>
|
||||
|
||||
#include "message.h"
|
||||
|
||||
char *errmsg[14];
|
||||
char *cnfmsg[11];
|
||||
char *barmsg[4];
|
||||
char *cmd_m[4];
|
||||
char *t_msg[22];
|
||||
char *savmsg[6];
|
||||
|
||||
static char *errmsg_j[14] = {
|
||||
"FATの初期化に失敗しました", // 0
|
||||
"適切なDLDIパッチを行ってください", // 1
|
||||
"Slot2拡張パックがセットされていません", // 2
|
||||
"最初からやり直してください", // 3
|
||||
"SRAMのSAVEデータが、消失していました", // 4
|
||||
"SAVファイルの処理は行えません", // 5
|
||||
"32MB以上のファイルは扱えません", // 6
|
||||
"指定したファイルは大きすぎます", // 7
|
||||
"16MB以上のファイルは扱えません", // 8
|
||||
"Flash 1MbのSAVEタイプは、", // 9
|
||||
"[EXP128K]で取り扱う事ができません", // 10
|
||||
"SAVファイルがありません!", // 11
|
||||
"SAVファイルを削除していませか?", // 12
|
||||
"(A):確認" // 13
|
||||
};
|
||||
|
||||
static char *errmsg_e[14] = {
|
||||
"FAT initialization failed ", // 0
|
||||
"Please apply the appropriate DLDI Patch.", // 1
|
||||
"Slot2 expansion pack not found ", // 2
|
||||
"Please redo from start.", // 3
|
||||
"SRAM save data not found ", // 4
|
||||
"Can't process to SAV file.", // 5
|
||||
"Can't load a file above 32MB", // 6
|
||||
"Selected file too big.", // 7
|
||||
"Can't load a file above 16MB", // 8
|
||||
"The SAVE type of Flash 1Mb", // 9
|
||||
"Can't be treated with [EXP128K].", // 10
|
||||
"SAV file not found!", // 11
|
||||
" delete the SAV file?", // 12
|
||||
"(A):Confirm" // 13
|
||||
};
|
||||
|
||||
|
||||
static char *cnfmsg_j[11] = {
|
||||
"(A):実行, (B):取消", // 0
|
||||
"現在のSRAMにあるSAVEデータを", // 1
|
||||
"SAVファイルに保存します", // 2
|
||||
"SAVファイルのデータを", // 3
|
||||
"SRAMのSAVEにロードします", // 4
|
||||
"全SRAM領域をバックアップファイル", // 5
|
||||
"(SRAM.BIN)から復旧します", // 6
|
||||
"全SRAM領域をバックアップとして", // 7
|
||||
"SRAM.BINに退避します", // 8
|
||||
"このSlot2拡張パックを GBA ExpLoader用に", // 9
|
||||
"設定(SRAMは失われます)していいですか?" // 10
|
||||
};
|
||||
|
||||
static char *cnfmsg_e[11] = {
|
||||
"(A):Run, (B):Cancel", // 0
|
||||
"Write save data in SRAM", // 1
|
||||
" to SAV file", // 2
|
||||
"Load save data in SRAM", // 3
|
||||
" from SAV file", // 4
|
||||
"Restore all data in SRAM", // 5
|
||||
" from file SRAM.BIN", // 6
|
||||
"Backup all data in SRAM", // 7
|
||||
" to file SRAM.BIN", // 8
|
||||
"May I set this Slot2 expansion pack", // 9
|
||||
"for GBA ExpLoader?" // 10
|
||||
};
|
||||
|
||||
|
||||
static char *barmsg_j[4] = {
|
||||
" NORを消去中... ", // 0
|
||||
" NORにコピー中... ", // 1
|
||||
" RAMにロード中... ", // 2
|
||||
" ROMを解析中... " // 3
|
||||
};
|
||||
|
||||
static char *barmsg_e[4] = {
|
||||
" Erasing NOR... ", // 0
|
||||
" Copying to NOR... ", // 1
|
||||
" Loading to RAM... ", // 2
|
||||
" Analyzing ROM... " // 3
|
||||
};
|
||||
|
||||
|
||||
static char *cmd_m_j[4] = {
|
||||
" 振動レベル : (小) ",
|
||||
" 振動レベル : (中) ",
|
||||
" 振動レベル : (大) ",
|
||||
" ブラウザ用拡張メモリ "
|
||||
};
|
||||
|
||||
static char *cmd_m_e[4] = {
|
||||
" Rumble level: Weak ",
|
||||
" Rumble level: Medium ",
|
||||
" Rumble level: Strong ",
|
||||
" Expansion RAM "
|
||||
};
|
||||
|
||||
|
||||
static char *t_msg_j[22] = {
|
||||
"選択中のゲーム",
|
||||
" PSRAMモード",
|
||||
"(A):RAMにゲームをロードして実行 ",
|
||||
"(B):SRAMのSAVEデータを SAVファイルに保存 ",
|
||||
" 全SRAMデータ領域 (X):退避, (Y):復旧",
|
||||
"(R):モード変更 ",
|
||||
"(L)/(R):モード変更 ",
|
||||
"(L):モード変更 ",
|
||||
" NORモード ",
|
||||
"(A):ゲームのコピー (X):NORを実行 ",
|
||||
"(B):SRAMのSAVEデータを SAVファイルに保存 ", // 10
|
||||
"(Y):SAVファイルを SRAMのSAVEにロード ",
|
||||
"[%s] %d ゲーム",
|
||||
"消失もしくは新規状態",
|
||||
"現在のSRAMのSAVE",
|
||||
" == GBAファイルがありません == ",
|
||||
"初期化中....",
|
||||
" 拡張モード",
|
||||
"(A):3in1を設定してリセット",
|
||||
"(L):モード変更 ",
|
||||
"(R):ブラウザ用拡張メモリ ",
|
||||
" SDRAMモード",
|
||||
};
|
||||
|
||||
static char *t_msg_e[22] = {
|
||||
"Selected game",
|
||||
" PSRAM Mode ",
|
||||
"(A):Run (B):Write SRAM to SAV file",
|
||||
"(X):Backup whole SRAM to SRAM.BIN ",
|
||||
"(Y):Restore SRAM.BIN to SRAM ",
|
||||
"(R):Change mode ",
|
||||
"(L)/(R):Change mode ",
|
||||
"(L):Change mode ",
|
||||
" NOR mode ",
|
||||
"(A):Copy game (X):Run game in NOR ",
|
||||
"(B):Write SRAM to SAV file ", // 10
|
||||
"(Y):Load SAV file to SRAM ",
|
||||
"[%s] %d game",
|
||||
"Empty or new state",
|
||||
"Current SRAM Save",
|
||||
" == GBA file not found == ",
|
||||
"Initialize....",
|
||||
"Expansion mode",
|
||||
"(A):Set mode and soft reset",
|
||||
"(L):Change mode ",
|
||||
"(R):Expansion RAM ",
|
||||
" SDRAM Mode ",
|
||||
};
|
||||
|
||||
|
||||
static char *savmsg_j[6] = {
|
||||
" SRAMにSAVEデータをロード", // 0
|
||||
"(A):選択したファイルをロード", // 1
|
||||
"(B):ロードしない(新規ゲーム)", // 2
|
||||
" SRAMのSAVEデータを保存 ", // 3
|
||||
"(A):選択したファイルに保存", // 4
|
||||
"(B):保存しない(取消)", // 5
|
||||
};
|
||||
|
||||
static char *savmsg_e[6] = {
|
||||
" Load SRAM from SAV file ", // 0
|
||||
"(A):Load from selected file", // 1
|
||||
"(B):No load(New Game)", // 2
|
||||
" Write SRAM to SAV file ", // 3
|
||||
"(A):write to selected file", // 4
|
||||
"(B):No write(Cancel)", // 5
|
||||
};
|
||||
|
||||
|
||||
void setLangMsg()
|
||||
{
|
||||
u32 UserLang = 0;
|
||||
int i;
|
||||
|
||||
UserLang = PersonalData->_user_data.language;
|
||||
|
||||
if(UserLang != 0) {
|
||||
for(i = 0; i < 14; i++)
|
||||
errmsg[i] = errmsg_e[i];
|
||||
for(i = 0; i < 11; i++)
|
||||
cnfmsg[i] = cnfmsg_e[i];
|
||||
for(i = 0; i < 4; i++)
|
||||
barmsg[i] = barmsg_e[i];
|
||||
for(i = 0; i < 4; i++)
|
||||
cmd_m[i] = cmd_m_e[i];
|
||||
for(i = 0; i < 22; i++)
|
||||
t_msg[i] = t_msg_e[i];
|
||||
for(i = 0; i < 6; i++)
|
||||
savmsg[i] = savmsg_e[i];
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < 14; i++)
|
||||
errmsg[i] = errmsg_j[i];
|
||||
for(i = 0; i < 11; i++)
|
||||
cnfmsg[i] = cnfmsg_j[i];
|
||||
for(i = 0; i < 4; i++)
|
||||
barmsg[i] = barmsg_j[i];
|
||||
for(i = 0; i < 4; i++)
|
||||
cmd_m[i] = cmd_m_j[i];
|
||||
for(i = 0; i < 22; i++)
|
||||
t_msg[i] = t_msg_j[i];
|
||||
for(i = 0; i < 6; i++)
|
||||
savmsg[i] = savmsg_j[i];
|
||||
|
||||
}
|
||||
|
||||
static bool _isKanji1(u8 ch)
|
||||
{
|
||||
if((ch >= 0x81) && (ch <= 0x9F))
|
||||
return true;
|
||||
if((ch >= 0xE0) && (ch <= 0xEF))
|
||||
return true;
|
||||
if((ch >= 0xFA) && (ch <= 0xFB)) // JIS X 0218他 IBM拡張文字 (0xFA40-0xFC4B)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
char *jstrncpy(char *s1, char *s2, size_t n)
|
||||
{
|
||||
bool kan;
|
||||
|
||||
char *p = s1;
|
||||
|
||||
while(n) {
|
||||
n--;
|
||||
kan = _isKanji1((u8)*s2);
|
||||
if(!(*s1++ = *s2++))
|
||||
break;
|
||||
}
|
||||
|
||||
if(kan)
|
||||
*(s1 - 1) = '\0';
|
||||
|
||||
while(n--)
|
||||
*s1++ = '\0';
|
||||
|
||||
*s1 = '\0';
|
||||
|
||||
return(p);
|
||||
}
|
||||
|
20
arm9/source/message.h
Normal file
20
arm9/source/message.h
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
extern char *errmsg[];
|
||||
extern char *cnfmsg[];
|
||||
extern char *barmsg[];
|
||||
extern char *cmd_m[];
|
||||
extern char *t_msg[];
|
||||
extern char *savmsg[];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void setLangMsg(void);
|
||||
|
||||
extern char *jstrncpy(char *s1, char *s2, size_t n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
124
arm9/source/partition.h
Normal file
124
arm9/source/partition.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
partition.h
|
||||
Functions for mounting and dismounting partitions
|
||||
on various block devices.
|
||||
|
||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
2006-07-11 - Chishm
|
||||
* Original release
|
||||
*/
|
||||
|
||||
#ifndef _PARTITION_H
|
||||
#define _PARTITION_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "disc_io/disc.h"
|
||||
#include "cache.h"
|
||||
|
||||
// Device name
|
||||
extern const char* DEVICE_NAME;
|
||||
|
||||
// Filesystem type
|
||||
typedef enum {FS_UNKNOWN, FS_FAT12, FS_FAT16, FS_FAT32} FS_TYPE;
|
||||
|
||||
#ifdef NDS
|
||||
//typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
|
||||
#else
|
||||
typedef enum {PI_CART_SLOT} PARTITION_INTERFACE;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
u32 fatStart;
|
||||
u32 sectorsPerFat;
|
||||
u32 lastCluster;
|
||||
u32 firstFree;
|
||||
} FAT;
|
||||
|
||||
typedef struct {
|
||||
const IO_INTERFACE* disc;
|
||||
CACHE* cache;
|
||||
// Info about the partition
|
||||
bool readOnly; // If this is set, then do not try writing to the disc
|
||||
FS_TYPE filesysType;
|
||||
u32 totalSize;
|
||||
u32 rootDirStart;
|
||||
u32 rootDirCluster;
|
||||
u32 numberOfSectors;
|
||||
u32 dataStart;
|
||||
u32 bytesPerSector;
|
||||
u32 sectorsPerCluster;
|
||||
u32 bytesPerCluster;
|
||||
FAT fat;
|
||||
// Values that may change after construction
|
||||
u32 cwdCluster; // Current working directory cluser
|
||||
u32 openFileCount;
|
||||
} PARTITION;
|
||||
|
||||
/*
|
||||
Mount the device specified by partitionDevice
|
||||
PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
|
||||
PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
|
||||
*/
|
||||
bool _FAT_partition_mount (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
|
||||
|
||||
/*
|
||||
Mount a partition on a custom device
|
||||
*/
|
||||
bool _FAT_partition_mountCustomInterface (const IO_INTERFACE* device, u32 cacheSize);
|
||||
|
||||
/*
|
||||
Unmount the partition specified by partitionNumber
|
||||
If there are open files, it will fail
|
||||
*/
|
||||
bool _FAT_partition_unmount (PARTITION_INTERFACE partitionNumber);
|
||||
|
||||
/*
|
||||
Forcibly unmount the partition specified by partitionNumber
|
||||
Any open files on the partition will become invalid
|
||||
The cache will be invalidated, and any unflushed writes will be lost
|
||||
*/
|
||||
bool _FAT_partition_unsafeUnmount (PARTITION_INTERFACE partitionNumber);
|
||||
|
||||
/*
|
||||
Set the default device for access by fat: and fat0:,
|
||||
based on the device number
|
||||
*/
|
||||
bool _FAT_partition_setDefaultInterface (PARTITION_INTERFACE partitionNumber);
|
||||
|
||||
/*
|
||||
Set the default device for access by fat: and fat0:,
|
||||
based on the partition pointer
|
||||
*/
|
||||
bool _FAT_partition_setDefaultPartition (PARTITION* partition);
|
||||
|
||||
/*
|
||||
Return the partition specified in a path
|
||||
For instance, "fat0:", "fat:", "/" and "fat:/" will all
|
||||
return the default partition
|
||||
*/
|
||||
PARTITION* _FAT_partition_getPartitionFromPath (const char* path);
|
||||
|
||||
#endif // _PARTITION_H
|
115
arm9/source/ret_menu9_Gen.c
Normal file
115
arm9/source/ret_menu9_Gen.c
Normal file
@ -0,0 +1,115 @@
|
||||
/***********************************************************
|
||||
Arm9 Soft rest for General purpose
|
||||
|
||||
by Rudolph (<EFBFBD>c’é)
|
||||
***************************************************************/
|
||||
|
||||
#include <nds.h>
|
||||
//#include <nds/registers_alt.h> // devkitPror20
|
||||
|
||||
#include <fat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
extern u32 _io_dldi;
|
||||
|
||||
static char *menu_nam;
|
||||
static char name[32];
|
||||
|
||||
bool ret_menu_chk()
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[5];
|
||||
|
||||
buf[0] = _io_dldi & 0xFF;
|
||||
buf[1] = (_io_dldi >> 8) & 0xFF;
|
||||
buf[2] = (_io_dldi >> 16) & 0xFF;
|
||||
buf[3] = (_io_dldi >> 24) & 0xFF;
|
||||
buf[4] = 0;
|
||||
sprintf(name, "/SoftReset.%s", buf);
|
||||
fp = fopen(name, "rb");
|
||||
if(fp != NULL) {
|
||||
fclose(fp);
|
||||
menu_nam = name;
|
||||
return true;
|
||||
}
|
||||
|
||||
menu_nam = NULL;
|
||||
|
||||
if(_io_dldi == 0x53444353) { // SCDS
|
||||
menu_nam = "/MSFORSC.NDS";
|
||||
}
|
||||
|
||||
// if(_io_dldi == 0x58585858) { // AK+(XXXX)
|
||||
// menu_nam = "/system/akmenu2_fat.nds";
|
||||
// }
|
||||
|
||||
if(_io_dldi == 0x4F49524E) { // N-Card
|
||||
menu_nam = "/udisk.nds"; // Žb’è
|
||||
}
|
||||
|
||||
if(_io_dldi == 0x4E475052) { // AK.R.P.G NAND
|
||||
menu_nam = "/akmenu4.nds";
|
||||
}
|
||||
|
||||
if(_io_dldi == 0x53475052) { // AK.R.P.G SD
|
||||
menu_nam = "/akmenu4.nds";
|
||||
}
|
||||
|
||||
if(_io_dldi == 0x44533958) { // X9 SD
|
||||
menu_nam = "/loader.nds";
|
||||
}
|
||||
|
||||
if(_io_dldi == 0x4F495454) { // DSTT
|
||||
menu_nam = "/TTMENU.DAT";
|
||||
}
|
||||
|
||||
if(menu_nam != NULL) {
|
||||
fp = fopen(menu_nam, "rb");
|
||||
if(fp != NULL) {
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ret_menu9_Gen()
|
||||
{
|
||||
u32 hed[16];
|
||||
u8 *ldrBuf;
|
||||
FILE *ldr;
|
||||
u32 siz;
|
||||
|
||||
ldr = fopen(menu_nam, "rb");
|
||||
if(ldr == NULL) return false;
|
||||
|
||||
fread((u8*)hed, 1, 16*4, ldr);
|
||||
siz = 512 + hed[11] + hed[15];
|
||||
ldrBuf = (u8*)malloc(siz);
|
||||
if(ldrBuf == NULL) {
|
||||
fclose(ldr);
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(ldr, 0, SEEK_SET);
|
||||
fread(ldrBuf, 1, 512, ldr);
|
||||
|
||||
fseek(ldr, hed[8], SEEK_SET);
|
||||
fread(ldrBuf + 512, 1, hed[11], ldr);
|
||||
|
||||
fseek(ldr, hed[12], SEEK_SET);
|
||||
fread(ldrBuf + 512 + hed[11], 1, hed[15], ldr);
|
||||
|
||||
fclose(ldr);
|
||||
|
||||
|
||||
(*(vu32*)0x027FFDF4) = (u32)ldrBuf;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
176
arm9/source/ret_menu9_Gens.s
Normal file
176
arm9/source/ret_menu9_Gens.s
Normal file
@ -0,0 +1,176 @@
|
||||
@***********************************************************
|
||||
@
|
||||
@ by Rudolph (<28>c’é) 2007/10/22
|
||||
@
|
||||
@ SoftwareReset Routines for General purpose.
|
||||
@************************************************************
|
||||
|
||||
.ALIGN
|
||||
.GLOBAL ret_menu9_GENs
|
||||
.CODE 32
|
||||
.ARM
|
||||
|
||||
ret_menu9_GENs:
|
||||
mov r4, #0x4000000
|
||||
str r4, [r4, #+0x208] @ *(04000208)=#0x4000000
|
||||
mov r7, #0xE000
|
||||
str r7, [r4, #+0x204] @ *(04000204)=#0xE000
|
||||
|
||||
mov r4, #0x4000000
|
||||
mov r0, #0x0
|
||||
mvn r1, #0x0
|
||||
str r0, [r4, #+0x208] @ *(04000208)=#0
|
||||
str r0, [r4, #+0x210] @ *(04000210)=#0
|
||||
str r1, [r4, #+0x214] @ *(04000214)=#0
|
||||
|
||||
mov r1, #0x0
|
||||
mcr_lp0:
|
||||
mov r0, #0x0
|
||||
mcr_lp1:
|
||||
orr r2, r1, r0
|
||||
mcr 15, 0, r2, cr7, cr14, 2
|
||||
add r0, r0, #0x20
|
||||
cmp r0, #0x400
|
||||
bne mcr_lp1
|
||||
|
||||
add r1, r1, #0x40000000
|
||||
cmp r1,#0x0
|
||||
bne mcr_lp0
|
||||
|
||||
mov r10, #0x0
|
||||
mcr 15, 0, r10, cr7, cr5, 0
|
||||
mcr 15, 0, r10, cr7, cr6, 0
|
||||
mcr 15, 0, r10, cr7, cr10, 4
|
||||
mcr 15, 0, r10, cr3, cr0, 0
|
||||
mcr 15, 0, r10, cr2, cr0, 0
|
||||
mov r10, #0x800000
|
||||
add r10, r10, #0xA
|
||||
mcr 15, 0, r10, cr9, cr1, 0
|
||||
mov r10, #0xC
|
||||
mcr 15, 0, r10, cr9, cr1, 1
|
||||
mov r10, #0x1F
|
||||
msr CPSR_fc, r10
|
||||
ldr r2, =0x00803000
|
||||
mov r3, #0x0
|
||||
str r3, [r2, #+0xFFC] @ *(00803ffc)=#0
|
||||
mvn r3, #0x0
|
||||
str r3, [r2, #+0xFF8] @ *(00803ff8)=#0xFFFFFFFF
|
||||
|
||||
mov r1, #0x0
|
||||
ldr r2, =0x040000B0
|
||||
ldr r4, =0x04000100
|
||||
mov r0,r1
|
||||
|
||||
TimDMA_lp:
|
||||
str r1, [r2], #+0x4
|
||||
str r1, [r2], #+0x4
|
||||
str r1, [r2], #+0x4
|
||||
strh r1, [r4], #+0x2
|
||||
strh r1, [r4], #+0x2
|
||||
add r0, r0, #0x1
|
||||
cmp r0, #0x4
|
||||
bne TimDMA_lp
|
||||
|
||||
mov r0, #0x0
|
||||
ldr r4, =0x027FFE04
|
||||
str r0, [r4, #+0x0] @ *(027ffe04)=#0
|
||||
ldr r3, =0x80808080
|
||||
mov r1, #0x4000000
|
||||
str r3, [r1, #+0x240] @ *(04000240)=#0x80808080
|
||||
mov r3, #0x5000000
|
||||
mvn r2, #0x0
|
||||
strh r2, [r3, #+0x0] @ *(05000000)=#0xFFFF
|
||||
add r3, r3, #0x2
|
||||
str r4, [r1, #+0xD4] @ *(040000d4)=#0x027ffe04
|
||||
ldr r2, =0x850001FF
|
||||
str r3, [r1, #+0xD8] @ *(040000d8)=#0x5000002
|
||||
str r2, [r1, #+0xDC] @ *(040000dc)=#0x850001ff
|
||||
|
||||
DMA_lp0:
|
||||
ldr r3, [r1, #+0xDC] @ r3 = *(040000dc)
|
||||
cmp r3, #0x0
|
||||
blt DMA_lp0
|
||||
|
||||
mov r2, #0x7000000
|
||||
str r4, [r1, #+0xD4] @ *(040000d4)=#0x027ffe04
|
||||
ldr r3, =0x85000200
|
||||
str r2, [r1, #+0xD8] @ *(040000d8)=#0x7000000
|
||||
str r3, [r1, #+0xDC] @ *(040000dc)=#0x85000200
|
||||
add r2, r2, #0xFD000000
|
||||
|
||||
DMA_lp1:
|
||||
ldr r3, [r2, #+0xdc]
|
||||
cmp r3, #0x0
|
||||
blt DMA_lp1
|
||||
|
||||
mov r1, #0x4000000
|
||||
str r4, [r2, #+0xD4]
|
||||
ldr r3, =0x85000015
|
||||
str r2, [r2, #+0xD8]
|
||||
str r3, [r2, #+0xDC]
|
||||
DMA_lp2:
|
||||
ldr r3, [r1, #+0xDC]
|
||||
cmp r3, #0x0
|
||||
blt DMA_lp2
|
||||
|
||||
ldr r2, =0x04001000
|
||||
str r4, [r1, #+0xD4]
|
||||
ldr r3, =0x85000015
|
||||
str r2, [r1, #+0xD8]
|
||||
str r3, [r1, #+0xDC]
|
||||
mov r1, #0x4000000
|
||||
DMA_lp3:
|
||||
ldr r3,[r1, #+0xDC]
|
||||
cmp r3,#0x0
|
||||
blt DMA_lp3
|
||||
|
||||
|
||||
mov r2, #0x6800000
|
||||
str r4, [r1, #+0xD4]
|
||||
ldr r3, =0x85029000
|
||||
str r2, [r1, #+0xD8]
|
||||
mov r12, #0x4000000
|
||||
str r3, [r1, #+0xDC]
|
||||
DMA_lp4:
|
||||
ldr r3, [r12, #+0xDC]
|
||||
cmp r3, #0x0
|
||||
blt DMA_lp4
|
||||
|
||||
ldr r1, =0x04000200
|
||||
ldr r2, =0x04001000
|
||||
mov r3, #0x0
|
||||
strh r3, [r12, #+0x4] @ *(04000004)=#0
|
||||
ldr r0, =0xffff820f
|
||||
str r3, [r12, #+0x0] @ *(04000000)=#0
|
||||
str r3, [r2, #+0x0] @ *(04001000)=#0
|
||||
strb r3, [r1, #+0x40] @ *(04000240)=#0
|
||||
mov r2, #0x3000000
|
||||
strb r3, [r1, #+0x41] @ *(04000241)=#0
|
||||
strb r3, [r1, #+0x42] @ *(04000242)=#0
|
||||
strb r3, [r1, #+0x43] @ *(04000243)=#0
|
||||
strb r3, [r1, #+0x44] @ *(04000244)=#0
|
||||
strb r3, [r1, #+0x45] @ *(04000245)=#0
|
||||
strb r3, [r1, #+0x46] @ *(04000246)=#0
|
||||
strb r3, [r1, #+0x48] @ *(04000248)=#0
|
||||
strb r3, [r1, #+0x49] @ *(04000249)=#0
|
||||
ldr r3, =0x04000300
|
||||
str r2, [r12, #+0x240] @ *(04000240)=#0x3000000
|
||||
mov r2, #0x3
|
||||
strh r0, [r3, #+0x4] @ *(04000304)=0xffff820f
|
||||
strb r2, [r1, #+0x47] @ *(04000247)=#0x3
|
||||
|
||||
|
||||
mov r3, #0x4000000
|
||||
ldr r5, =0x0000e880
|
||||
str r5, [r3, #+0x204] @ *(04000204)=#0x0000e880
|
||||
|
||||
|
||||
ldr r0, =0x027FFDF8
|
||||
ldr r1, =0xE51FF004
|
||||
str r1, [r0, #0x0] @ (027ffdf8)=E51FF004:ldr r15,[r15, #-0x4]
|
||||
str r0, [r0, #0x4] @ (027ffdfC)=027FFDF8
|
||||
|
||||
bx r0 @ JUMP 027FFDF8
|
||||
|
||||
.END
|
||||
|
48
arm9/source/ret_menu9_R4.s
Normal file
48
arm9/source/ret_menu9_R4.s
Normal file
@ -0,0 +1,48 @@
|
||||
@***********************************************************
|
||||
@
|
||||
@ by Rudolph (<28>c’é)
|
||||
@ 2007/05/30 Initialization bug correction
|
||||
@ 2007/05/24 First release
|
||||
@
|
||||
@-----------------------------------------------------------
|
||||
@ SoftwareReset Routines for R4DS or M3SimplyDS.
|
||||
@
|
||||
@ Redistribution and use in source and binary forms,
|
||||
@ with or without modification, are permitted provided
|
||||
@ that the following conditions are met:
|
||||
@
|
||||
@ Only the Homebrew application can be used.
|
||||
@ It is not possible to use it by a business purpose.
|
||||
@
|
||||
@ This software is made based on information obtained
|
||||
@ by Reverse engineering.
|
||||
@
|
||||
@ Please use that at once when a source code that is
|
||||
@ more formal than the official is open to the public.
|
||||
@************************************************************
|
||||
|
||||
.ALIGN
|
||||
.GLOBAL ret_menu9_R4
|
||||
.CODE 32
|
||||
.ARM
|
||||
|
||||
ret_menu9_R4:
|
||||
|
||||
mov r0, #0x2000
|
||||
orr r0, r0, #0x78
|
||||
mov r1, #0x00
|
||||
mcr 15, 0, r0, cr1, cr0, 0
|
||||
mcr 15, 0, r1, cr7, cr5, 0
|
||||
mcr 15, 0, r1, cr7, cr6, 0
|
||||
mcr 15, 0, r1, cr7, cr10, 4
|
||||
orr r0, r0, #0x50000
|
||||
mcr 15, 0, r0, cr1, cr0, 0
|
||||
|
||||
ldr r0, =0x027FFDF8
|
||||
ldr r1, =0xE51FF004
|
||||
str r1, [r0, #0x0] @ (027ffdf8)=E51FF004:ldr r15,[r15, #-0x4]
|
||||
str r0, [r0, #0x4] @ (027ffdfC)=027FFDF8
|
||||
|
||||
bx r0 @ JUMP 027FFDF8
|
||||
|
||||
.END
|
188
arm9/source/save_sel.c
Normal file
188
arm9/source/save_sel.c
Normal file
@ -0,0 +1,188 @@
|
||||
#include <nds.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <fat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/dir.h>
|
||||
|
||||
#include "fatdir_ex.h"
|
||||
#include "message.h"
|
||||
#include "GBA_ini.h"
|
||||
|
||||
#include "tarosa/tarosa_Graphic.h"
|
||||
#include "tarosa/tarosa_Shinofont.h"
|
||||
extern uint16* MainScreen;
|
||||
extern uint16* SubScreen;
|
||||
|
||||
|
||||
char savnam[6][26];
|
||||
char savext[6][4];
|
||||
bool savexist[6];
|
||||
|
||||
void _save_list(char *name)
|
||||
{
|
||||
struct tm *ptime;
|
||||
struct stat st;
|
||||
char fname[512];
|
||||
char path[512];
|
||||
int i;
|
||||
|
||||
strcpy(fname, name);
|
||||
fname[strlen(name) - 3] = 0;
|
||||
|
||||
strcpy(savext[0], "sav");
|
||||
sprintf(path, "%s/%s%s", ini.save_dir, fname, savext[0]);
|
||||
if(stat(path, &st) == 0) {
|
||||
savexist[0] = true;
|
||||
ptime = gmtime(&st.st_mtime);
|
||||
sprintf(savnam[0], " SAV %04d-%02d-%02d %02d:%02d:%02d ",
|
||||
ptime->tm_year + 1900,
|
||||
ptime->tm_mon + 1,
|
||||
ptime->tm_mday,
|
||||
ptime->tm_hour,
|
||||
ptime->tm_min,
|
||||
ptime->tm_sec);
|
||||
} else {
|
||||
savexist[0] = false;
|
||||
strcpy(savnam[0], " SAV -- No File -- ");
|
||||
}
|
||||
|
||||
for(i = 1; i < 6; i++) {
|
||||
sprintf(savext[i], "sv%d", i);
|
||||
sprintf(path, "%s/%s%s", ini.save_dir, fname, savext[i]);
|
||||
if(stat(path, &st) == 0) {
|
||||
savexist[i] = true;
|
||||
ptime = gmtime(&st.st_mtime);
|
||||
sprintf(savnam[i], " <%d> %04d-%02d-%02d %02d:%02d:%02d ",
|
||||
i,
|
||||
ptime->tm_year + 1900,
|
||||
ptime->tm_mon + 1,
|
||||
ptime->tm_mday,
|
||||
ptime->tm_hour,
|
||||
ptime->tm_min,
|
||||
ptime->tm_sec);
|
||||
} else {
|
||||
savexist[i] = false;
|
||||
sprintf(savnam[i], " <%d> -- No File -- ", i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int save_sel(int mod, char *name)
|
||||
{
|
||||
int cmd = 0;
|
||||
u32 ky, repky;
|
||||
int i;
|
||||
int len;
|
||||
int x1, x2;
|
||||
int y1, y2;
|
||||
int xi, yi;
|
||||
u16 *gback;
|
||||
int gsiz;
|
||||
|
||||
|
||||
_save_list(name);
|
||||
|
||||
if(ini.multi == 0) {
|
||||
name[strlen(name) - 3] = 0;
|
||||
strcat(name, savext[0]);
|
||||
if(mod == 0 && savexist[cmd] == 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
len = 25;
|
||||
|
||||
x1 = (256 - len * 6) / 2 - 4;
|
||||
y1 = 4*12;
|
||||
x2 = x1 + len * 6 + 5;
|
||||
y2 = y1 + 7*13 + 8;
|
||||
|
||||
DrawBox_SUB(SubScreen, 9, 137, 246, 187, 0, 1);
|
||||
|
||||
gsiz = (x2-x1+1) * (y2-y1+1);
|
||||
gback = (u16*)malloc(sizeof(u16*) * gsiz);
|
||||
for( yi=y1; yi<y2+1; yi++ ){
|
||||
for( xi=x1; xi<x2+1; xi++ ){
|
||||
gback[(xi-x1)+(yi-y1)*(x2+1-x1)] = Point_SUB( SubScreen, xi, yi );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DrawBox_SUB( SubScreen, x1, y1, x2, y2, 5, 0);
|
||||
DrawBox_SUB( SubScreen, x1+1, y1+1, x2-1, y2-1, 0, 1);
|
||||
|
||||
DrawBox_SUB( SubScreen, x1+2, y1+2, x2-2, y1+17, 5, 1);
|
||||
DrawBox_SUB( SubScreen, x1+2, y1+19, x2-2, y2-2, 5, 0);
|
||||
|
||||
ShinoPrint_SUB( SubScreen, x1 + 3, y1 + 4, (u8 *)savmsg[mod*3 + 0], 0, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 7*6, 13*12-2, (u8 *)savmsg[mod*3 + 1], 1, 0, 1);
|
||||
ShinoPrint_SUB( SubScreen, 7*6, 14*12, (u8 *)savmsg[mod*3 + 2], 1, 0, 1);
|
||||
|
||||
|
||||
ShinoPrint_SUB(SubScreen, x1 + 3, y1 + 20, (u8 *)savnam[0], 2, 3, 1);
|
||||
for(i = 1; i < 6; i++) {
|
||||
ShinoPrint_SUB(SubScreen, x1 + 3, y1 + 20 + i*13, (u8 *)savnam[i], 1, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
while(1) {
|
||||
swiWaitForVBlank();
|
||||
scanKeys();
|
||||
repky = keysDownRepeat();
|
||||
if((repky & KEY_UP) || (repky & KEY_DOWN)) {
|
||||
if(repky & KEY_UP){
|
||||
if(cmd > 0) {
|
||||
ShinoPrint_SUB(SubScreen, x1 + 3, y1 + 20 + cmd*13, (u8 *)savnam[cmd], 1, 0, 1);
|
||||
cmd--;
|
||||
ShinoPrint_SUB(SubScreen, x1 + 3, y1 + 20 + cmd*13, (u8 *)savnam[cmd], 2, 3, 1);
|
||||
}
|
||||
}
|
||||
if(repky & KEY_DOWN){
|
||||
if(cmd < 5) {
|
||||
ShinoPrint_SUB(SubScreen, x1 + 3, y1 + 20 + cmd*13, (u8 *)savnam[cmd], 1, 0, 1);
|
||||
cmd++;
|
||||
ShinoPrint_SUB(SubScreen, x1 + 3, y1 + 20 + cmd*13, (u8 *)savnam[cmd], 2, 3, 1);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
ky = keysDown();
|
||||
|
||||
if(ky & KEY_A) {
|
||||
if(mod == 1 || savexist[cmd]) {
|
||||
name[strlen(name) - 3] = 0;
|
||||
strcat(name, savext[cmd]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(ky & KEY_B) {
|
||||
cmd = -1;
|
||||
name[strlen(name) - 3] = 0;
|
||||
strcat(name, savext[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( yi=y1; yi<y2+1; yi++ ){
|
||||
for( xi=x1; xi<x2+1; xi++ ){
|
||||
Pixel_SUB(SubScreen, xi, yi, gback[(xi-x1) + (yi-y1)*(x2+1-x1)] );
|
||||
}
|
||||
}
|
||||
free(gback);
|
||||
|
||||
return(cmd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
330
arm9/source/skin.cpp
Normal file
330
arm9/source/skin.cpp
Normal file
@ -0,0 +1,330 @@
|
||||
#include <fat.h>
|
||||
#include <nds.h>
|
||||
#include <sys/dir.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//#include "disc_io.h"
|
||||
//#include "gba_nds_fat.h"
|
||||
|
||||
#include "skin.h"
|
||||
|
||||
|
||||
#define BI_RGB (0)
|
||||
#define BI_RLE8 (1)
|
||||
#define BI_RLE4 (2)
|
||||
#define BI_Bitfields (3)
|
||||
|
||||
typedef struct {
|
||||
u8 bfType[2];
|
||||
u32 bfSize;
|
||||
u16 bfReserved1;
|
||||
u16 bfReserved2;
|
||||
u32 bfOffset;
|
||||
u32 biSize;
|
||||
u32 biWidth;
|
||||
u32 biHeight;
|
||||
u16 biPlanes;
|
||||
u16 biBitCount;
|
||||
u32 biCopmression;
|
||||
u32 biSizeImage;
|
||||
u32 biXPixPerMeter;
|
||||
u32 biYPixPerMeter;
|
||||
u32 biClrUsed;
|
||||
u32 biCirImportant;
|
||||
u8 *pPalette;
|
||||
u8 *pBitmap;
|
||||
u32 DataWidth;
|
||||
} TBMPHeader;
|
||||
|
||||
|
||||
static u16 GetVariable16bit(void *pb)
|
||||
{
|
||||
u16 res;
|
||||
u8 *pb8=(u8*)pb;
|
||||
|
||||
res=(u32)pb8[0] << 0;
|
||||
res+=(u32)pb8[1] << 8;
|
||||
|
||||
return(res);
|
||||
}
|
||||
|
||||
static u32 GetVariable32bit(void *pb)
|
||||
{
|
||||
u32 res;
|
||||
u8 *pb8=(u8*)pb;
|
||||
|
||||
res=(u32)pb8[0] << 0;
|
||||
res+=(u32)pb8[1] << 8;
|
||||
res+=(u32)pb8[2] << 16;
|
||||
res+=(u32)pb8[3] << 24;
|
||||
|
||||
return(res);
|
||||
}
|
||||
|
||||
|
||||
static bool GetBMPHeader(u8 *pb,TBMPHeader *pBMPHeader)
|
||||
{
|
||||
if(pb==NULL){
|
||||
// BMP_LoadErrorStr="SourceData Null.";
|
||||
return(false);
|
||||
}
|
||||
if(pBMPHeader==NULL){
|
||||
// BMP_LoadErrorStr="pBMPHeader Null.";
|
||||
return(false);
|
||||
}
|
||||
|
||||
pBMPHeader->bfType[0]=pb[0];
|
||||
pBMPHeader->bfType[1]=pb[1];
|
||||
pBMPHeader->bfSize=GetVariable32bit(&pb[2]);
|
||||
pBMPHeader->bfReserved1=GetVariable16bit(&pb[6]);
|
||||
pBMPHeader->bfReserved2=GetVariable16bit(&pb[8]);
|
||||
pBMPHeader->bfOffset=GetVariable32bit(&pb[10]);
|
||||
pBMPHeader->biSize=GetVariable32bit(&pb[14+0]);
|
||||
pBMPHeader->biWidth=GetVariable32bit(&pb[14+4]);
|
||||
pBMPHeader->biHeight=GetVariable32bit(&pb[14+8]);
|
||||
pBMPHeader->biPlanes=GetVariable16bit(&pb[14+12]);
|
||||
pBMPHeader->biBitCount=GetVariable16bit(&pb[14+14]);
|
||||
pBMPHeader->biCopmression=GetVariable32bit(&pb[14+16]);
|
||||
pBMPHeader->biSizeImage=GetVariable32bit(&pb[14+20]);
|
||||
pBMPHeader->biXPixPerMeter=GetVariable32bit(&pb[14+24]);
|
||||
pBMPHeader->biYPixPerMeter=GetVariable32bit(&pb[14+28]);
|
||||
pBMPHeader->biClrUsed=GetVariable32bit(&pb[14+32]);
|
||||
pBMPHeader->biCirImportant=GetVariable32bit(&pb[14+36]);
|
||||
|
||||
pBMPHeader->pPalette=&pb[14+40];
|
||||
pBMPHeader->pBitmap=&pb[pBMPHeader->bfOffset];
|
||||
|
||||
pBMPHeader->DataWidth=0;
|
||||
|
||||
if((pBMPHeader->bfType[0]!='B')||(pBMPHeader->bfType[1]!='M')){
|
||||
// BMP_LoadErrorStr="Error MagicID!=BM";
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(pBMPHeader->biCopmression!=BI_RGB){
|
||||
// BMP_LoadErrorStr="Error notsupport Compression";
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(pBMPHeader->biHeight>=0x80000000){
|
||||
// BMP_LoadErrorStr="Error notsupport OS/2 format";
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(pBMPHeader->biPlanes!=1){
|
||||
// BMP_LoadErrorStr="Error notsupport Planes!=1";
|
||||
return(false);
|
||||
}
|
||||
|
||||
switch(pBMPHeader->biBitCount){
|
||||
case 1:
|
||||
// BMP_LoadErrorStr="Error notsupport 1bitcolor.";
|
||||
return(false);
|
||||
case 4:
|
||||
// BMP_LoadErrorStr="Error notsupport 4bitcolor.";
|
||||
return(false);
|
||||
case 8:
|
||||
pBMPHeader->DataWidth=pBMPHeader->biWidth*1;
|
||||
break;
|
||||
case 16:
|
||||
// BMP_LoadErrorStr="Error notsupport 16bitcolor.";
|
||||
return(false);
|
||||
case 24:
|
||||
pBMPHeader->DataWidth=pBMPHeader->biWidth*3;
|
||||
break;
|
||||
case 32:
|
||||
pBMPHeader->DataWidth=pBMPHeader->biWidth*4;
|
||||
break;
|
||||
default:
|
||||
// BMP_LoadErrorStr="Error Unknown xxBitColor.";
|
||||
return(false);
|
||||
}
|
||||
|
||||
if((pBMPHeader->DataWidth&3)!=0){
|
||||
pBMPHeader->DataWidth+=4-(pBMPHeader->DataWidth&3);
|
||||
}
|
||||
|
||||
// BMP_LoadErrorStr="";
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
static bool intLoadBM(const char *bmpfn,u16 *pbm,const u32 bmw,const u32 bmh)
|
||||
{
|
||||
FILE *fh;
|
||||
|
||||
|
||||
// bmerrstr1[0]=0;
|
||||
// bmerrstr2[0]=0;
|
||||
|
||||
if(pbm==NULL){
|
||||
// snprintf(bmerrstr1,256,"BitmapMemory is NULL.");
|
||||
// snprintf(bmerrstr2,256,"The memory is insufficient?");
|
||||
// _consolePrintf("%s\n",bmerrstr1);
|
||||
// _consolePrintf("%s\n",bmerrstr2);
|
||||
return(false);
|
||||
}
|
||||
|
||||
u8 *bmdata = NULL;
|
||||
u32 bmsize;
|
||||
|
||||
fh=fopen(bmpfn, "rb");
|
||||
|
||||
|
||||
if(fh!=NULL){
|
||||
fseek(fh, 0, SEEK_END);
|
||||
bmsize=ftell(fh);
|
||||
fseek(fh, 0, SEEK_SET);
|
||||
bmdata = (u8*)malloc(bmsize);
|
||||
|
||||
fread(bmdata, 1, bmsize, fh);
|
||||
fclose(fh);
|
||||
}
|
||||
|
||||
if(bmdata==NULL){
|
||||
return(false);
|
||||
}else{
|
||||
// _consolePrintf("loadskin /shell/%s\n",bmpfn);
|
||||
}
|
||||
|
||||
TBMPHeader BMPHeader;
|
||||
|
||||
if(GetBMPHeader(bmdata,&BMPHeader)==false){
|
||||
// snprintf(bmerrstr1,256,"Request /shell/%s WindowsBitmapFormat",bmpfn);
|
||||
// snprintf(bmerrstr2,256,"%s",BMP_LoadErrorStr);
|
||||
// _consolePrintf("%s\n",bmerrstr1);
|
||||
// _consolePrintf("%s\n",bmerrstr2);
|
||||
free(bmdata); bmdata=NULL;
|
||||
return(false);
|
||||
}
|
||||
|
||||
if((BMPHeader.biWidth==1)&&(BMPHeader.biHeight==1)){
|
||||
free(bmdata); bmdata=NULL;
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(BMPHeader.biBitCount==32){
|
||||
// _consolePrintf("Error. not support 32bit color.");
|
||||
free(bmdata); bmdata=NULL;
|
||||
return(false);
|
||||
}
|
||||
|
||||
if((BMPHeader.biWidth<bmw)||(BMPHeader.biHeight<bmh)){
|
||||
// snprintf(bmerrstr1,256,"Request /shell/%s WindowsBitmapFormat",bmpfn);
|
||||
// snprintf(bmerrstr2,256,"%d x %dpixel 8 or 24bitcolor NoCompression.",bmw,bmh);
|
||||
// _consolePrintf("%s\n",bmerrstr1);
|
||||
// _consolePrintf("%s\n",bmerrstr2);
|
||||
free(bmdata); bmdata=NULL;
|
||||
return(false);
|
||||
}
|
||||
|
||||
u32 gr=0,gg=0,gb=0;
|
||||
|
||||
#define Gravity(c,cg) { \
|
||||
c+=cg; \
|
||||
cg=c&7; \
|
||||
c=c>>3; \
|
||||
if((c&(~0x1f))!=0) c=(c<0) ? 0x00 : 0x1f; \
|
||||
}
|
||||
|
||||
for(u32 y=0;y<bmh;y++){
|
||||
u8 *pSrcBM=&BMPHeader.pBitmap[(BMPHeader.biHeight-1-y)*BMPHeader.DataWidth];
|
||||
u16 *pDstBM=&pbm[y*bmw];
|
||||
|
||||
switch(BMPHeader.biBitCount){
|
||||
case 8: {
|
||||
u8 *PaletteTable=BMPHeader.pPalette;
|
||||
for(u32 x=0;x<bmw;x++){
|
||||
u8 *pal;
|
||||
u32 r,g,b;
|
||||
|
||||
pal=&PaletteTable[*pSrcBM*4];
|
||||
pSrcBM+=1;
|
||||
|
||||
b=pal[0];
|
||||
g=pal[1];
|
||||
r=pal[2];
|
||||
|
||||
Gravity(b,gb);
|
||||
Gravity(g,gg);
|
||||
Gravity(r,gr);
|
||||
|
||||
pDstBM[x]=RGB15(r,g,b) | BIT(15);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
for(u32 x=0;x<bmw;x++){
|
||||
u32 r,g,b;
|
||||
|
||||
b=pSrcBM[0];
|
||||
g=pSrcBM[1];
|
||||
r=pSrcBM[2];
|
||||
pSrcBM+=3;
|
||||
|
||||
Gravity(b,gb);
|
||||
Gravity(g,gg);
|
||||
Gravity(r,gr);
|
||||
|
||||
pDstBM[x]=RGB15(r,g,b) | BIT(15);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#undef Gravity
|
||||
|
||||
free(bmdata); bmdata=NULL;
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool LoadSkin(int mod, char *Name)
|
||||
{
|
||||
u16 *pBuf;
|
||||
u16 *pDstBuf1;
|
||||
u16 *pDstBuf2;
|
||||
|
||||
pBuf=(u16*)malloc(256*192*2);
|
||||
if(intLoadBM(Name, pBuf, 256, 192) == false) {
|
||||
free(pBuf);
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(mod == 0) {
|
||||
pDstBuf1 = (u16*)0x06020000;
|
||||
}
|
||||
if(mod == 1) {
|
||||
pDstBuf1 = (u16*)0x06220000;
|
||||
}
|
||||
if(mod == 2) {
|
||||
pDstBuf1 = (u16*)0x06000000;
|
||||
pDstBuf2 = (u16*)0x06020000;
|
||||
// pDstBuf1 = (u16*)0x06800000;
|
||||
// pDstBuf2 = (u16*)0x06820000;
|
||||
}
|
||||
|
||||
for(s32 y=0;y<192;y++) {
|
||||
for(s32 x=0;x<256;x++) {
|
||||
pDstBuf1[x]=pBuf[x];
|
||||
if(mod == 2)
|
||||
pDstBuf2[x]=pBuf[x];
|
||||
}
|
||||
pDstBuf1+=256;
|
||||
if(mod == 2)
|
||||
pDstBuf2+=256;
|
||||
pBuf+=256;
|
||||
}
|
||||
|
||||
|
||||
free(pBuf);
|
||||
return(true);
|
||||
}
|
9
arm9/source/skin.h
Normal file
9
arm9/source/skin.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern bool LoadSkin(int mod, char *Name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
686
arm9/source/tarosa/tarosa_Graphic.cpp
Normal file
686
arm9/source/tarosa/tarosa_Graphic.cpp
Normal file
@ -0,0 +1,686 @@
|
||||
//************************************************************************
|
||||
//
|
||||
// 画像処理関係のプログラム 2007.05.04
|
||||
//
|
||||
//************************************************************************
|
||||
#include <nds.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "tarosa_Graphic.h"
|
||||
|
||||
//メインスクリーンとサブスクリーンの設定
|
||||
uint16* MainScreen = VRAM_A;
|
||||
uint16* SubScreen = (uint16*)BG_TILE_RAM_SUB(1);
|
||||
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* MainScreenに点を描画する *
|
||||
* yasuhoさんのソースより *
|
||||
**********************************************/
|
||||
void Pixel( u16* screen, s16 x, s16 y, u16 color )
|
||||
{
|
||||
if(x < 0 || x > 256-1 || y < 0 || y > 192-1) return;
|
||||
screen[y*256+x] = color;
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* SubScreenに点を描画する *
|
||||
* *
|
||||
**********************************************/
|
||||
void Pixel_SUB(uint16* screen, s16 x, s16 y, uint16 palet )
|
||||
{
|
||||
uint16 bgsubAddress, h;
|
||||
|
||||
if(x < 0 || x > 256-1 || y < 0 || y > 192-1) return;
|
||||
|
||||
bgsubAddress = (x>>3)*32 + ((x&7)>>1) + (y>>3)*1024 + ((y&7)<<2);
|
||||
h = screen[bgsubAddress];
|
||||
|
||||
if( (x&1)==0 ){
|
||||
h = palet | (h&0xff00);
|
||||
}
|
||||
else{
|
||||
h = (palet*0x100) | (h&0xff);
|
||||
}
|
||||
screen[bgsubAddress] = h;
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面をパレットコードで塗りつぶします *
|
||||
* *
|
||||
**********************************************/
|
||||
void ClearBG_SUB(uint16* screen, uint16 palet)
|
||||
{
|
||||
int x=0,y=0;
|
||||
|
||||
for( y=0; y<192; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
Pixel_SUB( screen, x, y, palet );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メイン画面をカラーコードで塗りつぶします *
|
||||
* yasuhoさんのソースより *
|
||||
**********************************************/
|
||||
void ClearBG(uint16* screen,uint16 color){
|
||||
|
||||
int x=0,y=0;
|
||||
for( y=0; y<192; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
screen[(y)*256 + (x)] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メイン画面に線を引きます *
|
||||
* yasuhoさんのソースより *
|
||||
**********************************************/
|
||||
void Line(u16* screen,int x0,int y0,int x1,int y1,int color)
|
||||
{
|
||||
int E,x,y;
|
||||
int dx,dy,sx,sy,i;
|
||||
|
||||
sx = ( x1 > x0 ) ? 1 : -1;
|
||||
dx = ( x1 > x0 ) ? x1 - x0 : x0 - x1;
|
||||
sy = ( y1 > y0 ) ? 1 : -1;
|
||||
dy = ( y1 > y0 ) ? y1 - y0 : y0 - y1;
|
||||
|
||||
x = x0;
|
||||
y = y0;
|
||||
/* 傾きが1以下の場合 */
|
||||
if( dx >= dy ) {
|
||||
E = -dx;
|
||||
for( i = 0; i <= dx; i++ ) {
|
||||
Pixel(screen, x, y, color );
|
||||
x += sx;
|
||||
E += 2 * dy;
|
||||
if( E >= 0 ) {
|
||||
y += sy;
|
||||
E -= 2 * dx;
|
||||
}
|
||||
}
|
||||
/* 傾きが1より大きい場合 */
|
||||
}
|
||||
else {
|
||||
E = -dy;
|
||||
for( i = 0; i <= dy; i++ ) {
|
||||
Pixel(screen, x, y, color );
|
||||
y += sy;
|
||||
E += 2 * dx;
|
||||
if( E >= 0 ) {
|
||||
x += sx;
|
||||
E -= 2 * dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面に線を引きます *
|
||||
* *
|
||||
**********************************************/
|
||||
void Line_Sub(u16* screen,int x0,int y0,int x1,int y1,u8 lpal)
|
||||
{
|
||||
int E,x,y;
|
||||
int dx,dy,sx,sy,i;
|
||||
|
||||
sx = ( x1 > x0 ) ? 1 : -1;
|
||||
dx = ( x1 > x0 ) ? x1 - x0 : x0 - x1;
|
||||
sy = ( y1 > y0 ) ? 1 : -1;
|
||||
dy = ( y1 > y0 ) ? y1 - y0 : y0 - y1;
|
||||
|
||||
x = x0;
|
||||
y = y0;
|
||||
/* 傾きが1以下の場合 */
|
||||
if( dx >= dy ) {
|
||||
E = -dx;
|
||||
for( i = 0; i <= dx; i++ ) {
|
||||
Pixel_SUB(screen, x, y, lpal );
|
||||
x += sx;
|
||||
E += 2 * dy;
|
||||
if( E >= 0 ) {
|
||||
y += sy;
|
||||
E -= 2 * dx;
|
||||
}
|
||||
}
|
||||
/* 傾きが1より大きい場合 */
|
||||
}
|
||||
else {
|
||||
E = -dy;
|
||||
for( i = 0; i <= dy; i++ ) {
|
||||
Pixel_SUB(screen, x, y, lpal );
|
||||
y += sy;
|
||||
E += 2 * dx;
|
||||
if( E >= 0 ) {
|
||||
x += sx;
|
||||
E -= 2 * dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メインスクリーンの画像(256色)を *
|
||||
* サブスクリーンにコピーします。 *
|
||||
* *
|
||||
**********************************************/
|
||||
void ScreenCopy( uint16* mainscrn, uint16* subscrn )
|
||||
{
|
||||
uint16 i, x, y, k=0;
|
||||
uint16 col;
|
||||
uint16 paln=0;
|
||||
uint16 paFlag;
|
||||
|
||||
for( y=0; y<192; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
col = mainscrn[y*256+x];
|
||||
if( k==0 ){
|
||||
BG_PALETTE_SUB[0] = col;
|
||||
Pixel_SUB( subscrn, x, y, 0 );
|
||||
k++;
|
||||
}
|
||||
else{
|
||||
paFlag=0;
|
||||
if( k!=256 ){
|
||||
for( i=0; i<k; i++ ){
|
||||
if( BG_PALETTE_SUB[i]==col ){
|
||||
paln = i;
|
||||
paFlag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( paFlag==0 ){
|
||||
BG_PALETTE_SUB[k] = col;
|
||||
Pixel_SUB( subscrn, x, y, k );
|
||||
k++;
|
||||
if( k>=256 ) k=256;
|
||||
}
|
||||
else{
|
||||
Pixel_SUB( subscrn, x, y, paln );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブスクリーンを *
|
||||
* 8ドット上にスクロールします *
|
||||
* *
|
||||
* backpalet:スクロールした後を塗りつぶす *
|
||||
* パレットカラーの指定 *
|
||||
* *
|
||||
**********************************************/
|
||||
void ScRl8Dot_SUB( uint16* screen, u8 backpal )
|
||||
{
|
||||
uint16* strtAdd;
|
||||
|
||||
strtAdd = screen;
|
||||
strtAdd += 1024;
|
||||
dmaCopy( strtAdd, screen, 47104);
|
||||
for( int j=184; j<192; j++ ){
|
||||
for( int i=0; i<256; i++ ){
|
||||
Pixel_SUB( screen, i, j, backpal );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブスクリーンを *
|
||||
* nドット上下にスクロールします *
|
||||
* 正で上、負で下にスクロール *
|
||||
* backpalet:スクロールした後を塗りつぶす *
|
||||
* パレットカラーの指定 *
|
||||
* *
|
||||
**********************************************/
|
||||
void ScRLnDot_SUB( uint16* screen, int n, u8 backpal )
|
||||
{
|
||||
int x,y;
|
||||
|
||||
if( n>0 ){
|
||||
for( y=0; y<192-n; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
SubScreen[ (x>>3)*32 + ((x&7)>>1) + (y>>3)*1024 + ((y&7)<<2) ]
|
||||
= SubScreen[(x>>3)*32 + ((x&7)>>1) + ((y+n)>>3)*1024 + (((y+n)&7)<<2)];
|
||||
}
|
||||
}
|
||||
for( y=192-n; y<192; y++ ){
|
||||
for( int x=0; x<256; x++ ){
|
||||
Pixel_SUB( SubScreen, x, y, backpal );
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
n = -n;
|
||||
for( y=192-n; y>=0; y-- ){
|
||||
for( x=0; x<256; x++ ){
|
||||
SubScreen[ (x>>3)*32 + ((x&7)>>1) + ((y+n)>>3)*1024 + (((y+n)&7)<<2) ]
|
||||
= SubScreen[(x>>3)*32 + ((x&7)>>1) + (y>>3)*1024 + ((y&7)<<2)];
|
||||
}
|
||||
}
|
||||
for( y=0; y<n; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
Pixel_SUB( SubScreen, x, y, backpal );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メインスクリーンを *
|
||||
* 8ドット上にスクロールします *
|
||||
* *
|
||||
* backcolor:スクロールした後を塗りつぶす *
|
||||
* バックカラーの指定 *
|
||||
* *
|
||||
**********************************************/
|
||||
void ScRl8Dot( uint16* screen, uint16 backcolor )
|
||||
{
|
||||
uint16* strtAdd;
|
||||
|
||||
strtAdd = screen;
|
||||
strtAdd += 2048;
|
||||
dmaCopy( strtAdd, screen, 47104*2);
|
||||
for( int j=184; j<192; j++ ){
|
||||
for( int i=0; i<256; i++ ){
|
||||
Pixel( screen, i, j, backcolor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メインスクリーンを *
|
||||
* nドット上下にスクロールします *
|
||||
* 正で上、負で下にスクロール *
|
||||
* backcolor:スクロールした後を塗りつぶす *
|
||||
* バックカラーの指定 *
|
||||
* *
|
||||
**********************************************/
|
||||
void ScRLnDot( uint16* screen, int n, uint16 backcolor )
|
||||
{
|
||||
uint16* strtAdd;
|
||||
int x, y;
|
||||
|
||||
strtAdd = MainScreen;
|
||||
if( n>0 ){
|
||||
strtAdd += 256*n;
|
||||
dmaCopy( strtAdd, MainScreen, 256*(192-n)*2);
|
||||
for( y=192-n; y<192; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
Pixel( MainScreen, x, y, backcolor );
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
n=-n;
|
||||
for( y=192-n; y>=0; y-- ){
|
||||
for( x=0; x<256; x++ ){
|
||||
MainScreen[(y+n)*256+x] = MainScreen[y*256+x];
|
||||
}
|
||||
}
|
||||
for( y=0; y<n; y++ ){
|
||||
for( x=0; x<256; x++ ){
|
||||
Pixel( MainScreen, x, y, backcolor );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* 画像データを *
|
||||
* メイン画面の任意の位置にロードする *
|
||||
* *
|
||||
**********************************************/
|
||||
void PicLoadMS( uint16 *screen, uint16 *sourceData, uint16 x, uint16 y, uint16 picwide, uint16 pichight )
|
||||
{
|
||||
uint16 i;
|
||||
uint16 j;
|
||||
|
||||
for( j=y; j<(y+pichight); j++ ){
|
||||
for( i=x; i<(x+picwide); i++ ){
|
||||
Pixel( screen, i, j, sourceData[i-x+(j-y)*picwide] | BIT(15) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* 画像データを *
|
||||
* メイン画面の任意の位置にロードする *
|
||||
* 透過色を指定できる *
|
||||
* tcf: 0:透過無し、1:元の色とANDをとる *
|
||||
* 2:元の色とORをとる *
|
||||
* 3:元の色とXORをとる *
|
||||
* 4:透過色tcは表示しない *
|
||||
**********************************************/
|
||||
void PicLoadMSo( uint16 *screen, uint16 *sourceData, uint16 x, uint16 y, uint16 picwide, uint16 pichight
|
||||
, int tcf, uint16 tc )
|
||||
{
|
||||
uint16 i;
|
||||
uint16 j;
|
||||
uint16 col;
|
||||
|
||||
switch( tcf ){
|
||||
case 1:
|
||||
for( j=y; j<(y+pichight); j++ ){
|
||||
for( i=x; i<(x+picwide); i++ ){
|
||||
Pixel( screen, i, j, (sourceData[i-x+(j-y)*picwide] | BIT(15))&Point( screen, i, j ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for( j=y; j<(y+pichight); j++ ){
|
||||
for( i=x; i<(x+picwide); i++ ){
|
||||
Pixel( screen, i, j, (sourceData[i-x+(j-y)*picwide] | BIT(15))|Point( screen, i, j ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for( j=y; j<(y+pichight); j++ ){
|
||||
for( i=x; i<(x+picwide); i++ ){
|
||||
Pixel( screen, i, j, (sourceData[i-x+(j-y)*picwide] | BIT(15))^Point( screen, i, j ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for( j=y; j<(y+pichight); j++ ){
|
||||
for( i=x; i<(x+picwide); i++ ){
|
||||
col = sourceData[i-x+(j-y)*picwide];
|
||||
if( tc!=col ){
|
||||
Pixel( screen, i, j, col | BIT(15) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
PicLoadMS( screen, sourceData, x, y, picwide, pichight );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* 画像データを *
|
||||
* サブ画面の任意の位置にロードする *
|
||||
* (パレットは現状のものを使う) *
|
||||
**********************************************/
|
||||
void PicLoadSS( uint16 *screen, uint16 *sourceData, uint16 subx, uint16 suby,
|
||||
uint16 soux, uint16 souy, uint16 picwide, uint16 pichight )
|
||||
{
|
||||
uint16 i;
|
||||
uint16 j;
|
||||
|
||||
for( j=suby; j<(suby+pichight); j++ ){
|
||||
for( i=subx; i<(subx+picwide); i++ ){
|
||||
Pixel_SUB( screen, i, j, sourceData[(i-subx+soux)+(j-suby+souy)*picwide] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* 画像データを *
|
||||
* サブ画面の任意の位置にロードする *
|
||||
* (パレットは現状のものを使う) *
|
||||
* 透過色を指定できる *
|
||||
* tcf: 0:透過無し、1:元の色とANDをとる *
|
||||
* 2:元の色とORをとる *
|
||||
* 3:元の色とXORをとる *
|
||||
* 4:透過色cpaletは表示しない *
|
||||
**********************************************/
|
||||
void PicLoadSSo( uint16 *screen, uint16 *sourceData, uint16 subx, uint16 suby, uint16 picwide, uint16 pichight,
|
||||
int tcf, uint16 cpalet )
|
||||
{
|
||||
uint16 i;
|
||||
uint16 j;
|
||||
uint16 col;
|
||||
|
||||
switch( tcf ){
|
||||
case 1:
|
||||
for( j=suby; j<(suby+pichight); j++ ){
|
||||
for( i=subx; i<(subx+picwide); i++ ){
|
||||
Pixel_SUB( screen, i, j, sourceData[(i-subx)+(j-suby)*picwide]&Point_SUB( screen, i, j ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for( j=suby; j<(suby+pichight); j++ ){
|
||||
for( i=subx; i<(subx+picwide); i++ ){
|
||||
Pixel_SUB( screen, i, j, sourceData[(i-subx)+(j-suby)*picwide]|Point_SUB( screen, i, j ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for( j=suby; j<(suby+pichight); j++ ){
|
||||
for( i=subx; i<(subx+picwide); i++ ){
|
||||
Pixel_SUB( screen, i, j, sourceData[(i-subx)+(j-suby)*picwide]^Point_SUB( screen, i, j ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for( j=suby; j<(suby+pichight); j++ ){
|
||||
for( i=subx; i<(subx+picwide); i++ ){
|
||||
col = sourceData[(i-subx)+(j-suby)*picwide];
|
||||
if( cpalet!=col ){
|
||||
Pixel_SUB( screen, i, j, col );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
PicLoadSS( screen, sourceData, subx, suby, 0, 0, picwide, pichight );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メインスクリーンにボックスを書きます *
|
||||
* full:0 枠のみ *
|
||||
* 1 塗りつぶす *
|
||||
* yasuhoさんのソースより *
|
||||
**********************************************/
|
||||
void DrawBox(u16* screen, int x0, int y0, int x1, int y1, uint16 color, int full)
|
||||
{
|
||||
if( full==0 ){
|
||||
Line( screen, x0, y0, x1, y0, color );
|
||||
Line( screen, x0, y1, x1, y1, color );
|
||||
Line( screen, x0, y0, x0, y1, color );
|
||||
Line( screen, x1, y0, x1, y1, color );
|
||||
}
|
||||
else{
|
||||
if( y0>y1 ){
|
||||
for( int i=y1; i<=y0; i++ ){
|
||||
Line( screen, x0, i, x1, i, color );
|
||||
}
|
||||
}
|
||||
else{
|
||||
for( int i=y0; i<=y1; i++ ){
|
||||
Line( screen, x0, i, x1, i, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブスクリーンにボックスを書きます *
|
||||
* full:0 枠のみ *
|
||||
* 1 塗りつぶす *
|
||||
* 2007.5.4 *
|
||||
**********************************************/
|
||||
void DrawBox_SUB( u16* screen, int x0, int y0, int x1, int y1, uint16 bpalet, int full)
|
||||
{
|
||||
if( full==0 ){
|
||||
Line_Sub( screen, x0, y0, x1, y0, bpalet );
|
||||
Line_Sub( screen, x0, y1, x1, y1, bpalet );
|
||||
Line_Sub( screen, x0, y0, x0, y1, bpalet );
|
||||
Line_Sub( screen, x1, y0, x1, y1, bpalet );
|
||||
}
|
||||
else{
|
||||
if( y0>y1 ){
|
||||
for( int i=y1; i<=y0; i++ ){
|
||||
Line_Sub( screen, x0, i, x1, i, bpalet );
|
||||
}
|
||||
}
|
||||
else{
|
||||
for( int i=y0; i<=y1; i++ ){
|
||||
Line_Sub( screen, x0, i, x1, i, bpalet );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面の一番明るいパレットコードを検索 *
|
||||
* return: パレットコード *
|
||||
* *
|
||||
**********************************************/
|
||||
uint16 maxPaletCode( uint16* subpalet )
|
||||
{
|
||||
int i;
|
||||
int max=0;
|
||||
int r, g, b;
|
||||
int goukei;
|
||||
int maxpalet=0;
|
||||
|
||||
for( i=0; i<256; i++ ){
|
||||
r = (subpalet[i]>>10)&0x1f;
|
||||
g = (subpalet[i]>>5)&0x1f;
|
||||
b = subpalet[i]&0x1f;
|
||||
goukei = r + g + b;
|
||||
if( max<goukei ){
|
||||
max = goukei;
|
||||
maxpalet = i;
|
||||
}
|
||||
}
|
||||
return( maxpalet );
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面の一番暗いパレットコードを検索 *
|
||||
* return: パレットコード *
|
||||
* *
|
||||
**********************************************/
|
||||
uint16 minPaletCode( uint16 *subpalet )
|
||||
{
|
||||
int i;
|
||||
int min;
|
||||
int r, g, b;
|
||||
int goukei;
|
||||
int minpalet=0;
|
||||
|
||||
r = (subpalet[0]>>10)&0x1f;
|
||||
g = (subpalet[0]>>5)&0x1f;
|
||||
b = subpalet[0]&0x1f;
|
||||
min = r + g + b;
|
||||
for( i=1; i<256; i++ ){
|
||||
r = (subpalet[i]>>10)&0x1f;
|
||||
g = (subpalet[i]>>5)&0x1f;
|
||||
b = subpalet[i]&0x1f;
|
||||
goukei = r + g + b;
|
||||
if( min>goukei ){
|
||||
min = goukei;
|
||||
minpalet = i;
|
||||
}
|
||||
}
|
||||
return( minpalet );
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面の(x0,y0)-(x1,y1)範囲の *
|
||||
* パレット(bpal)をcpalパレット番号に *
|
||||
* 入れ替えます *
|
||||
* *
|
||||
**********************************************/
|
||||
void ColorSwap_SUB( u16* screen, s16 x0, s16 y0, s16 x1, s16 y1, uint16 bpalet, uint16 cpalet )
|
||||
{
|
||||
s16 x, y;
|
||||
|
||||
for( y=y0+1; y<y1; y++ ){
|
||||
for( x=x0+1; x<x1; x++ ){
|
||||
if( Point_SUB( screen, x, y )==bpalet ) Pixel_SUB( screen, x, y, cpalet );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面上の点のパレット番号を得る *
|
||||
* *
|
||||
**********************************************/
|
||||
uint16 Point_SUB( u16* screen, s16 x, s16 y )
|
||||
{
|
||||
uint16 bgsubAddress, h;
|
||||
|
||||
if(x < 0 || x > 256-1 || y < 0 || y > 192-1) return( 0 );
|
||||
|
||||
bgsubAddress = (x>>3)*32 + ((x&7)>>1) + (y>>3)*1024 + ((y&7)<<2);
|
||||
h = screen[bgsubAddress];
|
||||
|
||||
if( (x&1)==0 ){
|
||||
return( h&0xff );
|
||||
}
|
||||
else{
|
||||
return( h>>8 );
|
||||
}
|
||||
}
|
||||
|
||||
// 2006.09.09追加分
|
||||
/**********************************************
|
||||
* *
|
||||
* メイン画面上の色を得る *
|
||||
* *
|
||||
**********************************************/
|
||||
int Point( u16* screen, s16 x, s16 y )
|
||||
{
|
||||
if(x < 0 || x > 256-1 || y < 0 || y > 192-1) return( 0 );
|
||||
|
||||
return( (int)screen[y*256+x] );
|
||||
}
|
||||
|
||||
// 2006.09.18追加分
|
||||
/**********************************************
|
||||
* *
|
||||
* メイン画面の(x0,y0)-(x1,y1)範囲の *
|
||||
* 色(bcolor)をccolor色に入れ替えます *
|
||||
* *
|
||||
**********************************************/
|
||||
void ColorSwap( u16* screen, s16 x0, s16 y0, s16 x1, s16 y1, uint16 bcolor, uint16 ccolor )
|
||||
{
|
||||
s16 x, y;
|
||||
|
||||
for( y=y0+1; y<y1; y++ ){
|
||||
for( x=x0+1; x<x1; x++ ){
|
||||
if( Point( screen, x, y )==bcolor ) Pixel( screen, x, y, ccolor );
|
||||
}
|
||||
}
|
||||
}
|
84
arm9/source/tarosa/tarosa_Graphic.h
Normal file
84
arm9/source/tarosa/tarosa_Graphic.h
Normal file
@ -0,0 +1,84 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//************************************************************************
|
||||
//
|
||||
// 画像処理関係のプログラムのヘッダ 2007.05.03
|
||||
//
|
||||
//************************************************************************
|
||||
|
||||
//MainScreenに点を描画する
|
||||
void Pixel( u16* screen, s16 x, s16 y, u16 color );
|
||||
|
||||
//SubScreenに点を描画する
|
||||
void Pixel_SUB(uint16* screen, s16 x, s16 y, uint16 palet );
|
||||
|
||||
//サブ画面をパレットコードで塗りつぶします
|
||||
void ClearBG_SUB(uint16* screen, uint16 palet);
|
||||
|
||||
//メイン画面をカラーコードで塗りつぶします
|
||||
void ClearBG(uint16* screen,uint16 color);
|
||||
|
||||
//メイン画面に線を引きます
|
||||
void Line(u16* screen,int x0,int y0,int x1,int y1,int color);
|
||||
|
||||
//サブ画面に線を引きます
|
||||
void Line_Sub(u16* screen,int x0,int y0,int x1,int y1,u8 lpal);
|
||||
|
||||
//メインスクリーンの画像(256色)を
|
||||
// サブスクリーンにコピーします。
|
||||
void ScreenCopy( uint16* mainscrn, uint16* subscrn );
|
||||
|
||||
//サブスクリーンを8ドット上にスクロールします
|
||||
void ScRl8Dot_SUB( uint16* screen, u8 backpal );
|
||||
|
||||
//サブスクリーンをnドット上下にスクロールします
|
||||
void ScRLnDot_SUB( uint16* screen, int n, u8 backpal );
|
||||
|
||||
//メインスクリーンを8ドット上にスクロールします
|
||||
void ScRl8Dot( uint16* screen, uint16 backcolor );
|
||||
|
||||
//メインスクリーンをnドット上下にスクロールします
|
||||
void ScRLnDot( uint16* screen, int n, uint16 backcolor );
|
||||
|
||||
//画像データをメイン画面の任意の位置にロードする
|
||||
void PicLoadMS( uint16 *screen, uint16 *sourceData, uint16 x, uint16 y, uint16 picwide, uint16 pichight );
|
||||
|
||||
//画像データをサブ画面の任意の位置にロードする
|
||||
void PicLoadSS( uint16 *screen, uint16 *sourceData, uint16 subx, uint16 suby, uint16 soux, uint16 souy, uint16 picwide, uint16 pichight );
|
||||
|
||||
//メインスクリーンにボックスを書きます
|
||||
void DrawBox(u16* screen, int x0, int y0, int x1, int y1, uint16 color, int full);
|
||||
|
||||
//サブスクリーンにボックスを書きます
|
||||
void DrawBox_SUB(u16* screen, int x0, int y0, int x1, int y1, uint16 bpalet, int full);
|
||||
|
||||
//サブ画面の一番明るいパレットコードを検索
|
||||
uint16 maxPaletCode( uint16* subpalet );
|
||||
|
||||
//サブ画面の一番暗いパレットコードを検索
|
||||
uint16 minPaletCode( uint16 *subpalet );
|
||||
|
||||
//サブ画面の(x0,y0)-(x1,y1)範囲のパレット(bpal)をcpalパレット番号に
|
||||
void ColorSwap_SUB( u16* screen, s16 x0, s16 y0, s16 x1, s16 y1, uint16 bpalet, uint16 cpalet );
|
||||
|
||||
//サブ画面上の点のパレット番号を得る
|
||||
uint16 Point_SUB( u16* screen, s16 x, s16 y );
|
||||
|
||||
// 2006.09.09追加分
|
||||
//メイン画面上の色を得る
|
||||
int Point( u16* screen, s16 x, s16 y );
|
||||
|
||||
// 2006.09.18追加分
|
||||
//メイン画面の(x0,y0)-(x1,y1)範囲の色bcolorをccolor色に
|
||||
void ColorSwap( u16* screen, s16 x0, s16 y0, s16 x1, s16 y1, uint16 bcolor, uint16 ccolor );
|
||||
|
||||
//2007.05.03追加
|
||||
//メイン画面の任意の位置にロードする。透過色などを指定できる
|
||||
void PicLoadMSo( uint16 *screen, uint16 *sourceData, uint16 x, uint16 y, uint16 picwide, uint16 pichight, int tcf, uint16 tc );
|
||||
//サブ画面の任意の位置にロードする。透過色などを指定できる
|
||||
void PicLoadSSo( uint16 *screen, uint16 *sourceData, uint16 subx, uint16 suby, uint16 picwide, uint16 pichight, int tcf, uint16 cpalet );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
378
arm9/source/tarosa/tarosa_Shinofont.cpp
Normal file
378
arm9/source/tarosa/tarosa_Shinofont.cpp
Normal file
@ -0,0 +1,378 @@
|
||||
//************************************************************************
|
||||
//
|
||||
// 日本語表示関連のプログラム 2006.07.25
|
||||
//
|
||||
//************************************************************************
|
||||
#include <nds.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
//東雲フォントデータ用ヘッダ
|
||||
#include "shinonome_bin.h" //全角ゴシックフォント
|
||||
#include "shinonomeank_bin.h" //半角フォント
|
||||
|
||||
#include "tarosa_Graphic.h"
|
||||
#include "tarosa_Shinofont.h"
|
||||
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* SJISコードから恵梨沙フォントデータを *
|
||||
* 格納アドレスを計算する *
|
||||
* *
|
||||
**********************************************/
|
||||
short Sjis2Elisa( short u, short d )
|
||||
{
|
||||
short c;
|
||||
|
||||
if (d > 0x7f) d--;
|
||||
d -= 0x40;
|
||||
if( u>=0xe0 ) u -= 0x40;
|
||||
u -= 0x81;
|
||||
c = u * 0xbc + d;
|
||||
|
||||
if(c >= 4418) { /* 第二水準漢字*/
|
||||
return (c - 929);
|
||||
} else if (c >= 1410) { /* 第一水準漢字*/
|
||||
return c + (0x20c - 1410);
|
||||
} else if (c >= 690) { /* 禁止領域の文字 */
|
||||
return 0x6c;
|
||||
} else if (c >= 658) { /* 罫線素 */
|
||||
return c + (0x1ec - 658);
|
||||
} else if (c >= 612) { /* ロシア小 */
|
||||
return c + (0x1cb - 612);
|
||||
} else if (c >= 564) { /* ロシア大 */
|
||||
return c + (0x1aa - 564);
|
||||
} else if (c >= 502) { /* ギリシャ小 */
|
||||
return c + (0x192 - 502);
|
||||
} else if (c >= 470) { /* ギリシャ大*/
|
||||
return c + (0x17a - 470);
|
||||
} else if (c >= 376) { /* カタカナ */
|
||||
return c + (0x124 - 376);
|
||||
} else if (c >= 282) { /* ひらがな */
|
||||
return c + (0xd1 - 282);
|
||||
} else if (c >= 252) { /* 英小文字 */
|
||||
return c + (0xb7 - 252);
|
||||
} else if (c >= 220) { /* 英大文字 */
|
||||
return c + (0x9d - 220);
|
||||
} else if (c >= 203) { /* 数字 */
|
||||
return c + (0x93 - 203);
|
||||
} else if (c >= 187) { /* 記号(◯) */
|
||||
return 0x92;
|
||||
} else if (c >= 175) { /* 記号(ʼn♯♭♪†‡¶) */
|
||||
return c + (0xa6 - 203);
|
||||
} else if (c >= 153) { /* 記号(∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬) */
|
||||
return c + (0x7b - 153);
|
||||
} else if (c >= 135) { /* 記号(∧∨¬⇒⇔∀∃) */
|
||||
return c + (0x74 - 135);
|
||||
} else if (c >= 119) { /* 記号(∈∋⊆⊇⊂⊃∪∩) */
|
||||
return c + (0x6c - 119);
|
||||
} else return c; /* 記号(その他) */
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* メイン画面に東雲12フォントを表示する *
|
||||
* Fpalet:文字色 *
|
||||
* Bpalet:背景色 *
|
||||
* kaki :or書きするか and書きするか *
|
||||
* 0=or , 1=and *
|
||||
* *
|
||||
**********************************************/
|
||||
void ShinoPrint( uint16* screen, int x, int y, u8 *st, u16 Fcolor, u16 Bcolor, u8 kaki )
|
||||
{
|
||||
short i, k, p;
|
||||
short su, sd;
|
||||
|
||||
while( 1 ){
|
||||
su = *st;
|
||||
st++;
|
||||
if( ((su>=0x81)&&(su<=0x9f)) || ((su>=0xe0)&&(su<=0xfc)) ){
|
||||
sd = *st;
|
||||
st++;
|
||||
if( su==0 || sd==0 ) break;
|
||||
k = Sjis2Elisa( su, sd );
|
||||
for( i=0; i<6; i++ ){
|
||||
p = shinonome_bin[k*18+i*3];
|
||||
if((p&0x1)!=0) Pixel( screen, x+7, y+i*2, Fcolor );
|
||||
if((p&0x2)!=0) Pixel( screen, x+6, y+i*2, Fcolor );
|
||||
if((p&0x4)!=0) Pixel( screen, x+5, y+i*2, Fcolor );
|
||||
if((p&0x8)!=0) Pixel( screen, x+4, y+i*2, Fcolor );
|
||||
if((p&0x10)!=0) Pixel( screen, x+3, y+i*2, Fcolor );
|
||||
if((p&0x20)!=0) Pixel( screen, x+2, y+i*2, Fcolor );
|
||||
if((p&0x40)!=0) Pixel( screen, x+1, y+i*2, Fcolor );
|
||||
if((p&0x80)!=0) Pixel( screen, x+0, y+i*2, Fcolor );
|
||||
if( kaki==1 ){
|
||||
if((p&0x1)==0) Pixel( screen, x+7, y+i*2, Bcolor );
|
||||
if((p&0x2)==0) Pixel( screen, x+6, y+i*2, Bcolor );
|
||||
if((p&0x4)==0) Pixel( screen, x+5, y+i*2, Bcolor );
|
||||
if((p&0x8)==0) Pixel( screen, x+4, y+i*2, Bcolor );
|
||||
if((p&0x10)==0) Pixel( screen, x+3, y+i*2, Bcolor );
|
||||
if((p&0x20)==0) Pixel( screen, x+2, y+i*2, Bcolor );
|
||||
if((p&0x40)==0) Pixel( screen, x+1, y+i*2, Bcolor );
|
||||
if((p&0x80)==0) Pixel( screen, x+0, y+i*2, Bcolor );
|
||||
}
|
||||
p = shinonome_bin[k*18+i*3+1];
|
||||
if((p&0x1)!=0) Pixel( screen, x+7, y+i*2+1, Fcolor );
|
||||
if((p&0x2)!=0) Pixel( screen, x+6, y+i*2+1, Fcolor );
|
||||
if((p&0x4)!=0) Pixel( screen, x+5, y+i*2+1, Fcolor );
|
||||
if((p&0x8)!=0) Pixel( screen, x+4, y+i*2+1, Fcolor );
|
||||
if((p&0x10)!=0) Pixel( screen, x+3, y+i*2+1, Fcolor );
|
||||
if((p&0x20)!=0) Pixel( screen, x+2, y+i*2+1, Fcolor );
|
||||
if((p&0x40)!=0) Pixel( screen, x+1, y+i*2+1, Fcolor );
|
||||
if((p&0x80)!=0) Pixel( screen, x+0, y+i*2+1, Fcolor );
|
||||
if( kaki==1 ){
|
||||
if((p&0x1)==0) Pixel( screen, x+7, y+i*2+1, Bcolor );
|
||||
if((p&0x2)==0) Pixel( screen, x+6, y+i*2+1, Bcolor );
|
||||
if((p&0x4)==0) Pixel( screen, x+5, y+i*2+1, Bcolor );
|
||||
if((p&0x8)==0) Pixel( screen, x+4, y+i*2+1, Bcolor );
|
||||
if((p&0x10)==0) Pixel( screen, x+3, y+i*2+1, Bcolor );
|
||||
if((p&0x20)==0) Pixel( screen, x+2, y+i*2+1, Bcolor );
|
||||
if((p&0x40)==0) Pixel( screen, x+1, y+i*2+1, Bcolor );
|
||||
if((p&0x80)==0) Pixel( screen, x+0, y+i*2+1, Bcolor );
|
||||
}
|
||||
p = shinonome_bin[k*18+i*3+2];
|
||||
if((p&0x1)!=0) Pixel( screen, x+11, y+i*2+1, Fcolor );
|
||||
if((p&0x2)!=0) Pixel( screen, x+10, y+i*2+1, Fcolor );
|
||||
if((p&0x4)!=0) Pixel( screen, x+9, y+i*2+1, Fcolor );
|
||||
if((p&0x8)!=0) Pixel( screen, x+8, y+i*2+1, Fcolor );
|
||||
if((p&0x10)!=0) Pixel( screen, x+11, y+i*2, Fcolor );
|
||||
if((p&0x20)!=0) Pixel( screen, x+10, y+i*2, Fcolor );
|
||||
if((p&0x40)!=0) Pixel( screen, x+9, y+i*2, Fcolor );
|
||||
if((p&0x80)!=0) Pixel( screen, x+8, y+i*2, Fcolor );
|
||||
if( kaki==1 ){
|
||||
if((p&0x1)==0) Pixel( screen, x+11, y+i*2+1, Bcolor );
|
||||
if((p&0x2)==0) Pixel( screen, x+10, y+i*2+1, Bcolor );
|
||||
if((p&0x4)==0) Pixel( screen, x+9, y+i*2+1, Bcolor );
|
||||
if((p&0x8)==0) Pixel( screen, x+8, y+i*2+1, Bcolor );
|
||||
if((p&0x10)==0) Pixel( screen, x+11, y+i*2, Bcolor );
|
||||
if((p&0x20)==0) Pixel( screen, x+10, y+i*2, Bcolor );
|
||||
if((p&0x40)==0) Pixel( screen, x+9, y+i*2, Bcolor );
|
||||
if((p&0x80)==0) Pixel( screen, x+8, y+i*2, Bcolor );
|
||||
}
|
||||
}
|
||||
x += 12;
|
||||
}
|
||||
else{ //半角文字だよ
|
||||
if( su==0 ) break;
|
||||
// k = su * 9;
|
||||
for( i=0; i<3; i++ ){
|
||||
p = shinonomeank_bin[su*9+i*3];
|
||||
if((p&0x80)!=0) Pixel( screen, x+0, y+i*4, Fcolor );
|
||||
if((p&0x40)!=0) Pixel( screen, x+1, y+i*4, Fcolor );
|
||||
if((p&0x20)!=0) Pixel( screen, x+2, y+i*4, Fcolor );
|
||||
if((p&0x10)!=0) Pixel( screen, x+3, y+i*4, Fcolor );
|
||||
if((p&0x8)!=0) Pixel( screen, x+4, y+i*4, Fcolor );
|
||||
if((p&0x4)!=0) Pixel( screen, x+5, y+i*4, Fcolor );
|
||||
if((p&0x2)!=0) Pixel( screen, x+0, y+i*4+1, Fcolor );
|
||||
if((p&0x1)!=0) Pixel( screen, x+1, y+i*4+1, Fcolor );
|
||||
if( kaki==1 ){
|
||||
if((p&0x80)==0) Pixel( screen, x+0, y+i*4, Bcolor );
|
||||
if((p&0x40)==0) Pixel( screen, x+1, y+i*4, Bcolor );
|
||||
if((p&0x20)==0) Pixel( screen, x+2, y+i*4, Bcolor );
|
||||
if((p&0x10)==0) Pixel( screen, x+3, y+i*4, Bcolor );
|
||||
if((p&0x8)==0) Pixel( screen, x+4, y+i*4, Bcolor );
|
||||
if((p&0x4)==0) Pixel( screen, x+5, y+i*4, Bcolor );
|
||||
if((p&0x2)==0) Pixel( screen, x+0, y+i*4+1, Bcolor );
|
||||
if((p&0x1)==0) Pixel( screen, x+1, y+i*4+1, Bcolor );
|
||||
}
|
||||
p = shinonomeank_bin[su*9+i*3+1];
|
||||
if((p&0x80)!=0) Pixel( screen, x+2, y+i*4+1, Fcolor );
|
||||
if((p&0x40)!=0) Pixel( screen, x+3, y+i*4+1, Fcolor );
|
||||
if((p&0x20)!=0) Pixel( screen, x+4, y+i*4+1, Fcolor );
|
||||
if((p&0x10)!=0) Pixel( screen, x+5, y+i*4+1, Fcolor );
|
||||
if((p&0x8)!=0) Pixel( screen, x+0, y+i*4+2, Fcolor );
|
||||
if((p&0x4)!=0) Pixel( screen, x+1, y+i*4+2, Fcolor );
|
||||
if((p&0x2)!=0) Pixel( screen, x+2, y+i*4+2, Fcolor );
|
||||
if((p&0x1)!=0) Pixel( screen, x+3, y+i*4+2, Fcolor );
|
||||
if( kaki==1 ){
|
||||
if((p&0x80)==0) Pixel( screen, x+2, y+i*4+1, Bcolor );
|
||||
if((p&0x40)==0) Pixel( screen, x+3, y+i*4+1, Bcolor );
|
||||
if((p&0x20)==0) Pixel( screen, x+4, y+i*4+1, Bcolor );
|
||||
if((p&0x10)==0) Pixel( screen, x+5, y+i*4+1, Bcolor );
|
||||
if((p&0x8)==0) Pixel( screen, x+0, y+i*4+2, Bcolor );
|
||||
if((p&0x4)==0) Pixel( screen, x+1, y+i*4+2, Bcolor );
|
||||
if((p&0x2)==0) Pixel( screen, x+2, y+i*4+2, Bcolor );
|
||||
if((p&0x1)==0) Pixel( screen, x+3, y+i*4+2, Bcolor );
|
||||
}
|
||||
p = shinonomeank_bin[su*9+i*3+2];
|
||||
if((p&0x80)!=0) Pixel( screen, x+4, y+i*4+2, Fcolor );
|
||||
if((p&0x40)!=0) Pixel( screen, x+5, y+i*4+2, Fcolor );
|
||||
if((p&0x20)!=0) Pixel( screen, x+0, y+i*4+3, Fcolor );
|
||||
if((p&0x10)!=0) Pixel( screen, x+1, y+i*4+3, Fcolor );
|
||||
if((p&0x8)!=0) Pixel( screen, x+2, y+i*4+3, Fcolor );
|
||||
if((p&0x4)!=0) Pixel( screen, x+3, y+i*4+3, Fcolor );
|
||||
if((p&0x2)!=0) Pixel( screen, x+4, y+i*4+3, Fcolor );
|
||||
if((p&0x1)!=0) Pixel( screen, x+5, y+i*4+3, Fcolor );
|
||||
if( kaki==1 ){
|
||||
if((p&0x80)==0) Pixel( screen, x+4, y+i*4+2, Bcolor );
|
||||
if((p&0x40)==0) Pixel( screen, x+5, y+i*4+2, Bcolor );
|
||||
if((p&0x20)==0) Pixel( screen, x+0, y+i*4+3, Bcolor );
|
||||
if((p&0x10)==0) Pixel( screen, x+1, y+i*4+3, Bcolor );
|
||||
if((p&0x8)==0) Pixel( screen, x+2, y+i*4+3, Bcolor );
|
||||
if((p&0x4)==0) Pixel( screen, x+3, y+i*4+3, Bcolor );
|
||||
if((p&0x2)==0) Pixel( screen, x+4, y+i*4+3, Bcolor );
|
||||
if((p&0x1)==0) Pixel( screen, x+5, y+i*4+3, Bcolor );
|
||||
}
|
||||
}
|
||||
x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
* *
|
||||
* サブ画面に東雲12フォントを表示する *
|
||||
* Fpalet:文字色 *
|
||||
* Bpalet:背景色 *
|
||||
* kaki :or書きするか and書きするか *
|
||||
* 0=or , 1=and *
|
||||
* *
|
||||
**********************************************/
|
||||
void ShinoPrint_SUB( uint16* screen, int x, int y, u8 *st, u16 Fpalet, u16 Bpalet, u8 kaki )
|
||||
{
|
||||
short i, k, p;
|
||||
short su, sd;
|
||||
|
||||
while( 1 ){
|
||||
su = *st;
|
||||
st++;
|
||||
if( ((su>=0x81)&&(su<=0x9f)) || ((su>=0xe0)&&(su<=0xfc)) ){
|
||||
sd = *st;
|
||||
st++;
|
||||
if( su==0 || sd==0 ) break;
|
||||
k = Sjis2Elisa( su, sd );
|
||||
for( i=0; i<6; i++ ){
|
||||
p = shinonome_bin[k*18+i*3];
|
||||
if((p&0x1)!=0) Pixel_SUB( screen, x+7, y+i*2, Fpalet );
|
||||
if((p&0x2)!=0) Pixel_SUB( screen, x+6, y+i*2, Fpalet );
|
||||
if((p&0x4)!=0) Pixel_SUB( screen, x+5, y+i*2, Fpalet );
|
||||
if((p&0x8)!=0) Pixel_SUB( screen, x+4, y+i*2, Fpalet );
|
||||
if((p&0x10)!=0) Pixel_SUB( screen, x+3, y+i*2, Fpalet );
|
||||
if((p&0x20)!=0) Pixel_SUB( screen, x+2, y+i*2, Fpalet );
|
||||
if((p&0x40)!=0) Pixel_SUB( screen, x+1, y+i*2, Fpalet );
|
||||
if((p&0x80)!=0) Pixel_SUB( screen, x+0, y+i*2, Fpalet );
|
||||
if( kaki==1 ){
|
||||
if((p&0x1)==0) Pixel_SUB( screen, x+7, y+i*2, Bpalet );
|
||||
if((p&0x2)==0) Pixel_SUB( screen, x+6, y+i*2, Bpalet );
|
||||
if((p&0x4)==0) Pixel_SUB( screen, x+5, y+i*2, Bpalet );
|
||||
if((p&0x8)==0) Pixel_SUB( screen, x+4, y+i*2, Bpalet );
|
||||
if((p&0x10)==0) Pixel_SUB( screen, x+3, y+i*2, Bpalet );
|
||||
if((p&0x20)==0) Pixel_SUB( screen, x+2, y+i*2, Bpalet );
|
||||
if((p&0x40)==0) Pixel_SUB( screen, x+1, y+i*2, Bpalet );
|
||||
if((p&0x80)==0) Pixel_SUB( screen, x+0, y+i*2, Bpalet );
|
||||
}
|
||||
p = shinonome_bin[k*18+i*3+1];
|
||||
if((p&0x1)!=0) Pixel_SUB( screen, x+7, y+i*2+1, Fpalet );
|
||||
if((p&0x2)!=0) Pixel_SUB( screen, x+6, y+i*2+1, Fpalet );
|
||||
if((p&0x4)!=0) Pixel_SUB( screen, x+5, y+i*2+1, Fpalet );
|
||||
if((p&0x8)!=0) Pixel_SUB( screen, x+4, y+i*2+1, Fpalet );
|
||||
if((p&0x10)!=0) Pixel_SUB( screen, x+3, y+i*2+1, Fpalet );
|
||||
if((p&0x20)!=0) Pixel_SUB( screen, x+2, y+i*2+1, Fpalet );
|
||||
if((p&0x40)!=0) Pixel_SUB( screen, x+1, y+i*2+1, Fpalet );
|
||||
if((p&0x80)!=0) Pixel_SUB( screen, x+0, y+i*2+1, Fpalet );
|
||||
if( kaki==1 ){
|
||||
if((p&0x1)==0) Pixel_SUB( screen, x+7, y+i*2+1, Bpalet );
|
||||
if((p&0x2)==0) Pixel_SUB( screen, x+6, y+i*2+1, Bpalet );
|
||||
if((p&0x4)==0) Pixel_SUB( screen, x+5, y+i*2+1, Bpalet );
|
||||
if((p&0x8)==0) Pixel_SUB( screen, x+4, y+i*2+1, Bpalet );
|
||||
if((p&0x10)==0) Pixel_SUB( screen, x+3, y+i*2+1, Bpalet );
|
||||
if((p&0x20)==0) Pixel_SUB( screen, x+2, y+i*2+1, Bpalet );
|
||||
if((p&0x40)==0) Pixel_SUB( screen, x+1, y+i*2+1, Bpalet );
|
||||
if((p&0x80)==0) Pixel_SUB( screen, x+0, y+i*2+1, Bpalet );
|
||||
}
|
||||
p = shinonome_bin[k*18+i*3+2];
|
||||
if((p&0x1)!=0) Pixel_SUB( screen, x+11, y+i*2+1, Fpalet );
|
||||
if((p&0x2)!=0) Pixel_SUB( screen, x+10, y+i*2+1, Fpalet );
|
||||
if((p&0x4)!=0) Pixel_SUB( screen, x+9, y+i*2+1, Fpalet );
|
||||
if((p&0x8)!=0) Pixel_SUB( screen, x+8, y+i*2+1, Fpalet );
|
||||
if((p&0x10)!=0) Pixel_SUB( screen, x+11, y+i*2, Fpalet );
|
||||
if((p&0x20)!=0) Pixel_SUB( screen, x+10, y+i*2, Fpalet );
|
||||
if((p&0x40)!=0) Pixel_SUB( screen, x+9, y+i*2, Fpalet );
|
||||
if((p&0x80)!=0) Pixel_SUB( screen, x+8, y+i*2, Fpalet );
|
||||
if( kaki==1 ){
|
||||
if((p&0x1)==0) Pixel_SUB( screen, x+11, y+i*2+1, Bpalet );
|
||||
if((p&0x2)==0) Pixel_SUB( screen, x+10, y+i*2+1, Bpalet );
|
||||
if((p&0x4)==0) Pixel_SUB( screen, x+9, y+i*2+1, Bpalet );
|
||||
if((p&0x8)==0) Pixel_SUB( screen, x+8, y+i*2+1, Bpalet );
|
||||
if((p&0x10)==0) Pixel_SUB( screen, x+11, y+i*2, Bpalet );
|
||||
if((p&0x20)==0) Pixel_SUB( screen, x+10, y+i*2, Bpalet );
|
||||
if((p&0x40)==0) Pixel_SUB( screen, x+9, y+i*2, Bpalet );
|
||||
if((p&0x80)==0) Pixel_SUB( screen, x+8, y+i*2, Bpalet );
|
||||
}
|
||||
}
|
||||
x += 12;
|
||||
}
|
||||
else{ //半角文字だよ
|
||||
if( su==0 ) break;
|
||||
// k = su * 9;
|
||||
for( i=0; i<3; i++ ){
|
||||
p = shinonomeank_bin[su*9+i*3];
|
||||
if((p&0x80)!=0) Pixel_SUB( screen, x+0, y+i*4, Fpalet );
|
||||
if((p&0x40)!=0) Pixel_SUB( screen, x+1, y+i*4, Fpalet );
|
||||
if((p&0x20)!=0) Pixel_SUB( screen, x+2, y+i*4, Fpalet );
|
||||
if((p&0x10)!=0) Pixel_SUB( screen, x+3, y+i*4, Fpalet );
|
||||
if((p&0x8)!=0) Pixel_SUB( screen, x+4, y+i*4, Fpalet );
|
||||
if((p&0x4)!=0) Pixel_SUB( screen, x+5, y+i*4, Fpalet );
|
||||
if((p&0x2)!=0) Pixel_SUB( screen, x+0, y+i*4+1, Fpalet );
|
||||
if((p&0x1)!=0) Pixel_SUB( screen, x+1, y+i*4+1, Fpalet );
|
||||
if( kaki==1 ){
|
||||
if((p&0x80)==0) Pixel_SUB( screen, x+0, y+i*4, Bpalet );
|
||||
if((p&0x40)==0) Pixel_SUB( screen, x+1, y+i*4, Bpalet );
|
||||
if((p&0x20)==0) Pixel_SUB( screen, x+2, y+i*4, Bpalet );
|
||||
if((p&0x10)==0) Pixel_SUB( screen, x+3, y+i*4, Bpalet );
|
||||
if((p&0x8)==0) Pixel_SUB( screen, x+4, y+i*4, Bpalet );
|
||||
if((p&0x4)==0) Pixel_SUB( screen, x+5, y+i*4, Bpalet );
|
||||
if((p&0x2)==0) Pixel_SUB( screen, x+0, y+i*4+1, Bpalet );
|
||||
if((p&0x1)==0) Pixel_SUB( screen, x+1, y+i*4+1, Bpalet );
|
||||
}
|
||||
p = shinonomeank_bin[su*9+i*3+1];
|
||||
if((p&0x80)!=0) Pixel_SUB( screen, x+2, y+i*4+1, Fpalet );
|
||||
if((p&0x40)!=0) Pixel_SUB( screen, x+3, y+i*4+1, Fpalet );
|
||||
if((p&0x20)!=0) Pixel_SUB( screen, x+4, y+i*4+1, Fpalet );
|
||||
if((p&0x10)!=0) Pixel_SUB( screen, x+5, y+i*4+1, Fpalet );
|
||||
if((p&0x8)!=0) Pixel_SUB( screen, x+0, y+i*4+2, Fpalet );
|
||||
if((p&0x4)!=0) Pixel_SUB( screen, x+1, y+i*4+2, Fpalet );
|
||||
if((p&0x2)!=0) Pixel_SUB( screen, x+2, y+i*4+2, Fpalet );
|
||||
if((p&0x1)!=0) Pixel_SUB( screen, x+3, y+i*4+2, Fpalet );
|
||||
if( kaki==1 ){
|
||||
if((p&0x80)==0) Pixel_SUB( screen, x+2, y+i*4+1, Bpalet );
|
||||
if((p&0x40)==0) Pixel_SUB( screen, x+3, y+i*4+1, Bpalet );
|
||||
if((p&0x20)==0) Pixel_SUB( screen, x+4, y+i*4+1, Bpalet );
|
||||
if((p&0x10)==0) Pixel_SUB( screen, x+5, y+i*4+1, Bpalet );
|
||||
if((p&0x8)==0) Pixel_SUB( screen, x+0, y+i*4+2, Bpalet );
|
||||
if((p&0x4)==0) Pixel_SUB( screen, x+1, y+i*4+2, Bpalet );
|
||||
if((p&0x2)==0) Pixel_SUB( screen, x+2, y+i*4+2, Bpalet );
|
||||
if((p&0x1)==0) Pixel_SUB( screen, x+3, y+i*4+2, Bpalet );
|
||||
}
|
||||
p = shinonomeank_bin[su*9+i*3+2];
|
||||
if((p&0x80)!=0) Pixel_SUB( screen, x+4, y+i*4+2, Fpalet );
|
||||
if((p&0x40)!=0) Pixel_SUB( screen, x+5, y+i*4+2, Fpalet );
|
||||
if((p&0x20)!=0) Pixel_SUB( screen, x+0, y+i*4+3, Fpalet );
|
||||
if((p&0x10)!=0) Pixel_SUB( screen, x+1, y+i*4+3, Fpalet );
|
||||
if((p&0x8)!=0) Pixel_SUB( screen, x+2, y+i*4+3, Fpalet );
|
||||
if((p&0x4)!=0) Pixel_SUB( screen, x+3, y+i*4+3, Fpalet );
|
||||
if((p&0x2)!=0) Pixel_SUB( screen, x+4, y+i*4+3, Fpalet );
|
||||
if((p&0x1)!=0) Pixel_SUB( screen, x+5, y+i*4+3, Fpalet );
|
||||
if( kaki==1 ){
|
||||
if((p&0x80)==0) Pixel_SUB( screen, x+4, y+i*4+2, Bpalet );
|
||||
if((p&0x40)==0) Pixel_SUB( screen, x+5, y+i*4+2, Bpalet );
|
||||
if((p&0x20)==0) Pixel_SUB( screen, x+0, y+i*4+3, Bpalet );
|
||||
if((p&0x10)==0) Pixel_SUB( screen, x+1, y+i*4+3, Bpalet );
|
||||
if((p&0x8)==0) Pixel_SUB( screen, x+2, y+i*4+3, Bpalet );
|
||||
if((p&0x4)==0) Pixel_SUB( screen, x+3, y+i*4+3, Bpalet );
|
||||
if((p&0x2)==0) Pixel_SUB( screen, x+4, y+i*4+3, Bpalet );
|
||||
if((p&0x1)==0) Pixel_SUB( screen, x+5, y+i*4+3, Bpalet );
|
||||
}
|
||||
}
|
||||
x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
19
arm9/source/tarosa/tarosa_Shinofont.h
Normal file
19
arm9/source/tarosa/tarosa_Shinofont.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//************************************************************************
|
||||
//
|
||||
// 日本語表示関連のプログラムのヘッダ 2006.07.25
|
||||
//
|
||||
//************************************************************************
|
||||
// SJISコードから恵梨沙フォントデータを格納アドレスを計算する
|
||||
short Sjis2Elisa( short u, short d );
|
||||
// メイン画面に東雲12フォントを表示する
|
||||
void ShinoPrint( uint16* screen, int x, int y, u8 *st, u16 Fcolor, u16 Bcolor, u8 kaki );
|
||||
// サブ画面に東雲12フォントを表示する
|
||||
void ShinoPrint_SUB( uint16* screen, int x, int y, u8 *st, u16 Fpalet, u16 Bpalet, u8 kaki );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
202
arm9/source/unicode.c
Normal file
202
arm9/source/unicode.c
Normal file
@ -0,0 +1,202 @@
|
||||
#include <nds.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "unicode.h"
|
||||
|
||||
#include "unicode_u2l_bin.h"
|
||||
#include "unicode_l2u_bin.h"
|
||||
#include "unicode_ank_bin.h"
|
||||
|
||||
static u16 _codePage = 0;
|
||||
|
||||
static const u16 * _L2UTable = NULL; // custom local to unicode
|
||||
|
||||
static u16 _L2UTableSize = 0;
|
||||
|
||||
static const u16 * _U2LTable = NULL;
|
||||
|
||||
static u16 _U2LTableSize = 0;
|
||||
|
||||
static const u8 * _ankTable = NULL;
|
||||
|
||||
|
||||
void _FAT_unicode_init_default() // ANSI CODE PAGE
|
||||
{
|
||||
// _L2UTable = NULL;
|
||||
// _U2LTable = NULL;
|
||||
// _ankTable = NULL;
|
||||
|
||||
_FAT_unicode_init((const u16*)unicode_l2u_bin, (const u16*)unicode_u2l_bin, (const u8*)unicode_ank_bin);
|
||||
}
|
||||
|
||||
void _FAT_unicode_init( const u16 * l2uTableData, const u16 * u2lTableData, const u8 * ankData )
|
||||
{
|
||||
if( NULL != l2uTableData ) {
|
||||
_codePage = l2uTableData[0];
|
||||
_L2UTableSize = l2uTableData[1];
|
||||
_L2UTable = l2uTableData + 2;
|
||||
}
|
||||
if( NULL != u2lTableData ) {
|
||||
_U2LTableSize = u2lTableData[1];
|
||||
_U2LTable = u2lTableData + 2;
|
||||
}
|
||||
_ankTable = ankData;
|
||||
}
|
||||
|
||||
static void _ank_char_to_unicode( const u8 * src, u16 * dest )
|
||||
{
|
||||
while( 0 != *src )
|
||||
{
|
||||
*dest = (UNICHAR)(*src);
|
||||
dest++;
|
||||
src++;
|
||||
}
|
||||
*dest = (UNICHAR)0;
|
||||
}
|
||||
|
||||
static void _unicode_to_ank_char( const u16 * src, u8 * dest )
|
||||
{
|
||||
u16 local = 0;
|
||||
while( 0x0000 != *src )
|
||||
{
|
||||
local = (*src++);
|
||||
if( !(local >= 0x20 && local <= 0xff) )
|
||||
local = '_';
|
||||
|
||||
*dest++ = local & 0xff;
|
||||
}
|
||||
*dest = 0x00;
|
||||
}
|
||||
|
||||
void _FAT_unicode_local_to_unicode( const u8 * src, UNICHAR * dest )
|
||||
{
|
||||
if( NULL == _L2UTable || NULL == _ankTable )
|
||||
{
|
||||
_ank_char_to_unicode( src, dest );
|
||||
return;
|
||||
}
|
||||
|
||||
while( 0 != *src )
|
||||
{
|
||||
u16 lc = 0;
|
||||
|
||||
lc=(u16)*src;
|
||||
src++;
|
||||
|
||||
if( 0 == _ankTable[lc] && 0 != *src )
|
||||
{
|
||||
lc=(lc << 8)+((u16)*src);
|
||||
src++;
|
||||
}
|
||||
|
||||
if( lc < _L2UTableSize )
|
||||
{
|
||||
*dest = _L2UTable[lc];
|
||||
if( *dest == (UNICHAR)0)
|
||||
*dest = (UNICHAR)'?';
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest=(UNICHAR)'?';
|
||||
}
|
||||
dest++;
|
||||
}
|
||||
|
||||
*dest = (UNICHAR)0;
|
||||
}
|
||||
|
||||
void _FAT_unicode_unicode_to_local( const UNICHAR * src, u8 * dest )
|
||||
{
|
||||
//if( defCharUsed )
|
||||
// *defCharUsed = false;
|
||||
//std::string ret;
|
||||
if( NULL == _U2LTable || NULL == _ankTable )
|
||||
{
|
||||
_unicode_to_ank_char( src, dest );
|
||||
return;
|
||||
}
|
||||
|
||||
const UNICHAR * p = src;
|
||||
while( *p != 0x0000 /*&& p < unicode_string + length*/ )
|
||||
{
|
||||
u16 localChar = 0;
|
||||
if( *p < _U2LTableSize ) { // p's value < table size;
|
||||
localChar = _U2LTable[*p];
|
||||
}
|
||||
else {
|
||||
localChar = '?';
|
||||
// 使用 '?' 作为默认字符好处是,文件系统的文件名里不会包含 '?' 字符,错误容易发现
|
||||
}
|
||||
if( '?' == localChar && (u16)'?' != *p ) {
|
||||
//if( defCharUsed )
|
||||
// *defCharUsed = true;
|
||||
//dbg_printf( "caution: uni %04x->%04x, CP%d\n", *p, localChar, _codePage );
|
||||
}
|
||||
|
||||
*dest++ = (u8)(localChar & 0xFF);
|
||||
if( (localChar & 0xFF00) ) {
|
||||
*dest++ = (u8)( (localChar & 0xFF00) >> 8 );
|
||||
}
|
||||
++p;
|
||||
}
|
||||
*dest = 0;
|
||||
}
|
||||
|
||||
u32 _unistrnlen( const u16 * unistr, u32 maxlen )
|
||||
{
|
||||
const u16 * pstr = NULL;
|
||||
u32 len = 0;
|
||||
if( NULL == unistr )
|
||||
return 0;
|
||||
|
||||
if( 0 == maxlen )
|
||||
return 0;
|
||||
|
||||
pstr = unistr;
|
||||
|
||||
while( len < maxlen && *pstr != 0x0000 )
|
||||
{
|
||||
++len;
|
||||
++pstr;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int _unistrncmp( const u16 * src, const u16 * dest, u32 maxlen )
|
||||
{
|
||||
if( NULL == src || NULL == dest )
|
||||
{
|
||||
if( src == dest ) return NULL;
|
||||
return (NULL == src ) ? -1 : 1;
|
||||
}
|
||||
|
||||
while( *src == *dest && maxlen && *src != 0x0000 && *dest != 0x0000 )
|
||||
{
|
||||
++src;
|
||||
++dest;
|
||||
--maxlen;
|
||||
}
|
||||
if( 0 == maxlen ) return 0;
|
||||
|
||||
return *src > *dest ? 1 : -1;
|
||||
}
|
||||
|
||||
const u16 * _unistrchr( const u16 * str, u16 unichar )
|
||||
{
|
||||
if( NULL == str )
|
||||
return NULL;
|
||||
|
||||
while( *str != unichar && *str != 0x0000 )
|
||||
{
|
||||
++str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
bool _uniisalnum( u8 ch )
|
||||
{
|
||||
if( NULL == _ankTable )
|
||||
return isalnum( ch );
|
||||
|
||||
return (0 == _ankTable[ch]) || isalnum( ch );
|
||||
}
|
27
arm9/source/unicode.h
Normal file
27
arm9/source/unicode.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _LIBFAT_UNICODE_H_
|
||||
#define _LIBFAT_UNICODE_H_
|
||||
|
||||
typedef u16 UNICHAR;
|
||||
|
||||
void _FAT_unicode_init_default(); // ANSI CODE PAGE
|
||||
|
||||
// l2u/u2l table is a map, key and value are both in range 0x0000 - 0xffff
|
||||
void _FAT_unicode_init( const u16 * l2uTableData, const u16 * u2lTableData, const u8 * ankData );
|
||||
|
||||
void _FAT_unicode_uninit(); // do we really need this???
|
||||
|
||||
void _FAT_unicode_local_to_unicode( const u8 * src, UNICHAR * dest );
|
||||
|
||||
void _FAT_unicode_unicode_to_local( const UNICHAR * src, u8 * dest );
|
||||
|
||||
u32 _unistrnlen( const u16 * unistr, u32 maxlen );
|
||||
|
||||
int _unistrncmp( const u16 * src, const u16 * dest, u32 maxlen );
|
||||
|
||||
const u16 * _unistrchr( const u16 * str, u16 unichar );
|
||||
|
||||
bool _uniisalnum( u8 ch );
|
||||
|
||||
|
||||
|
||||
#endif//_LIBFAT_UNICODE_H_
|
30
make_bin
Normal file
30
make_bin
Normal file
@ -0,0 +1,30 @@
|
||||
pause
|
||||
@echo off
|
||||
call setenv_devkitPro.bat
|
||||
|
||||
:loop
|
||||
cls
|
||||
goto skipclean
|
||||
del /Q arm7\build\*.*
|
||||
del /Q arm9\build\*.*
|
||||
:skipclean
|
||||
|
||||
del arm7\_BOOT_MP.arm7.elf
|
||||
del arm9\_BOOT_MP.arm9.elf
|
||||
del _BOOT_MP.bin
|
||||
rem del "C:\APP\_Network\anhttpd\public\wifitemp.nds"
|
||||
make
|
||||
if exist _BOOT_MP.nds goto run
|
||||
pause
|
||||
goto loop
|
||||
|
||||
:run
|
||||
rem ren _BOOT_MP.nds _BOOT_MP.bin
|
||||
del _BOOT_MP.arm7
|
||||
del _BOOT_MP.arm9
|
||||
rem del _BOOT_MP.ds.gba
|
||||
rem call cfcopy.bat
|
||||
rem call wificopy.bat
|
||||
pause
|
||||
goto loop
|
||||
|
5
setenv_devkitPro
Normal file
5
setenv_devkitPro
Normal file
@ -0,0 +1,5 @@
|
||||
rem with libnds-20060719
|
||||
set PATH=d:\devkitPro\msys\bin;d:\devkitPro\devkitARM\bin;%PATH%
|
||||
set DEVKITARM=/d/devkitPro/devkitARM
|
||||
set DEVKITPRO=/d/devkitPro
|
||||
set LIBNDS=/d/devkitPro/libnds
|
Loading…
Reference in New Issue
Block a user