This commit is contained in:
OBattler
2022-08-07 23:35:31 +02:00
9 changed files with 83 additions and 15 deletions

View File

@@ -17,9 +17,11 @@
# Parse arguments. # Parse arguments.
newversion="$1" newversion="$1"
romversion="$2"
if [ -z "$(echo "$newversion" | grep '\.')" ] if [ -z "$(echo "$newversion" | grep '\.')" ]
then then
echo '[!] Usage: bumpversion.sh x.y[.z]' echo '[!] Usage: bumpversion.sh x.y[.z] [romversion]'
exit 1 exit 1
fi fi
shift shift
@@ -30,6 +32,12 @@ newversion_min=$(echo "$newversion" | cut -d. -f2)
newversion_patch=$(echo "$newversion" | cut -d. -f3) newversion_patch=$(echo "$newversion" | cut -d. -f3)
[ -z "$newversion_patch" ] && newversion_patch=0 [ -z "$newversion_patch" ] && newversion_patch=0
if [ -z "${romversion}" ]; then
# Get the latest ROM release from the GitHub API.
romversion=$(curl --silent "https://api.github.com/repos/86Box/roms/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/')
fi
# Switch to the repository root directory. # Switch to the repository root directory.
cd "$(dirname "$0")" || exit cd "$(dirname "$0")" || exit
@@ -61,6 +69,7 @@ patch_file src/include_make/*/version.h EMU_VERSION_PATCH 's/(#\s*define\s+EMU_V
patch_file src/include_make/*/version.h COPYRIGHT_YEAR 's/(#\s*define\s+COPYRIGHT_YEAR\s+)[0-9]+/\1'"$(date +%Y)"'/' patch_file src/include_make/*/version.h COPYRIGHT_YEAR 's/(#\s*define\s+COPYRIGHT_YEAR\s+)[0-9]+/\1'"$(date +%Y)"'/'
patch_file src/include_make/*/version.h EMU_DOCS_URL 's/(#\s*define\s+EMU_DOCS_URL\s+"https:\/\/[^\/]+\/en\/v)[^\/]+/\1'"$newversion_maj.$newversion_min"'/' patch_file src/include_make/*/version.h EMU_DOCS_URL 's/(#\s*define\s+EMU_DOCS_URL\s+"https:\/\/[^\/]+\/en\/v)[^\/]+/\1'"$newversion_maj.$newversion_min"'/'
patch_file src/unix/assets/*.spec Version 's/(Version:\s+)[0-9].+/\1'"$newversion"'/' patch_file src/unix/assets/*.spec Version 's/(Version:\s+)[0-9].+/\1'"$newversion"'/'
patch_file src/unix/assets/*.spec '%global romver' 's/(^%global\ romver\s+)[0-9]{8}/\1'"$romversion"'/'
patch_file src/unix/assets/*.spec 'changelog version' 's/(^[*]\s.*>\s+)[0-9].+/\1'"$newversion"-1'/' patch_file src/unix/assets/*.spec 'changelog version' 's/(^[*]\s.*>\s+)[0-9].+/\1'"$newversion"-1'/'
patch_file src/unix/assets/*.spec 'changelog date' 's/(^[*]\s)[a-zA-Z]{3}\s[a-zA-Z]{3}\s[0-9]{2}\s[0-9]{4}/\1'"$(pretty_date)"'/' patch_file src/unix/assets/*.spec 'changelog date' 's/(^[*]\s)[a-zA-Z]{3}\s[a-zA-Z]{3}\s[0-9]{2}\s[0-9]{4}/\1'"$(pretty_date)"'/'
patch_file src/unix/assets/*.metainfo.xml release 's/(<release version=")[^"]+(" date=")[^"]+/\1'"$newversion"'\2'"$(date +%Y-%m-%d)"'/' patch_file src/unix/assets/*.metainfo.xml release 's/(<release version=")[^"]+(" date=")[^"]+/\1'"$newversion"'\2'"$(date +%Y-%m-%d)"'/'

View File

@@ -138,6 +138,10 @@ char rom_path[1024] = { '\0'}; /* (O) full path to ROMs */
rom_path_t rom_paths = { "", NULL }; /* (O) full paths to ROMs */ rom_path_t rom_paths = { "", NULL }; /* (O) full paths to ROMs */
char log_path[1024] = { '\0'}; /* (O) full path of logfile */ char log_path[1024] = { '\0'}; /* (O) full path of logfile */
char vm_name[1024] = { '\0'}; /* (O) display name of the VM */ char vm_name[1024] = { '\0'}; /* (O) display name of the VM */
#ifdef USE_INSTRUMENT
uint8_t instru_enabled = 0;
uint64_t instru_run_ms = 0;
#endif
/* Configuration values. */ /* Configuration values. */
int window_remember; int window_remember;
@@ -567,6 +571,12 @@ usage:
/* .. and then exit. */ /* .. and then exit. */
return(0); return(0);
#ifdef USE_INSTRUMENT
} else if (!strcasecmp(argv[c], "--instrument")) {
if ((c+1) == argc) goto usage;
instru_enabled = 1;
sscanf(argv[++c], "%llu", &instru_run_ms);
#endif
} }
/* Uhm... out of options here.. */ /* Uhm... out of options here.. */

View File

@@ -57,6 +57,10 @@ if(VNC)
endif() endif()
endif() endif()
if(INSTRUMENT)
add_compile_definitions(USE_INSTRUMENT)
endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd vid voodoo plat ui) net print scsi sio snd vid voodoo plat ui)

View File

@@ -76,6 +76,10 @@ extern uint64_t source_hwnd;
extern char rom_path[1024]; /* (O) full path to ROMs */ extern char rom_path[1024]; /* (O) full path to ROMs */
extern char log_path[1024]; /* (O) full path of logfile */ extern char log_path[1024]; /* (O) full path of logfile */
extern char vm_name[1024]; /* (O) display name of the VM */ extern char vm_name[1024]; /* (O) display name of the VM */
#ifdef USE_INSTRUMENT
extern uint8_t instru_enabled;
extern uint64_t instru_run_ms;
#endif
#define window_x monitor_settings[0].mon_window_x #define window_x monitor_settings[0].mon_window_x
#define window_y monitor_settings[0].mon_window_y #define window_y monitor_settings[0].mon_window_y

View File

@@ -237,6 +237,7 @@ nvr_load(void)
{ {
char *path; char *path;
FILE *fp; FILE *fp;
uint8_t regs[NVR_MAXSIZE] = { 0 };
/* Make sure we have been initialized. */ /* Make sure we have been initialized. */
if (saved_nvr == NULL) return(0); if (saved_nvr == NULL) return(0);
@@ -255,9 +256,12 @@ nvr_load(void)
fp = plat_fopen(path, "rb"); fp = plat_fopen(path, "rb");
saved_nvr->is_new = (fp == NULL); saved_nvr->is_new = (fp == NULL);
if (fp != NULL) { if (fp != NULL) {
memcpy(regs, saved_nvr->regs, sizeof(regs));
/* Read NVR contents from file. */ /* Read NVR contents from file. */
if (fread(saved_nvr->regs, 1, saved_nvr->size, fp) != saved_nvr->size) if (fread(saved_nvr->regs, 1, saved_nvr->size, fp) != saved_nvr->size) {
fatal("nvr_load(): Error reading data\n"); memcpy(saved_nvr->regs, regs, sizeof(regs));
saved_nvr->is_new = 1;
}
(void)fclose(fp); (void)fclose(fp);
} }
} else } else

View File

@@ -31,6 +31,7 @@ extern "C"
#include <86box/86box.h> #include <86box/86box.h>
#include <86box/plat.h> #include <86box/plat.h>
#include <86box/mouse.h> #include <86box/mouse.h>
#include <poll.h>
} }
static std::vector<std::pair<int, libevdev*>> evdev_mice; static std::vector<std::pair<int, libevdev*>> evdev_mice;
@@ -54,25 +55,39 @@ void evdev_mouse_poll()
void evdev_thread_func() void evdev_thread_func()
{ {
struct pollfd *pfds = (struct pollfd*)calloc(evdev_mice.size(), sizeof(struct pollfd));
for (unsigned int i = 0; i < evdev_mice.size(); i++)
{
pfds[i].fd = libevdev_get_fd(evdev_mice[i].second);
pfds[i].events = POLLIN;
}
while (!stopped) while (!stopped)
{ {
poll(pfds, evdev_mice.size(), 500);
for (unsigned int i = 0; i < evdev_mice.size(); i++) for (unsigned int i = 0; i < evdev_mice.size(); i++)
{ {
struct input_event ev; struct input_event ev;
int rc = libevdev_next_event(evdev_mice[i].second, LIBEVDEV_READ_FLAG_NORMAL, &ev); if (pfds[i].revents & POLLIN) {
if (rc == 0 && ev.type == EV_REL && mouse_capture) while (libevdev_next_event(evdev_mice[i].second, LIBEVDEV_READ_FLAG_NORMAL, &ev) == 0)
{ {
if (ev.code == REL_X) evdev_mouse_rel_x += ev.value; if (ev.type == EV_REL && mouse_capture)
if (ev.code == REL_Y) evdev_mouse_rel_y += ev.value; {
if (ev.code == REL_X) evdev_mouse_rel_x += ev.value;
if (ev.code == REL_Y) evdev_mouse_rel_y += ev.value;
}
}
} }
} }
} }
for (unsigned int i = 0; i < evdev_mice.size(); i++) for (unsigned int i = 0; i < evdev_mice.size(); i++)
{ {
libevdev_free(evdev_mice[i].second); libevdev_free(evdev_mice[i].second);
evdev_mice[i].second = nullptr; evdev_mice[i].second = nullptr;
close(evdev_mice[i].first); close(evdev_mice[i].first);
} }
free(pfds);
evdev_mice.clear(); evdev_mice.clear();
} }

View File

@@ -109,9 +109,21 @@ main_thread_fn()
if (drawits > 50) if (drawits > 50)
drawits = 0; drawits = 0;
#ifdef USE_INSTRUMENT
uint64_t start_time = elapsed_timer.nsecsElapsed();
#endif
/* Run a block of code. */ /* Run a block of code. */
pc_run(); pc_run();
#ifdef USE_INSTRUMENT
if (instru_enabled) {
uint64_t elapsed_us = (elapsed_timer.nsecsElapsed() - start_time) / 1000;
uint64_t total_elapsed_ms = (uint64_t)((double)tsc / cpu_s->rspeed * 1000);
printf("[instrument] %llu, %llu\n", total_elapsed_ms, elapsed_us);
if (instru_run_ms && total_elapsed_ms >= instru_run_ms)
break;
}
#endif
/* Every 200 frames we save the machine status. */ /* Every 200 frames we save the machine status. */
if (++frames >= 200 && nvr_dosave) { if (++frames >= 200 && nvr_dosave) {
qt_nvr_save(); qt_nvr_save();

View File

@@ -95,8 +95,8 @@ OpenGLRenderer::resizeEvent(QResizeEvent *event)
context->makeCurrent(this); context->makeCurrent(this);
glViewport( glViewport(
destination.x(), destination.x() * devicePixelRatio(),
destination.y(), destination.y() * devicePixelRatio(),
destination.width() * devicePixelRatio(), destination.width() * devicePixelRatio(),
destination.height() * devicePixelRatio()); destination.height() * devicePixelRatio());
} }
@@ -179,8 +179,8 @@ OpenGLRenderer::initialize()
glClearColor(0.f, 0.f, 0.f, 1.f); glClearColor(0.f, 0.f, 0.f, 1.f);
glViewport( glViewport(
destination.x(), destination.x() * devicePixelRatio(),
destination.y(), destination.y() * devicePixelRatio(),
destination.width() * devicePixelRatio(), destination.width() * devicePixelRatio(),
destination.height() * devicePixelRatio()); destination.height() * devicePixelRatio());
@@ -425,6 +425,14 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h)
context->makeCurrent(this); context->makeCurrent(this);
#ifdef Q_OS_MACOS
glViewport(
destination.x() * devicePixelRatio(),
destination.y() * devicePixelRatio(),
destination.width() * devicePixelRatio(),
destination.height() * devicePixelRatio());
#endif
if (source.width() != w || source.height() != h) { if (source.width() != w || source.height() != h) {
source.setRect(0, 0, w, h); source.setRect(0, 0, w, h);

View File

@@ -12,6 +12,8 @@
# After a successful build, you can install the RPMs as follows: # After a successful build, you can install the RPMs as follows:
# sudo dnf install RPMS/$(uname -m)/86Box-3* RPMS/noarch/86Box-roms* # sudo dnf install RPMS/$(uname -m)/86Box-3* RPMS/noarch/86Box-roms*
%global romver v3.7
Name: 86Box Name: 86Box
Version: 3.7.1 Version: 3.7.1
Release: 1%{?dist} Release: 1%{?dist}
@@ -20,7 +22,7 @@ License: GPLv2+
URL: https://86box.net URL: https://86box.net
Source0: https://github.com/86Box/86Box/archive/refs/tags/v%%{version}.tar.gz Source0: https://github.com/86Box/86Box/archive/refs/tags/v%%{version}.tar.gz
Source1: https://github.com/86Box/roms/archive/refs/tags/%{version}.tar.gz Source1: https://github.com/86Box/roms/archive/refs/tags/%{romver}.zip
BuildRequires: cmake BuildRequires: cmake
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
@@ -55,7 +57,7 @@ It supports various models of PCs, graphics and sound cards, and CPUs.
%package roms %package roms
Summary: ROMs for use with 86Box Summary: ROMs for use with 86Box
Version: %{version} Version: %{romver}
License: Proprietary License: Proprietary
BuildArch: noarch BuildArch: noarch
@@ -111,7 +113,7 @@ popd
# files part of the rom package # files part of the rom package
%files roms %files roms
%license roms-%{version}/LICENSE %license roms-%{romver}/LICENSE
%{_datadir}/%{name}/roms %{_datadir}/%{name}/roms
%changelog %changelog