Skip to content

Commit c2a82c9

Browse files
authored
Merge pull request #273 from ThKattanek/working_branch
Working branch
2 parents 35cc6ee + b636948 commit c2a82c9

32 files changed

+254
-105
lines changed

create_linux_appimage.sh

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,51 @@
88
# // Dieser Sourcecode ist Copyright geschützt! //
99
# // Geistiges Eigentum von Th.Kattanek //
1010
# // //
11-
# // Letzte Änderung am 13.03.2023 //
11+
# // Letzte Änderung am 15.03.2026 //
1212
# // www.emu64-projekt.de //
1313
# // //
1414
# //////////////////////////////////////////////////
1515

1616
#!/bin/bash
17+
set -euo pipefail
18+
19+
usage() {
20+
echo "Usage: $0 --qt <QT_ROOT>" >&2
21+
echo " Beispiel: $0 --qt \"$HOME/Qt/6.6.2/gcc_64\"" >&2
22+
echo " oder: QT_ROOT=\"$HOME/Qt/6.6.2/gcc_64\" $0" >&2
23+
}
24+
25+
QT_ROOT="${QT_ROOT:-}"
26+
27+
# --qt <path> aus Argumenten lesen (optional)
28+
if [[ ${1:-} == "--qt" ]]; then
29+
QT_ROOT="${2:-}"
30+
shift 2 || true
31+
elif [[ ${1:-} == "-h" || ${1:-} == "--help" ]]; then
32+
usage
33+
exit 0
34+
fi
35+
36+
if [[ -z "$QT_ROOT" ]]; then
37+
echo "WARNUNG: Kein QT_ROOT angegeben." >&2
38+
usage
39+
exit 1
40+
fi
41+
42+
# Validierung
43+
if [[ ! -d "$QT_ROOT/bin" ]]; then
44+
echo "WARNUNG: Ungültiger QT_ROOT (bin fehlt): $QT_ROOT" >&2
45+
exit 1
46+
fi
47+
48+
if [[ ! -x "$QT_ROOT/bin/qmake" && ! -x "$QT_ROOT/bin/qt-cmake" ]]; then
49+
echo "WARNUNG: Kein qmake/qt-cmake in $QT_ROOT/bin gefunden: $QT_ROOT" >&2
50+
exit 1
51+
fi
52+
53+
# Qt nur für dieses Skript aktivieren
54+
export PATH="$QT_ROOT/bin:$PATH"
55+
export CMAKE_PREFIX_PATH="$QT_ROOT${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}"
1756

1857
# Version
1958
ARCH=x86_64
@@ -29,6 +68,7 @@ fi
2968
cd appimage
3069

3170
MYDIR="`cd $0; pwd`"
71+
echo "MYDIR is: " $MYDIR
3272

3373
mkdir build
3474

@@ -47,13 +87,13 @@ cp ../grafik/emu64.png ./AppDir
4787

4888
# linuxdeploy
4989
if [ ! -f ./linuxdeploy-x86_64.AppImage ]; then
50-
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
90+
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
5191
chmod u+x ./linuxdeploy-x86_64.AppImage
5292
fi
5393

5494
# linuxdeploy qt plugin
5595
if [ ! -f ./linuxdeploy-plugin-qt-x86_64.AppImage ]; then
56-
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
96+
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
5797
chmod u+x ./linuxdeploy-plugin-qt-x86_64.AppImage
5898
fi
5999

crossbuild-win-releases.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# // Dieser Sourcecode ist Copyright geschützt! //
99
# // Geistiges Eigentum von Th.Kattanek //
1010
# // //
11-
# // Letzte Änderung am 24.06.2023 //
11+
# // Letzte Änderung am 15.03.2026 //
1212
# // www.emu64-projekt.de //
1313
# // //
1414
# //////////////////////////////////////////////////
@@ -100,6 +100,12 @@ if [ $i686_ok ] && [ $x32 = true ]; then
100100
# compile ts files
101101
lrelease ../src/src.pro
102102

103+
# Alle PKG_CONFIG Pfade auf MXE umbiegen (hier für i686)
104+
export PKG_CONFIG="$mxe_path/usr/bin/i686-w64-mingw32.static-pkg-config"
105+
export PKG_CONFIG_LIBDIR="$mxe_path/usr/i686-w64-mingw32.static/lib/pkgconfig:$mxe_path/usr/i686-w64-mingw32.static/share/pkgconfig"
106+
export PKG_CONFIG_PATH="$PKG_CONFIG_LIBDIR"
107+
export PKG_CONFIG_SYSROOT_DIR="$mxe_path/usr/i686-w64-mingw32.static"
108+
103109
# execute qmake
104110
cd $build_i686_dir
105111
$i686_qmake PREFIX=$install_i686_dir QMAKE_LIBDIR=$i686_libpath ../..
@@ -157,6 +163,12 @@ if [ $x86_64_ok ] && [ $x64 = true ]; then
157163
# compile ts files
158164
lrelease ../src/src.pro
159165

166+
# Alle PKG_CONFIG Pfade auf MXE umbiegen (hier für i686)
167+
export PKG_CONFIG="$mxe_path/usr/bin/x86_64-w64-mingw32.static-pkg-config"
168+
export PKG_CONFIG_LIBDIR="$mxe_path/usr/x86_64-w64-mingw32.static/lib/pkgconfig:$mxe_path/usr/x86_64-w64-mingw32.static/share/pkgconfig"
169+
export PKG_CONFIG_PATH="$PKG_CONFIG_LIBDIR"
170+
export PKG_CONFIG_SYSROOT_DIR="$mxe_path/usr/x86_64-w64-mingw32.static"
171+
160172
# execute qmake
161173
cd $build_x86_64_dir
162174
$x86_64_qmake PREFIX=$install_x86_64_dir QMAKE_LIBDIR=$x86_64_libpath ../..

src/c64_class.cpp

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ C64Class::C64Class(int *ret_error, int soundbuffer_size, VideoCrtClass *video_cr
7575

7676
this->start_minimized = start_minimized;
7777

78+
LimitCyclesEvent = nullptr;
79+
DebugCartEvent = nullptr;
80+
7881
changed_graphic_modi = false;
7982
changed_window_pos = false;
8083
changed_window_size = false;
@@ -95,6 +98,9 @@ C64Class::C64Class(int *ret_error, int soundbuffer_size, VideoCrtClass *video_cr
9598

9699
warp_mode = false;
97100

101+
enable_debug_cart = false;
102+
is_wtite_to_debug_cart = false;
103+
98104
LogText = log_function;
99105

100106
enable_mouse_1351 = false;
@@ -606,11 +612,26 @@ C64Class::~C64Class()
606612
if(crt != nullptr) delete crt;
607613
if(reu != nullptr) delete reu;
608614
if(geo != nullptr) delete geo;
615+
if(tape != nullptr) delete tape;
609616

610617
if(video_capture != nullptr) delete video_capture;
611618

612619
if(audio_16bit_buffer != nullptr)
613620
delete [] audio_16bit_buffer;
621+
622+
SDL_FreeSurface(img_joy_arrow0);
623+
SDL_FreeSurface(img_joy_arrow1);
624+
SDL_FreeSurface(img_joy_button0);
625+
SDL_FreeSurface(img_joy_button1);
626+
SDL_FreeSurface(sdl_window_icon);
627+
628+
if(screenshot_dir != nullptr) delete[] screenshot_dir;
629+
630+
if(mutex1 != nullptr)
631+
{
632+
SDL_DestroyMutex(mutex1);
633+
mutex1 = nullptr;
634+
}
614635
}
615636

616637
void C64Class::StartEmulation()
@@ -659,6 +680,8 @@ void C64Class::EndEmulation()
659680
time_out--;
660681
}
661682

683+
SDL_DetachThread(sdl_thread);
684+
662685
SDL_PauseAudioDevice(audio_dev, 1);
663686
if(audio_dev > 0) SDL_CloseAudioDevice(audio_dev);
664687

@@ -673,7 +696,7 @@ void C64Class::SetLimitCycles(int nCycles)
673696

674697
void C64Class::SetEnableDebugCart(bool enable)
675698
{
676-
cpu->SetEnableDebugCart(enable);
699+
enable_debug_cart = enable;
677700
}
678701

679702
void AudioMix(void *not_used, Uint8 *stream, int laenge)
@@ -693,11 +716,14 @@ void AudioMix(void *not_used, Uint8 *stream, int laenge)
693716
int SDLThreadWarp(void *userdat)
694717
{
695718
C64Class *c64 = static_cast<C64Class*>(userdat);
719+
c64->warp_thread_is_end = false;
696720

697721
while(!c64->warp_thread_end)
698722
{
699-
c64->WarpModeLoop();
723+
c64->WarpModeLoop();
700724
}
725+
726+
c64->warp_thread_is_end = true;
701727
return 0;
702728
}
703729

@@ -924,17 +950,17 @@ void C64Class::WarpModeLoop()
924950
}
925951
}
926952

927-
if(cpu->WRITE_DEBUG_CART)
953+
// DebugCartEvent soll nur maximal einmal aufgerufen werden
954+
if(is_wtite_to_debug_cart && (DebugCartEvent != nullptr))
928955
{
929-
// Event auslösen
930-
cpu->WRITE_DEBUG_CART = false;
931-
if(DebugCartEvent != nullptr) DebugCartEvent(cpu->GetDebugCartValue());
956+
is_wtite_to_debug_cart = false;
957+
DebugCartEvent(debug_cart_value);
958+
DebugCartEvent = nullptr; // Nur einmal aufrufen
932959
}
933960

934961
NextSystemCycle();
935962

936963
////////////////////////// Testweise //////////////////////////
937-
938964
static int zyklen_counter = 0;
939965
if(++zyklen_counter == 19656)
940966
{
@@ -1039,11 +1065,13 @@ void C64Class::FillAudioBuffer(uint8_t *stream, int laenge)
10391065
}
10401066
}
10411067

1042-
if(cpu->WRITE_DEBUG_CART)
1068+
1069+
// DebugCartEvent soll nur maximal einmal aufgerufen werden
1070+
if(is_wtite_to_debug_cart && (DebugCartEvent != nullptr))
10431071
{
1044-
// Event auslösen
1045-
cpu->WRITE_DEBUG_CART = false;
1046-
if(DebugCartEvent != nullptr) DebugCartEvent(cpu->GetDebugCartValue());
1072+
is_wtite_to_debug_cart = false;
1073+
DebugCartEvent(debug_cart_value);
1074+
DebugCartEvent = nullptr; // Nur einmal aufrufen
10471075
}
10481076

10491077
NextSystemCycle();
@@ -2710,12 +2738,21 @@ void C64Class::EnableWarpMode(bool enabled)
27102738
SDL_PauseAudioDevice(audio_dev, 1); // Audiostream pausieren
27112739
warp_thread_end = false;
27122740
warp_thread = SDL_CreateThread(SDLThreadWarp,"WarpThread",this);
2741+
LogText("WarpMode aktiviert\n");
27132742
}
27142743
else
27152744
{
27162745
// WarpMode deaktivieren
27172746
warp_thread_end = true;
2747+
SDL_DetachThread(warp_thread);
2748+
2749+
while(!warp_thread_is_end)
2750+
{
2751+
SDL_Delay(1);
2752+
}
2753+
27182754
SDL_PauseAudioDevice(audio_dev, 0); // Audiostream wieder starten
2755+
LogText("WarpMode deaktiviert\n");
27192756
}
27202757
}
27212758

@@ -4003,7 +4040,7 @@ void C64Class::NextSystemCycle()
40034040
{
40044041
CheckKeys();
40054042

4006-
if(hold_next_system_cycle)
4043+
if(hold_next_system_cycle)
40074044
return;
40084045

40094046
cycle_counter++;
@@ -4276,6 +4313,12 @@ bool C64Class::CheckBreakpoints()
42764313

42774314
void C64Class::WriteSidIO(uint16_t address, uint8_t value)
42784315
{
4316+
if((enable_debug_cart == true) && (address == DEBUG_CART_ADRESS))
4317+
{
4318+
debug_cart_value = value;
4319+
is_wtite_to_debug_cart = true;
4320+
}
4321+
42794322
if(enable_stereo_sid)
42804323
{
42814324
if((address & 0xFFE0) == 0xD400) sid1->WriteIO(address,value);

src/c64_class.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656
#define MAX_VIDEO_DISPLAYS 8 // Anzahl der Maximal unterstützen Video Displays
5757

58+
#define DEBUG_CART_ADRESS 0xD7FF
59+
5860
enum SCREENSHOT_FORMATS {SCREENSHOT_FORMAT_BMP, SCREENSHOT_FORMAT_PNG, SCREENSHOT_FORMATS_COUNT};
5961

6062
class C64Class
@@ -331,6 +333,7 @@ class C64Class
331333

332334
SDL_Thread *warp_thread;
333335
bool warp_thread_end;
336+
bool warp_thread_is_end;
334337

335338
uint8_t *vic_buffer;
336339
VideoCrtClass *video_crt_output;
@@ -520,8 +523,12 @@ class C64Class
520523
bool c64_command_line_count_s;
521524

522525
uint32_t cycle_counter;
523-
int limit_cycles_counter; // Dieser Counter wird wenn er > 0 ist bei jeden Zyklus um 1 runtergezählt
524-
bool hold_next_system_cycle; // Wird dieses Flag gesetzt wird verhindert das ein C64 Cylce ausgeführt wird
526+
int limit_cycles_counter; // Dieser Counter wird wenn er > 0 ist bei jeden Zyklus um 1 runtergezählt
527+
bool hold_next_system_cycle; // Wird dieses Flag gesetzt wird verhindert das ein C64 Cylce ausgeführt wird
528+
529+
bool enable_debug_cart; // Wird auf true gesetzt wenn der Debug Cart aktiviert ist
530+
bool is_wtite_to_debug_cart; // Wird auf true gesetzt wenn in den Debug Cart geschrieben wird
531+
unsigned char debug_cart_value; // Wert der im Debug Cart steht
525532

526533
bool debug_mode;
527534
bool debug_animation;

src/cartridge_class.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ CartridgeClass::CartridgeClass()
4545

4646
CartridgeClass::~CartridgeClass()
4747
{
48+
if(am29f040Lo != nullptr)
49+
{
50+
delete am29f040Lo;
51+
am29f040Lo = nullptr;
52+
}
53+
54+
if(am29f040Hi != nullptr)
55+
{
56+
delete am29f040Hi;
57+
am29f040Hi = nullptr;
58+
}
4859
}
4960

5061
void CartridgeClass::ResetAllLEDS(void)

src/cartridge_window.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ CartridgeWindow::~CartridgeWindow()
145145
////////////////////////////////////
146146

147147
delete ui;
148+
149+
if(LedRedOff != nullptr) delete LedRedOff;
150+
if(LedRedOn != nullptr) delete LedRedOn;
148151
}
149152

150153
void CartridgeWindow::LoadIni(void)

src/command_line_class.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ bool CommandLineClass::CheckLongCommands(const char *long_command)
272272
char *str = new char[255];
273273
sprintf(str,"--%s", long_command);
274274
AddCommand(all_commands_list[i].cmd_command, str);
275+
delete[] str;
275276
found = true;
276277
}
277278
}

src/d64_class.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ bool D64Class::ExportPrg(int file_number, const char *filename)
116116
uint8_t current_track = d64_files[file_number].Track;
117117
uint8_t current_sector = d64_files[file_number].Sektor;
118118

119-
while(current_track != 0)
119+
while(current_track != 0 && block_count > 0)
120120
{
121121
ReadBlock(current_track, current_sector, block);
122122
current_track = block[0];
123123
current_sector = block[1];
124+
block_count--;
124125
if(current_track == 0) fwrite(block+2, 1, current_sector - 1, file);
125126
else fwrite(block+2, 1, 254, file);
126127
}

src/d64_class.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// Dieser Sourcecode ist Copyright geschützt! //
99
// Geistiges Eigentum von Th.Kattanek //
1010
// //
11-
// Letzte Änderung am 26.06.2021 //
1211
// www.emu64.de //
1312
// //
1413
//////////////////////////////////////////////////
@@ -17,8 +16,7 @@
1716
#define D64_CLASS_H
1817

1918
#include <cstring>
20-
#include <fstream>
21-
#include <iostream>
19+
#include <cstdio>
2220

2321
#define D64_IMAGE_SIZE 174848
2422

src/debugger_iec_window.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ DebuggerIECWindow::DebuggerIECWindow(QWidget *parent) :
4040
DebuggerIECWindow::~DebuggerIECWindow()
4141
{
4242
delete ui;
43+
44+
if(icon_off != nullptr) delete icon_off;
45+
if(icon_on != nullptr) delete icon_on;
4346
}
4447

4548
void DebuggerIECWindow::RetranslateUi()

0 commit comments

Comments
 (0)