[Scummvm-cvs-logs] SF.net SVN: scummvm: [24171] scummvm/branches/branch-0-9-0/backends/ds/arm9 /source
agent-q at users.sourceforge.net
agent-q at users.sourceforge.net
Sat Oct 7 17:34:13 CEST 2006
Revision: 24171
http://svn.sourceforge.net/scummvm/?rev=24171&view=rev
Author: agent-q
Date: 2006-10-07 08:34:06 -0700 (Sat, 07 Oct 2006)
Log Message:
-----------
MMD changes, and new sound quality option
Modified Paths:
--------------
scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.cpp
scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.h
scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.cpp
scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.h
Modified: scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.cpp 2006-10-07 15:32:21 UTC (rev 24170)
+++ scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.cpp 2006-10-07 15:34:06 UTC (rev 24171)
@@ -108,6 +108,7 @@
int bufferRate;
int bufferSamples;
bool soundHiPart;
+int soundFrequency;
// Events
int lastEventFrame;
@@ -325,11 +326,49 @@
}
+void startSound(int freq, int buffer) {
+ bufferRate = freq * 2;
+ bufferFrame = 0;
+ bufferSamples = 4096;
+
+ bufferFirstHalf = false;
+ bufferSecondHalf = true;
+
+ int bytes = (2 * (bufferSamples)) + 100;
+
+ soundBuffer = (s16 *) malloc(bytes * 2);
+
+
+ soundHiPart = true;
+
+ for (int r = 0; r < bytes; r++) {
+ soundBuffer[r] = 0;
+ }
+
+ soundFrequency = freq;
+
+
+ swiWaitForVBlank();
+ swiWaitForVBlank();
+ playSound(soundBuffer, (bufferSamples * 2), true, false, freq * 2);
+ swiWaitForVBlank();
+ swiWaitForVBlank();
+ swiWaitForVBlank();
+}
+
+int getSoundFrequency() {
+ return soundFrequency;
+}
+
+
void initGame() {
// This is a good time to check for left handed mode since the mode change is done as the game starts.
// There's probably a better way, but hey.
// consolePrintf("initing game\n");
+ static bool firstTime = true;
+
+
setOptions();
//strcpy(gameName, ConfMan.getActiveDomain().c_str());
@@ -344,8 +383,18 @@
// consolePrintf("Game list num: %d\n", currentGame);
}
}
-
+
+ if (firstTime) {
+ firstTime = false;
+ if (ConfMan.hasKey("22khzaudio", "ds") && ConfMan.getBool("22khzaudio", "ds")) {
+ startSound(22050, 8192);
+ } else {
+ startSound(11025, 4096);
+ }
+
+ }
+
}
void setLeftHanded(bool enable) {
@@ -1240,7 +1289,16 @@
// consolePri ntf("X:%d Y:%d\n", getPenX(), getPenY());
+ static bool firstTime = true;
+ // This is to ensure that the ARM7 vblank handler runs before this one.
+ // Fixes the problem with the MMD when the screens swap over on load.
+ if (firstTime) {
+ firstTime = false;
+ return;
+ }
+
+
IPC->tweak = tweak;
soundUpdate();
@@ -1534,9 +1592,19 @@
*/
+ for (int r = 0; r < 255; r++) {
+ PALETTE[r] = 0;
+ }
PALETTE[255] = RGB15(0,31,0);
+
+ for (int r = 0; r < 255; r++) {
+ PALETTE_SUB[r] = 0;
+ }
+
+ PALETTE_SUB[255] = RGB15(0,31,0);
+
// Allocate save buffer for game screen
// savedBuffer = new u8[320 * 200];
displayMode16Bit();
@@ -1806,8 +1874,7 @@
bool GBAMPAvail = false;
void initGBAMP() {
- FAT_InitFiles();
- if (disc_IsInserted()) {
+ if (FAT_InitFiles()) {
GBAMPAvail = true;
consolePrintf("Found flash card reader!\n");
} else {
@@ -1889,26 +1956,40 @@
// playSound(twang, 11010, true); // 18640
// bufferSize = 10;
- bufferRate = 22050;
+
+
+ /*bufferRate = 44100;
bufferFrame = 0;
-// bufferSamples = (bufferRate * bufferSize) / 60;
- bufferSamples = 4096;
-
+ bufferSamples = 8192;
+
bufferFirstHalf = false;
bufferSecondHalf = true;
- lastEventFrame = 0;
- mouseMode = MOUSE_LEFT;
+ int bytes = (2 * (bufferSamples)) + 100;
+
+ soundBuffer = (s16 *) malloc(bytes * 2);
+
+ soundHiPart = true;
+ for (int r = 0; r < bytes; r++) {
+ soundBuffer[r] = 0;
+ }
+
+ swiWaitForVBlank();
+ swiWaitForVBlank();
+ playSound(soundBuffer, (bufferSamples * 2), true);
+ swiWaitForVBlank();
+ swiWaitForVBlank();
+ swiWaitForVBlank();
+*/
- int bytes = (2 * (bufferSamples)) + 100;
+
+ lastEventFrame = 0;
+ mouseMode = MOUSE_LEFT;
- soundBuffer = (s16 *) malloc(bytes * 2);
-
- soundHiPart = true;
/*
TIMER1_CR = 0;
TIMER1_DATA = TIMER_FREQ(bufferRate);
@@ -1931,7 +2012,7 @@
consolePrintf("---------------------------\n");
consolePrintf("ScummVM DS\n");
consolePrintf("Ported by Neil Millstone\n");
- consolePrintf("Version 0.9.1beta1 ");
+ consolePrintf("Version 0.9.1beta3 ");
#if defined(DS_BUILD_A)
consolePrintf("build A\n");
consolePrintf("Supports: Lucasarts SCUMM\n");
@@ -1964,20 +2045,8 @@
#endif
- for (int r = 0; r < bytes; r++) {
- soundBuffer[r] = 0;
- }
-
- swiWaitForVBlank();
- swiWaitForVBlank();
- playSound(soundBuffer, (bufferSamples * 2), true);
- swiWaitForVBlank();
- swiWaitForVBlank();
- swiWaitForVBlank();
-
-
// Create a file system node to force search for a zip file in GBA rom space
DSFileSystemNode* node = new DSFileSystemNode();
if (!node->getZip() || (!node->getZip()->isReady())) {
Modified: scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.h 2006-10-07 15:32:21 UTC (rev 24170)
+++ scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsmain.h 2006-10-07 15:34:06 UTC (rev 24171)
@@ -73,6 +73,7 @@
void doSoundCallback(); // Call function if sound buffers need more data
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
void stopSound(int channel);
+int getSoundFrequency();
// Event queue
void addEventsToQueue();
Modified: scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.cpp 2006-10-07 15:32:21 UTC (rev 24170)
+++ scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.cpp 2006-10-07 15:34:06 UTC (rev 24171)
@@ -45,30 +45,31 @@
}
#endif
- new GUI::StaticTextWidget(this, 0, 10, 280, 20, "ScummVM DS Options", GUI::kTextAlignCenter);
+ new GUI::StaticTextWidget(this, 80, 10, 130, 20, "ScummVM DS Options", GUI::kTextAlignCenter);
- _leftHandedCheckbox = new GUI::CheckboxWidget(this, 20, 30, 280, 20, "Left handed mode", 0, 'L');
- _indyFightCheckbox = new GUI::CheckboxWidget(this, 20, 45, 280, 20, "Indy fighting controls", 0, 'I');
- _unscaledCheckbox = new GUI::CheckboxWidget(this, 20, 60, 280, 20, "Unscaled main screen", 0, 'S');
- _twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 20, 75, 280, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
+ _leftHandedCheckbox = new GUI::CheckboxWidget(this, 20, 30, 200, 20, "Left handed mode", 0, 'L');
+ _indyFightCheckbox = new GUI::CheckboxWidget(this, 20, 45, 200, 20, "Indy fighting controls", 0, 'I');
+ _unscaledCheckbox = new GUI::CheckboxWidget(this, 20, 60, 200, 20, "Unscaled main screen", 0, 'S');
+ _twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 20, 75, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
+ _highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 20, 90, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
- new GUI::StaticTextWidget(this, 20, 90, 110, 20, "Touch X Offset", GUI::kTextAlignLeft);
- _touchX = new GUI::SliderWidget(this, 130, 90, 130, 12, 1);
+ new GUI::StaticTextWidget(this, 20, 110, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
+ _touchX = new GUI::SliderWidget(this, 130, 110, 130, 12, 1);
_touchX->setMinValue(-8);
_touchX->setMaxValue(+8);
_touchX->setValue(0);
_touchX->setFlags(GUI::WIDGET_CLEARBG);
- new GUI::StaticTextWidget(this, 20, 110, 110, 20, "Touch Y Offset", GUI::kTextAlignLeft);
- _touchY = new GUI::SliderWidget(this, 130, 110, 130, 12, 2);
+ new GUI::StaticTextWidget(this, 20, 125, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
+ _touchY = new GUI::SliderWidget(this, 130, 125, 130, 12, 2);
_touchY->setMinValue(-8);
_touchY->setMaxValue(+8);
_touchY->setValue(0);
_touchY->setFlags(GUI::WIDGET_CLEARBG);
- new GUI::StaticTextWidget(this, 130 + 65 - 10, 130, 20, 20, "0", GUI::kTextAlignCenter);
- new GUI::StaticTextWidget(this, 130 + 130 - 10, 130, 20, 20, "8", GUI::kTextAlignCenter);
- new GUI::StaticTextWidget(this, 130 - 10, 130, 20, 20, "-8", GUI::kTextAlignCenter);
+ new GUI::StaticTextWidget(this, 130 + 65 - 10, 140, 20, 15, "0", GUI::kTextAlignCenter);
+ new GUI::StaticTextWidget(this, 130 + 130 - 10, 140, 20, 15, "8", GUI::kTextAlignCenter);
+ new GUI::StaticTextWidget(this, 130 - 10, 140, 20, 15, "-8", GUI::kTextAlignCenter);
#ifdef DS_SCUMM_BUILD
_delDialog = new Scumm::SaveLoadChooser("Delete game:", "Delete", false, Scumm::g_scumm);
@@ -92,6 +93,12 @@
_twoHundredPercentCheckbox->setState(false);
}
+ if (ConfMan.hasKey("22khzaudio", "ds")) {
+ _highQualityAudioCheckbox->setState(ConfMan.getBool("22khzaudio", "ds"));
+ } else {
+ _highQualityAudioCheckbox->setState(false);
+ }
+
_indyFightCheckbox->setState(DS::getIndyFightState());
if (ConfMan.hasKey("xoffset", "ds")) {
@@ -112,6 +119,7 @@
ConfMan.setBool("lefthanded", _leftHandedCheckbox->getState(), "ds");
ConfMan.setBool("unscaled", _unscaledCheckbox->getState(), "ds");
ConfMan.setBool("twohundredpercent", _twoHundredPercentCheckbox->getState(), "ds");
+ ConfMan.setBool("22khzaudio", _highQualityAudioCheckbox->getState(), "ds");
ConfMan.setInt("xoffset", _touchX->getValue(), "ds");
ConfMan.setInt("yoffset", _touchY->getValue(), "ds");
DS::setOptions();
Modified: scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.h
===================================================================
--- scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.h 2006-10-07 15:32:21 UTC (rev 24170)
+++ scummvm/branches/branch-0-9-0/backends/ds/arm9/source/dsoptions.h 2006-10-07 15:34:06 UTC (rev 24171)
@@ -49,6 +49,7 @@
GUI::CheckboxWidget* _unscaledCheckbox;
GUI::CheckboxWidget* _twoHundredPercentCheckbox;
GUI::CheckboxWidget* _indyFightCheckbox;
+ GUI::CheckboxWidget* _highQualityAudioCheckbox;
#ifdef DS_SCUMM_BUILD
Scumm::SaveLoadChooser* _delDialog;
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list