mirror of https://github.com/stella-emu/stella.git
added messages for Kid Vid
This commit is contained in:
parent
2027882c77
commit
9d6cee710e
|
@ -1028,8 +1028,15 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Controller::Type::KidVid:
|
case Controller::Type::KidVid:
|
||||||
controller = make_unique<KidVid>(port, myEvent, myOSystem, *mySystem, romMd5);
|
{
|
||||||
|
Controller::onMessageCallbackForced callback = [&os = myOSystem](const string& msg, bool force) {
|
||||||
|
bool devSettings = os.settings().getBool("dev.settings");
|
||||||
|
if(force || os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
|
||||||
|
os.frameBuffer().showTextMessage(msg);
|
||||||
|
};
|
||||||
|
controller = make_unique<KidVid>(port, myEvent, myOSystem, *mySystem, romMd5, callback);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case Controller::Type::MindLink:
|
case Controller::Type::MindLink:
|
||||||
controller = make_unique<MindLink>(port, myEvent, *mySystem);
|
controller = make_unique<MindLink>(port, myEvent, *mySystem);
|
||||||
|
|
|
@ -115,6 +115,7 @@ class Controller : public Serializable
|
||||||
Callback type for general controller messages
|
Callback type for general controller messages
|
||||||
*/
|
*/
|
||||||
using onMessageCallback = std::function<void(const string&)>;
|
using onMessageCallback = std::function<void(const string&)>;
|
||||||
|
using onMessageCallbackForced = std::function<void(const string&, bool force)>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
KidVid::KidVid(Jack jack, const Event& event, const OSystem& osystem,
|
KidVid::KidVid(Jack jack, const Event& event, const OSystem& osystem,
|
||||||
const System& system, const string& romMd5)
|
const System& system, const string& romMd5,
|
||||||
|
const onMessageCallbackForced& callback)
|
||||||
: Controller(jack, event, system, Controller::Type::KidVid),
|
: Controller(jack, event, system, Controller::Type::KidVid),
|
||||||
myEnabled{myJack == Jack::Right},
|
myEnabled{myJack == Jack::Right},
|
||||||
myOSystem{osystem}
|
myOSystem{osystem},
|
||||||
|
myCallback{callback}
|
||||||
{
|
{
|
||||||
// Right now, there are only two games that use the KidVid
|
// Right now, there are only two games that use the KidVid
|
||||||
if(romMd5 == "ee6665683ebdb539e89ba620981cb0f6")
|
if(romMd5 == "ee6665683ebdb539e89ba620981cb0f6")
|
||||||
|
@ -115,10 +117,21 @@ void KidVid::update()
|
||||||
}
|
}
|
||||||
if(myTape)
|
if(myTape)
|
||||||
{
|
{
|
||||||
|
static constexpr uInt32 gameNumber[4] = { 3, 1, 2, 3 };
|
||||||
|
static constexpr const char* gameName[6] = {
|
||||||
|
"Harmony Smurf", "Handy Smurf", "Greedy Smurf",
|
||||||
|
"Big Number Hunt", "Great Letter Roundup", "Spooky Spelling Bee"
|
||||||
|
};
|
||||||
|
|
||||||
myIdx = myGame == Game::BBears ? NumBlockBits : 0; // KVData48/KVData44
|
myIdx = myGame == Game::BBears ? NumBlockBits : 0; // KVData48/KVData44
|
||||||
myBlockIdx = NumBlockBits;
|
myBlockIdx = NumBlockBits;
|
||||||
myBlock = 0;
|
myBlock = 0;
|
||||||
openSampleFiles();
|
openSampleFiles();
|
||||||
|
|
||||||
|
ostringstream msg;
|
||||||
|
msg << "Game #" << gameNumber[myTape - 1] << " - \""
|
||||||
|
<< gameName[gameNumber[myTape - 1] + (myGame == Game::Smurfs ? -1 : 2)] << "\"";
|
||||||
|
myCallback(msg.str(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,6 +294,10 @@ void KidVid::setNextSong()
|
||||||
const string& fileName = (temp < 10) ? "KVSHARED.WAV" : getFileName();
|
const string& fileName = (temp < 10) ? "KVSHARED.WAV" : getFileName();
|
||||||
myOSystem.sound().playWav(myOSystem.baseDir().getPath() + fileName,
|
myOSystem.sound().playWav(myOSystem.baseDir().getPath() + fileName,
|
||||||
ourSongStart[temp], mySongLength);
|
ourSongStart[temp], mySongLength);
|
||||||
|
ostringstream msg;
|
||||||
|
msg << "Read song #" << mySongPointer << " (" << fileName << ")";
|
||||||
|
myCallback(msg.str(), false);
|
||||||
|
|
||||||
#ifdef DEBUG_BUILD
|
#ifdef DEBUG_BUILD
|
||||||
cerr << fileName << ": " << (ourSongPositions[mySongPointer] & 0x7f) << endl;
|
cerr << fileName << ": " << (ourSongPositions[mySongPointer] & 0x7f) << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,9 +46,11 @@ class KidVid : public Controller
|
||||||
@param osystem The OSystem object to use
|
@param osystem The OSystem object to use
|
||||||
@param system The system using this controller
|
@param system The system using this controller
|
||||||
@param romMd5 The md5 of the ROM using this controller
|
@param romMd5 The md5 of the ROM using this controller
|
||||||
|
@param callback Called to pass messages back to the parent controller
|
||||||
*/
|
*/
|
||||||
KidVid(Jack jack, const Event& event, const OSystem& osystem,
|
KidVid(Jack jack, const Event& event, const OSystem& osystem,
|
||||||
const System& system, const string& romMd5);
|
const System& system, const string& romMd5,
|
||||||
|
const onMessageCallbackForced& callback);
|
||||||
~KidVid() override = default;
|
~KidVid() override = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -118,6 +120,9 @@ class KidVid : public Controller
|
||||||
|
|
||||||
const OSystem& myOSystem;
|
const OSystem& myOSystem;
|
||||||
|
|
||||||
|
// Sends messages back to the parent class
|
||||||
|
Controller::onMessageCallbackForced myCallback;
|
||||||
|
|
||||||
// Indicates if the sample files have been found
|
// Indicates if the sample files have been found
|
||||||
bool myFilesFound{false};
|
bool myFilesFound{false};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue