Commit 35c6ff41 authored by Sergio Costas's avatar Sergio Costas

Using STRING for OSD

parent 9501953f
......@@ -37,7 +37,7 @@ Z80free_codesFDCB.o: z80free/Z80free_codesFDCB.c z80free/Z80free.h
cargador.o: cargador.cpp emulator.hh z80free/Z80free.h computer.hh llscreen.hh tape.hh cargador.hh
$(CPP) $(CPPFLAGS) -o cargador.o cargador.cpp
computer.o: computer.cpp tape.hh emulator.hh z80free/Z80free.h computer.hh llscreen.hh spk_ay.hh sound.hh microdrive.hh menus.hh
computer.o: computer.cpp z80free/Z80free.h computer.hh llscreen.hh emulator.hh tape.hh spk_ay.hh sound.hh microdrive.hh menus.hh
$(CPP) $(CPPFLAGS) -o computer.o computer.cpp
emulator.o: emulator.cpp sound.hh microdrive.hh z80free/Z80free.h menus.hh llscreen.hh emulator.hh computer.hh tape.hh cargador.hh
......
......@@ -17,14 +17,12 @@
*
*/
#include "computer.hh"
#include "z80free/Z80free.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include <sstream>
#include "emulator.hh"
#include "llscreen.hh"
......@@ -33,6 +31,9 @@
#include "sound.hh"
#include "spk_ay.hh"
#include "tape.hh"
#include "computer.hh"
#include "z80free/Z80free.h"
/* Returns the bus value when reading a port without a periferial */
......@@ -82,7 +83,7 @@ void computer_init () {
ordenador.tape_fast_load = true; // fast load by default
ordenador.osd_text[0] = 0;
ordenador.osd_text = "";
ordenador.osd_time = 0;
ordenador.other_ret = 0;
......@@ -550,7 +551,7 @@ void read_keyboard (SDL_Event *pevento2) {
if ((pevento->type==SDL_KEYUP)&&(temporal_io==SDLK_TAB)) {
if (ordenador.tab_extended==0) {
ordenador.tab_extended=1;
strcpy(ordenador.osd_text,"Function Key mode on");
ordenador.osd_text = "Function Key mode on";
ordenador.osd_time=100;
return;
} else {
......@@ -612,7 +613,7 @@ void read_keyboard (SDL_Event *pevento2) {
case SDLK_ESCAPE: // to exit from the emulator
if (ordenador.esc_again==0) {
ordenador.esc_again=1;
strcpy(ordenador.osd_text,"ESC again to exit");
ordenador.osd_text = "ESC again to exit";
ordenador.osd_time=100;
} else
salir = 0;
......@@ -649,17 +650,26 @@ void read_keyboard (SDL_Event *pevento2) {
break;
case SDLK_F11: // lower volume
if (ordenador.volume > 3)
if (ordenador.volume > 3) {
set_volume (ordenador.volume - 4);
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume / 4);
ordenador.osd_time = 50;
}
{
std::ostringstream stringStream;
stringStream << " Volume: " << ordenador.volume/4 << " ";
ordenador.osd_text = stringStream.str();
ordenador.osd_time = 50;
}
break;
case SDLK_F12: // upper volume
set_volume (ordenador.volume + 4);
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume / 4);
ordenador.osd_time = 50;
break;
{
std::ostringstream stringStream;
stringStream << " Volume: " << ordenador.volume/4 << " ";
ordenador.osd_text = stringStream.str();
ordenador.osd_time = 50;
}
break;
}
// reorder joystick if screen is rotated
......
......@@ -153,7 +153,7 @@ struct computer {
// OSD global variables
char osd_text[200];
string osd_text;
unsigned int osd_time;
// pagination global variables
......
......@@ -573,7 +573,7 @@ int main(int argc,char *argv[]) {
llscreen->clear_screen();
if (sound_aborted==1) {
strcpy(ordenador.osd_text,"Running without sound (read the FAQ)");
ordenador.osd_text = "Running without sound (read the FAQ)";
ordenador.osd_time=100;
}
......@@ -582,7 +582,7 @@ int main(int argc,char *argv[]) {
load_main_game(gamefile);
printf("Modo: %d\n",ordenador.mode128k);
sprintf(ordenador.osd_text,"Press F1 for help");
ordenador.osd_text = "Press F1 for help";
ordenador.osd_time=200;
printf("BPP: %d\n",llscreen->bpp);
......@@ -606,7 +606,7 @@ int main(int argc,char *argv[]) {
if(ordenador.current_tap != "") {
do_fast_load();
} else {
sprintf(ordenador.osd_text,"No TAP/TZX file selected");
ordenador.osd_text = "No TAP/TZX file selected";
ordenador.osd_time=50;
}
}
......@@ -679,13 +679,13 @@ void do_fast_load() {
procesador.Rm.br.F &= (~F_C); // Load error
procesador.Rm.wr.IX += procesador.Rm.wr.DE;
procesador.Rm.wr.DE = 0;
sprintf (ordenador.osd_text, "No tape selected");
ordenador.osd_text = "No tape selected";
ordenador.osd_time = 100;
return;
break;
case FASTLOAD_NO_BLOCK:
ordenador.other_ret = 0; // next instruction must NOT be RET
sprintf (ordenador.osd_text, "Can't do fast load. Press F6 to play");
ordenador.osd_text = "Can't do fast load. Press F6 to play";
ordenador.osd_time = 100;
return;
break;
......@@ -693,7 +693,7 @@ void do_fast_load() {
procesador.Rm.br.F &= (~F_C); // Load error
procesador.Rm.wr.IX += procesador.Rm.wr.DE;
procesador.Rm.wr.DE = 0;
sprintf (ordenador.osd_text, "End of tape. Rewind it.");
ordenador.osd_text = "End of tape. Rewind it.";
ordenador.osd_time = 100;
return;
case FASTLOAD_OK:
......
......@@ -579,7 +579,7 @@ void taps_menu() {
fin=0;
ordenador.OOTape.set_pause(true);
ordenador.OOTape.rewind();
sprintf(ordenador.osd_text,"Tape rewinded");
ordenador.osd_text = "Tape rewinded";
ordenador.osd_time=50;
break;
case SDLK_3:
......@@ -1412,7 +1412,7 @@ void load_scrfile() {
return;
}
ordenador.osd_text[0]=0;
ordenador.osd_text = "";
fichero=fopen(filename,"rb");
retorno=0;
if (!fichero) {
......
......@@ -130,7 +130,7 @@ void microdrive_out(word Port,byte Value) {
if(ordenador.mdr_modified) { // if the cartridge has been modified, we store it in hard disk
ordenador.mdr_file=fopen(ordenador.mdr_current_mdr,"wb"); // create for write
if(ordenador.mdr_file==NULL) {
sprintf(ordenador.osd_text,"Can't store the cartridge");
ordenador.osd_text = "Can't store the cartridge";
ordenador.osd_time=150;
} else {
fwrite(ordenador.mdr_cartridge,137923,1,ordenador.mdr_file); // save cartridge
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment