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 Mar 29, 2024
2 parents 29f8b6c + cd3a5e1 commit 6145f5a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 62 deletions.
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_subdirectory(external/ADFlib)
add_subdirectory(external/dear_imgui)
add_subdirectory(external/capstone)

if (APPLE OR LINUX)
if (APPLE OR LINUX OR UNIX)
find_package(SDL2 REQUIRED)
endif()

Expand Down Expand Up @@ -198,11 +198,7 @@ add_executable(quaesar
uae_src/blit.h
)

# Recursively glob for all .cpp files in the src directory
file(GLOB_RECURSE CROSS_FILES "src/*.cpp")
target_sources(quaesar PRIVATE ${CROSS_FILES})

if (APPLE OR LINUX)
if (APPLE OR LINUX OR UNIX)
target_compile_options(quaesar PRIVATE -DUAE=1 -D_cdecl= -DFILEFLAG_WRITE=1 -DOS_NAME=\"linux\")
target_compile_options(quaesar PRIVATE -DUSHORT=uint16_t -DHWND=uint32_t -DHRESULT=uint32_t -DWPARAM=uint16_t -DLPARAM=uint32_t)
target_compile_definitions(quaesar PRIVATE FSUAE)
Expand All @@ -225,7 +221,7 @@ if (APPLE)
target_compile_options(quaesar PRIVATE -DFILEFLAG_DIR=1 -DFILEFLAG_DIR=1 -D_ftelli64=ftell -D_fseeki64=fseek -D_fseeko64=fseeko -Dfseeko64=fseeko -Dftello64=ftell)
endif()

if (LINUX)
if (LINUX OR UNIX)
target_compile_options(quaesar PRIVATE -DFILEFLAG_DIR=1 -D_ftelli64=ftello64 -D_fseeki64=fseeko64)
target_link_libraries(quaesar PRIVATE dl)
endif()
Expand Down
22 changes: 11 additions & 11 deletions src/dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,23 +779,28 @@ void fastlane_add_scsi_unit(int, uaedev_config_info*, romconfig*) {
UNIMPLEMENTED();
}

void fetch_inputfilepath(char*, int) {
void fetch_inputfilepath(char* out, int) {
*out = 0;
UNIMPLEMENTED();
}

void fetch_ripperpath(char*, int) {
void fetch_ripperpath(char* out, int) {
*out = 0;
UNIMPLEMENTED();
}

void fetch_rompath(char*, int) {
void fetch_rompath(char* out, int) {
*out = 0;
UNIMPLEMENTED();
}

void fetch_saveimagepath(char*, int, int) {
void fetch_saveimagepath(char* out, int, int) {
*out = 0;
TRACE();
}

void fetch_videopath(char*, int) {
void fetch_videopath(char* out, int) {
*out = 0;
UNIMPLEMENTED();
}

Expand Down Expand Up @@ -877,7 +882,6 @@ void golemfast_ncr9x_scsi_put(unsigned int, unsigned int, int) {
}

SDL_Window* s_window;
SDL_Surface* s_window_surface;
SDL_Texture* s_texture = nullptr;
SDL_Renderer* s_renderer = nullptr;
static Debugger* s_debugger = nullptr;
Expand Down Expand Up @@ -955,11 +959,7 @@ int graphics_init(bool) {

alloc_colors64k(0, bits, bits, bits, red_shift, green_shift, blue_shift, bits, 24, 0, 0, false);

// Get the window surface
s_window_surface = SDL_GetWindowSurface(s_window);

s_debugger = Debugger_create();

TRACE();
return 1;
}
Expand Down Expand Up @@ -1021,7 +1021,7 @@ void unlockscr(struct vidbuffer* vb_in, int y_start, int y_end) {

// Change pixels
for (int y = 0; y < amiga_height; y++) {
uint8_t* dest = (uint8_t*)&pixels[y * s_window_surface->w];
uint8_t* dest = (uint8_t*)&pixels[y * 754];
memcpy(dest, sptr, amiga_width * 4);
sptr += vb->rowbytes;
}
Expand Down
28 changes: 28 additions & 0 deletions src/machdep/maccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ STATIC_INLINE void do_put_mem_byte(uae_u8* a, uae_u8 v) {

#ifdef _WIN32

#ifdef HAVE_MOVBE
#include <immintrin.h>

STATIC_INLINE uae_u64 do_get_mem_quad(uae_u64* a) {
Expand All @@ -49,6 +50,33 @@ STATIC_INLINE void do_put_mem_long(uae_u32* a, uae_u32 v) {
STATIC_INLINE void do_put_mem_word(uae_u16* a, uae_u16 v) {
_store_be_u16(a, v);
}
#else /* HAVE_MOVBE */

STATIC_INLINE uae_u64 do_get_mem_quad(uae_u64* a) {
return _byteswap_uint64(*a);
}

STATIC_INLINE uae_u32 do_get_mem_long(uae_u32* a) {
return _byteswap_ulong(*a);
}

STATIC_INLINE uae_u16 do_get_mem_word(uae_u16* a) {
return _byteswap_ushort(*a);
}

STATIC_INLINE void do_put_mem_quad(uae_u64* a, uae_u64 v) {
*a = _byteswap_uint64(v);
}

STATIC_INLINE void do_put_mem_long(uae_u32* a, uae_u32 v) {
*a = _byteswap_ulong(v);
}

STATIC_INLINE void do_put_mem_word(uae_u16* a, uae_u16 v) {
*a = _byteswap_ushort(v);
}

#endif /* HAVE_MOVBE */

STATIC_INLINE uae_u64 do_byteswap_64(uae_u64 v) {
return _byteswap_uint64(v);
Expand Down
16 changes: 8 additions & 8 deletions src/quaesar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ int main(int argc, char** argv) {
Options options;
CLI::App app{"Quaesar"};

Adf::create_for_exefile("test.exe");

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);
CLI11_PARSE(app, argc, argv);
Expand All @@ -53,12 +51,14 @@ int main(int argc, char** argv) {
default_prefs(&currprefs, true, 0);
fixup_prefs(&currprefs, true);

// TODO: cleanup
if (ends_with(options.input.c_str(), ".exe") || !ends_with(options.input.c_str(), ".adf")) {
Adf::create_for_exefile(options.input.c_str());
strcpy(currprefs.floppyslots[0].df, "dummy.adf");
} else {
strcpy(currprefs.floppyslots[0].df, options.input.c_str());
if (!options.input.empty()) {
// TODO: cleanup
if (ends_with(options.input.c_str(), ".exe") || !ends_with(options.input.c_str(), ".adf")) {
Adf::create_for_exefile(options.input.c_str());
strcpy(currprefs.floppyslots[0].df, "dummy.adf");
} else {
strcpy(currprefs.floppyslots[0].df, options.input.c_str());
}
}

// Most compatible mode
Expand Down
75 changes: 39 additions & 36 deletions uae_src/specialmonitors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2524,17 +2524,20 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double
genlock_image_file[0] = 0;
}

if (avidinfo->ychange == 1)
if (avidinfo->ychange == 1) {
vdbl = 0; // double
else
} else {
vdbl = 1; // single
doublelines = false;
}

if (avidinfo->xchange == 1)
if (avidinfo->xchange == 1) {
hdbl = 0; // shres
else if (avidinfo->xchange == 2)
} else if (avidinfo->xchange == 2) {
hdbl = 1; // hires
else
} else {
hdbl = 2; // lores
}

get_mode_blanking_limits(&xstart, &xend, &ystart, &yend);

Expand Down Expand Up @@ -2614,7 +2617,7 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double

uae_u8 r = 0, g = 0, b = 0, a = 0;
for (y = ystart; y < yend; y++) {
int yoff = (y * 2 + oddlines) - src->yoffset;
int yoff = ((y * 2 + oddlines) - src->yoffset) >> vdbl;
if (yoff < 0)
continue;
if (yoff >= src->inheight)
Expand All @@ -2625,13 +2628,13 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double
bool ztoggle = false;
uae_u8 *line = src->bufmem + yoff * src->rowbytes;
uae_u8 *lineprev = yoff > 0 ? src->bufmem + (yoff - 1) * src->rowbytes : NULL;
uae_u8 *dstline = dst->bufmem + ((y * 2 + oddlines) - dst->yoffset) * dst->rowbytes;
uae_u8 *dstline = dst->bufmem + (((y * 2 + oddlines) - dst->yoffset) >> vdbl) * dst->rowbytes;
uae_u8 *line_genlock = row_map_genlock[yoff];
int gy = ((y * 2 + oddlines) - src->yoffset + offsety - gen_yoffset) * deltay / 65536;
int gy = (((y * 2 + oddlines) - src->yoffset + offsety - gen_yoffset) >> vdbl) * deltay / 65536;
if (genlock_image_upsidedown)
gy = (genlock_image_height - 1) - gy;
uae_u8 *image_genlock = genlock_image + gy * genlock_image_pitch;
r = g = b;
r = g = b = 0;
a = amix1;
noise_add = (quickrand() & 15) | 1;
uae_u8 *s = line;
Expand All @@ -2641,37 +2644,37 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double
for (x = 0; x < src->inwidth; x++) {
uae_u8 *s2 = s + src->rowbytes;
uae_u8 *d2 = d + dst->rowbytes;
if (x < hblank_left_start || x >= hblank_right_stop)
continue;
if ((!zclken && is_transparent(*s_genlock)) || (zclken && ztoggle)) {
a = amix2;
if (genlock_error) {
r = 0x00;
g = 0x00;
b = 0xdd;
} else if (genlock_blank) {
r = g = b = 0;
} else if (genlock_image) {
int gx = (x + offsetx - gen_xoffset) * deltax / 65536;
if (gx >= 0 && gx < genlock_image_width && gy >= 0 && gy < genlock_image_height) {
uae_u8 *s_genlock_image = image_genlock + gx * genlock_image_pixbytes;
r = s_genlock_image[genlock_image_red_index];
g = s_genlock_image[genlock_image_green_index];
b = s_genlock_image[genlock_image_blue_index];
} else {
if (x >= hblank_left_start && x < hblank_right_stop) {
if ((!zclken && is_transparent(*s_genlock)) || (zclken && ztoggle)) {
a = amix2;
if (genlock_error) {
r = 0x00;
g = 0x00;
b = 0xdd;
} else if (genlock_blank) {
r = g = b = 0;
} else if (genlock_image) {
int gx = (x + offsetx - gen_xoffset) * deltax / 65536;
if (gx >= 0 && gx < genlock_image_width && gy >= 0 && gy < genlock_image_height) {
uae_u8 *s_genlock_image = image_genlock + gx * genlock_image_pixbytes;
r = s_genlock_image[genlock_image_red_index];
g = s_genlock_image[genlock_image_green_index];
b = s_genlock_image[genlock_image_blue_index];
} else {
r = g = b = 0;
}
} else {
r = g = b = get_noise();
}
if (mix2) {
r = (mix1 * r + mix2 * FVR(src, s)) / 256;
g = (mix1 * g + mix2 * FVG(src, s)) / 256;
b = (mix1 * b + mix2 * FVB(src, s)) / 256;
}
PUT_PRGBA(d, d2, dst, r, g, b, a, 0, doublelines, false);
} else {
r = g = b = get_noise();
PUT_AMIGARGBA(d, s, d2, s2, dst, 0, doublelines, false);
}
if (mix2) {
r = (mix1 * r + mix2 * FVR(src, s)) / 256;
g = (mix1 * g + mix2 * FVG(src, s)) / 256;
b = (mix1 * b + mix2 * FVB(src, s)) / 256;
}
PUT_PRGBA(d, d2, dst, r, g, b, a, 0, doublelines, false);
} else {
PUT_AMIGARGBA(d, s, d2, s2, dst, 0, doublelines, false);
}
s += src->pixbytes;
d += dst->pixbytes;
Expand Down

0 comments on commit 6145f5a

Please sign in to comment.