First post, by megatron-uk
I'm making decent progress converting my RPG engine to Allegro from it's current SDL implementation and am at the point of replacing the input handlers with those of Allegro. These make use of various system timers that Allegro initialises after a "install_timer()" function. Things like mouse tracking don't work until that is done.
Allegro is the last available release that natively supported DOS: 4.2.3.1, from here, since it's now a bit of a chore to compile with anything recent (I'm using Open Watcom 2, a late November 2022 release, cross-compiling from Linux).
The issue is that as soon as I issue the install_timer() function, my application blows up. I comment the line out again and everything is fine (although I don't have timers to enable input, audio playback etc).
Code looks like this:
int input_Init(void){
int has_timer = 0;
int has_mouse = 0;
int has_joystick = 0;
draw_LoadText("System timer...");
// Crashes here!!!
if (install_timer() == 0){
has_timer = 1;
draw_LoadBar(-1);
} else {
screen_Exit();
printf("Error, Unable to setup Allegro system timers for input devices!\n");
return -1;
}
draw_LoadText("Mouse...");
if (install_mouse() >= 0){
has_mouse = 1;
}
draw_LoadBar(-1);
draw_LoadText("Joystick...");
if (install_joystick(JOY_TYPE_AUTODETECT) == 0){
has_joystick = 1;
}
draw_LoadBar(-1);
draw_LoadText("Inputs configured");
draw_ProgressIcon(TILE_CONTROLS);
return OK;
}
Obviously none of the draw_* functions have anything to do with the timers; they're all on-screen indicators for the loading screen. Depending on whether the install_timer() line is commented out or not, I get the following behaviour:
Working: https://www.youtube.com/watch?v=nw-UY8WWjHU
Crashing: https://www.youtube.com/watch?v=INYKW50ZS40
The same behaviour is exhibited both within Dosbox and real hardware (the videos are of one of my real systems). Dosbox throws the following at the point of crashing:
DOSBox version 0.74-3
Copyright 2002-2019 DOSBox Team, published under GNU GPL.
---
CONFIG:Loading primary settings from config file ../etc/dosbox-386-4mb-sb16.conf
MIXER:Got different values from SDL: freq 44100, blocksize 512
ALSA:Client initialised [128:0]
MIDI:Opened device:alsa
terminate called after throwing an instance of 'char*'
Aborted
The Allegro forums are pretty inactive these days, so I though my Vogons pals here may have some experience with Allegro?
My collection database and technical wiki:
https://www.target-earth.net