Skip to content

Commit

Permalink
Merge branch 'main' into debugger-start
Browse files Browse the repository at this point in the history
  • Loading branch information
emoon committed Sep 28, 2024
2 parents 64977e5 + c0f2882 commit 8f4b93b
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:
linux_ubuntu_22_04:
name: (Ubuntu 22.04) GCC ${{ matrix.gcc-version }}.x
runs-on: ubuntu-22.04
name: (Ubuntu 24.04) GCC ${{ matrix.gcc-version }}.x
runs-on: ubuntu-24.04
strategy:
matrix:
gcc-version: [11, 12, 13]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ packages.config
*.d
temp
output
build/
86 changes: 86 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},
{
"name": "OTHER_VALUE",
"value": "Something something"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},
{
"name": "OTHER_VALUE",
"value": "Something something"
}
],
"externalConsole": false,
"MIMode": "lldb"
},
{
"name": "(msvc) Launch",
"type": "cppvsdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},
{
"name": "OTHER_VALUE",
"value": "Something something"
}
],
"externalConsole": false
}
]
}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ add_executable(quaesar
uae_src/scsi.cpp
uae_src/scsiemul.cpp
uae_src/scsitape.cpp
uae_src/serial.cpp
uae_src/sndboard.cpp
uae_src/statusline.cpp
uae_src/tabletlibrary.cpp
Expand Down
83 changes: 31 additions & 52 deletions src/dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool specialmonitor_need_genlock() {
}

void setmouseactive(int, int) {
//UNIMPLEMENTED();
// UNIMPLEMENTED();
}

void screenshot(int monid, int, int) {
Expand Down Expand Up @@ -142,7 +142,7 @@ static void dummy_close(void) {

// Dummy function to acquire an input device
static int dummy_acquire(int device_id, int exclusive) {
//UNIMPLEMENTED();
// UNIMPLEMENTED();
return 0; // Return 0 for success, -1 for failure
}

Expand Down Expand Up @@ -450,7 +450,7 @@ void a4091_add_scsi_unit(int, uaedev_config_info*, romconfig*) {
UNIMPLEMENTED();
}
void activate_console() {
//UNIMPLEMENTED();
// UNIMPLEMENTED();
}

void alf3_add_scsi_unit(int, uaedev_config_info*, romconfig*) {
Expand Down Expand Up @@ -601,12 +601,17 @@ int compiler_init() {
}

void console_flush() {
//UNIMPLEMENTED();
fflush(stdout);
}

int console_get(char*, int) {
UNIMPLEMENTED();
return 0;
int console_get(char* out, int maxlen) {
TCHAR* res = fgets(out, maxlen, stdin);
if (res == NULL) {
return -1;
}

int len = strlen(out);
return len - 1;
}

bool console_isch() {
Expand Down Expand Up @@ -984,7 +989,10 @@ void unlockscr(struct vidbuffer* vb_in, int y_start, int y_end) {
// TODO: Fix me
exit(0);
break;
case SDL_KEYDOWN: // User presses a key
case SDL_KEYDOWN: // User presses a key
if (e.key.keysym.sym == SDLK_d) { // If the key is ESC
activate_debugger();
}
if (e.key.keysym.sym == SDLK_ESCAPE) { // If the key is ESC
quit_program == UAE_QUIT;
exit(0);
Expand Down Expand Up @@ -1105,7 +1113,6 @@ bool is_mainthread() {
}

bool ismouseactive() {
//UNIMPLEMENTED();
return false;
}

Expand Down Expand Up @@ -1384,42 +1391,25 @@ void scram5394_add_scsi_unit(int, uaedev_config_info*, romconfig*) {
UNIMPLEMENTED();
}

uae_u16 SERDATR() {
UNIMPLEMENTED();
return 0;
}

void SERDAT(uae_u16) {
UNIMPLEMENTED();
}

void serial_dtr_off() {
UNIMPLEMENTED();
}

void serial_exit() {
UNIMPLEMENTED();
void serial_uartbreak(int) {
// UNIMPLEMENTED();
}

void serial_hsynchandler() {
UNIMPLEMENTED();
}

void serial_init() {
UNIMPLEMENTED();
// UNIMPLEMENTED();
}

void serial_rbf_clear() {
UNIMPLEMENTED();
}

uae_u8 serial_readstatus(uae_u8, uae_u8) {
UNIMPLEMENTED();
return 0;
uae_u8 serial_readstatus(uae_u8 v, uae_u8) {
// UNIMPLEMENTED();
return v;
}

void serial_rethink() {
UNIMPLEMENTED();
serial_flush_buffer();
}

void setup_brkhandler() {
Expand Down Expand Up @@ -1534,11 +1524,11 @@ int target_get_volume_name(uaedev_mount_info*, uaedev_config_info*, bool, bool,
#endif

void target_inputdevice_acquire() {
//UNIMPLEMENTED();
// UNIMPLEMENTED();
}

void target_inputdevice_unacquire() {
//UNIMPLEMENTED();
// UNIMPLEMENTED();
}

bool target_isrelativemode() {
Expand Down Expand Up @@ -1592,8 +1582,10 @@ void toggle_mousegrab() {
UNIMPLEMENTED();
}

void to_upper(char*, int) {
UNIMPLEMENTED();
void to_upper(char* s, int len) {
for (int i = 0; i < len; i++) {
s[i] = toupper(s[i]);
}
}

uae_u32 trifecta_ncr9x_scsi_get(unsigned int, int) {
Expand Down Expand Up @@ -1676,7 +1668,7 @@ bool uae_slirp_start() {
}

void update_debug_info() {
//UNIMPLEMENTED();
// UNIMPLEMENTED();
}

void updatedisplayarea(int) {
Expand Down Expand Up @@ -1902,19 +1894,6 @@ uae_u8* save_cdtv(size_t*, uae_u8*) {
return nullptr;
}

void serial_uartbreak(int) {
UNIMPLEMENTED();
}

uae_u8 serial_writestatus(uae_u8, uae_u8) {
UNIMPLEMENTED();
return 0;
}

void SERPER(unsigned short) {
UNIMPLEMENTED();
}

int set_cache_state(int) {
UNIMPLEMENTED();
return 0;
Expand All @@ -1925,7 +1904,7 @@ void setcapslockstate(int) {
}

void setmouseactivexy(int, int, int, int) {
UNIMPLEMENTED();
// UNIMPLEMENTED();
}

uae_u32 squirrel_ncr9x_scsi_get(unsigned int, int) {
Expand Down
1 change: 0 additions & 1 deletion src/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ int vsync_activeheight, vsync_totalheight;
int max_uae_width = 8192, max_uae_height = 8192;
int saveimageoriginalpath;
float vsync_vblank, vsync_hblank;
uae_u16 serper, serdat, serdatr;

// related to GSYNC/VSYNC
int target_get_display_scanline2(int displayindex) {
Expand Down
2 changes: 2 additions & 0 deletions src/parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ struct Options {
std::string input;
// kickstart file such as kick.rom, kick31.rom, etc.
std::string kickstart;
// serial port path ('/tmp/virtual-serial-port')
std::string serial_port;
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 6 additions & 0 deletions src/quaesar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int main(int argc, char** argv) {

app.add_option("input", options.input, "Executable or image file (adf, dms)")->check(CLI::ExistingFile);
app.add_option("-k,--kickstart", options.kickstart, "Path to the kickstart ROM")->check(CLI::ExistingFile);
app.add_option("--serial_port", options.serial_port, "Serial port path");
CLI11_PARSE(app, argc, argv);

keyboard_settrans();
Expand All @@ -61,6 +62,11 @@ int main(int argc, char** argv) {
}
}

if (!options.serial_port.empty()) {
currprefs.use_serial = 1;
strcpy(currprefs.sername, options.serial_port.c_str());
}

// Most compatible mode
currprefs.cpu_cycle_exact = 1;
currprefs.cpu_memory_cycle_exact = 1;
Expand Down
24 changes: 22 additions & 2 deletions src/sounddep/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,24 @@ void resume_sound_device(struct sound_data* sd) {
sd->paused = 0;
}

int get_default_audio_device() {
int device_idx = -1;
#if SDL_VERSION_ATLEAST(2, 24, 0)
SDL_AudioSpec spec;
char* default_device_name = nullptr;
if (SDL_GetDefaultAudioInfo(&default_device_name, &spec, 0) == 0) {
for (int i = 0; i < num_sound_devices; i++) {
if (strcmp(sound_devices[i]->name, default_device_name) != 0)
continue;
device_idx = i;
break;
}
SDL_free(default_device_name);
}
#endif
return device_idx;
}

static int open_sound() {
auto size = currprefs.sound_maxbsiz;

Expand All @@ -379,10 +397,12 @@ static int open_sound() {

sdp->softvolume = -1;
int num = enumerate_sound_devices();
if (currprefs.win32_soundcard >= num)
currprefs.win32_soundcard = changed_prefs.win32_soundcard = 0;
if (num == 0)
return 0;
if (currprefs.win32_soundcard < 0)
currprefs.win32_soundcard = changed_prefs.win32_soundcard = get_default_audio_device();
if ((unsigned)currprefs.win32_soundcard >= (unsigned)num)
currprefs.win32_soundcard = changed_prefs.win32_soundcard = 0;
const auto ch = get_audio_nativechannels(active_sound_stereo);
const auto ret = open_sound_device(sdp, currprefs.win32_soundcard, size, currprefs.sound_freq, ch);
if (!ret)
Expand Down
4 changes: 2 additions & 2 deletions src/sysconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
// #define D3D /* D3D display filter support */
#define PARALLEL_PORT /* parallel port emulation */
#define PARALLEL_DIRECT /* direct parallel port emulation */
// #define SERIAL_PORT /* serial port emulation */
#define SERIAL_ENET /* serial port UDP transport */
#define SERIAL_PORT /* serial port emulation */
#define SERIAL_ENET /* serial port UDP transport */
// #define SCSIEMU /* uaescsi.device emulation */
// #define UAESERIAL /* uaeserial.device emulation */
#define FPUEMU /* FPU emulation */
Expand Down
1 change: 1 addition & 0 deletions uae_src/cfgfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8389,6 +8389,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
p->keyboard_connected = true;

p->produce_sound = 3;
p->win32_soundcard = -1;
p->sound_stereo = SND_STEREO;
p->sound_stereo_separation = 7;
p->sound_mixed_stereo_delay = 0;
Expand Down
Loading

0 comments on commit 8f4b93b

Please sign in to comment.