Skip to content

Commit

Permalink
mii: Bug fixes
Browse files Browse the repository at this point in the history
Quite a few bugs fixed in the mouse and serial card driver. Also some
internal changes to the video, and a few tweaks to libmui.

The critical bits are the drivers and the IRQ handling in general.
  • Loading branch information
buserror committed Oct 21, 2024
1 parent bf6cb9e commit d6d4eba
Show file tree
Hide file tree
Showing 19 changed files with 847 additions and 426 deletions.
24 changes: 21 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
</p>

# MII Version Changelog
## 1.96
Bug fix release
* Mouse driver was revised completely. Now works in all program that I could try,
including Blazing Paddles; all the desktop apps, Dazzle Draw, MousePaint, etc.
* Also fixed the Super Serial Card driver, change the way data is processed,
and changed a lot of the way the IRQs are handled.
* In the process of this, I realized that I needed an IRQ MUX, as a program
that uses the SSC and the Mouse at the same time would not work. Typically,
I only know of one (french language VersionTel minitel emulator) that uses
both at the same time, but it's a good test.
* Also fixed a bug that prevented the 'debugger' to work properly. Doh.

<div align="center">
<img src="docs/screen/v196versiontel.png" alt="VersionTel">
</div>
<center><i>VersionTel is a rare program that uses 2 IRQs (SSC and Mouse)!</i>
</center>

## 1.95
This is an intermediate release, mostly to fix a few bugs and add a few features that were requested.
* Now have support for *writing* both DSK (PO and DO) as well as NIB files. As it
Expand All @@ -17,7 +35,7 @@ This is an intermediate release, mostly to fix a few bugs and add a few features
an IWM, but that'll come.
* Changed the SmartPort driver to continue booting if there are no Disks. This
seems to solve a problem people had with booting from a floppy when there was
no hard drive -- MII would stop at the basic prompt; not it continues to boot
no hard drive -- MII would stop at the basic prompt; now it continues to boot
from the next slot down the line (with a message).
* Audio processing was redone. There is now a notion of an audio 'sink' with an (now 32 bit float) FIFO. The speaker code (and soon, perhaps, the mockingboard) writes to it's own sink, and there an audio mixer that reads from all the sinks and mixes them together. This allows for a more flexible audio system, and also allows for a 'master volume' control.
* Also now use 'sokol_audio' for the audio output, which gives me the possibility of a multi-platform audio output, if ever needed. I also added support for "miniaudio"; but it does a bit too much for my need at the minute, and slows down the compilation considerably, so it's not the default.
Expand All @@ -36,7 +54,7 @@ This is an intermediate release, mostly to fix a few bugs and add a few features
| ![NTSC](docs/screen/v19ntsc.png) | ![Mega2](docs/screen/v19mega2.png) |
|--------------------------------------|--------------------------------------|
* Added AVX/SSE/generic vectorial versions of some code paths, for speed.
* Added some more 'artifacts' color frindges to the HIRES rendering as well.
* Added some more 'artifacts' color fringes to the HIRES rendering as well.

<p align="center">
<img src="docs/screen/v19artifacts.png" alt="Artifacts">
Expand Down Expand Up @@ -71,7 +89,7 @@ This is an intermediate release, mostly to fix a few bugs and add a few features
split the 'XORG/GLX' code from the 'Pure GL' code from the 'MII UI' code, so it should be a lot easier to port to other platforms.
* Redid the *DHRES rendering*, it's now a lot more accurate, has the correct
artifacts. It's not as optimized as the previous version, but it looks better.
* Now remap the *joystick* coodinates to a 'square' -- my current 8bitdo joystick
* Now remap the *joystick* coordinates to a 'square' -- my current 8bitdo joystick
has a circular deadzone, and it was a bit annoying to use. I might make that
a setting, but for now, it's hardwired.
* *Emulator now passes a2audit*. There is only one kludge to do it, regarding the
Expand Down
Binary file added docs/screen/v196versiontel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 88 additions & 8 deletions libmui/fonts/Charcoal_mui.sfd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ OS2Version: 0
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 0
CreationTime: 830956166
ModificationTime: 1711450964
ModificationTime: 1724911886
PfmFamily: 81
TTFWeight: 400
TTFWidth: 5
Expand Down Expand Up @@ -800,10 +800,10 @@ NameList: AGL For New Fonts
DisplaySize: -96
AntiAlias: 1
FitToEm: 1
WinInfo: 230 23 12
WinInfo: 207 23 12
BeginPrivate: 0
EndPrivate
BeginChars: 489 471
BeginChars: 491 473

StartChar: .notdef
Encoding: 409 -1 0
Expand Down Expand Up @@ -857,7 +857,7 @@ EndChar

StartChar: .null
Encoding: 5 8 1
AltUni2: 002400.ffffffff.0 00001d.ffffffff.0 002400.ffffffff.0 00001d.ffffffff.0
AltUni2: 00001d.ffffffff.0 002400.ffffffff.0 00001d.ffffffff.0 002400.ffffffff.0
Width: 0
GlyphClass: 1
Flags: W
Expand Down Expand Up @@ -2429,7 +2429,7 @@ EndChar

StartChar: hyphen
Encoding: 36 45 16
AltUni2: 002010.ffffffff.0 0000ad.ffffffff.0 002010.ffffffff.0 0000ad.ffffffff.0
AltUni2: 0000ad.ffffffff.0 002010.ffffffff.0 0000ad.ffffffff.0 002010.ffffffff.0
Width: 1190
GlyphClass: 1
Flags: W
Expand Down Expand Up @@ -31696,14 +31696,14 @@ SplineSet
-84 -111 l 5,29,-1
505.200195312 1611 l 5,26,-1
EndSplineSet
Validated: 524289
Validated: 1
EndChar

StartChar: triagdn
Encoding: 488 9660 470
Width: 1467
VWidth: 1000
Flags: WO
Flags: W
LayerCount: 2
Fore
SplineSet
Expand All @@ -31718,7 +31718,87 @@ SplineSet
731.5 206 l 1,12,13
331.900390625 616.400390625 331.900390625 616.400390625 65.5 890 c 0,0,1
EndSplineSet
Validated: 524289
Validated: 1
EndChar

StartChar: clickbox
Encoding: 489 9746 471
Width: 1881
Flags: W
LayerCount: 2
Fore
SplineSet
136 1304 m 1,0,-1
1744 1304 l 1,1,-1
1744 -304 l 1,2,-1
136 -304 l 1,3,-1
136 1304 l 1,0,-1
0 1448 m 1,4,-1
0 -432 l 1,5,-1
1881 -432 l 1,6,-1
1881 1448 l 1,7,-1
0 1448 l 1,4,-1
1016.33984375 114.719726562 m 1,8,-1
1016.33984375 -163.740234375 l 1,9,-1
860.73046875 -163.740234375 l 1,10,-1
860.73046875 114.719726562 l 1,11,-1
1016.33984375 114.719726562 l 1,8,-1
1489.54003906 45.5595703125 m 1,12,-1
1380.33984375 -63.6396484375 l 1,13,-1
1159.20996094 156.580078125 l 1,14,-1
1269.3203125 266.690429688 l 1,15,-1
1489.54003906 45.5595703125 l 1,12,-1
1016.33984375 862.740234375 m 1,16,-1
860.73046875 862.740234375 l 1,17,-1
860.73046875 1141.20019531 l 1,18,-1
1016.33984375 1141.20019531 l 1,19,-1
1016.33984375 862.740234375 l 1,16,-1
1489.54003906 931.900390625 m 1,20,-1
1269.3203125 710.76953125 l 1,21,-1
1159.20996094 820.879882812 l 1,22,-1
1380.33984375 1041.09960938 l 1,23,-1
1489.54003906 931.900390625 l 1,20,-1
733.330078125 805.41015625 m 1,24,-1
623.219726562 695.299804688 l 1,25,-1
427.5703125 890.950195312 l 1,26,-1
537.6796875 1001.05957031 l 1,27,-1
733.330078125 805.41015625 l 1,24,-1
1638.78027344 417.75 m 1,28,-1
1327.55957031 417.75 l 1,29,-1
1327.55957031 573.360351562 l 1,30,-1
1638.78027344 573.360351562 l 1,31,-1
1638.78027344 417.75 l 1,28,-1
549.509765625 417.75 m 1,32,-1
238.290039062 417.75 l 1,33,-1
238.290039062 573.360351562 l 1,34,-1
549.509765625 573.360351562 l 1,35,-1
549.509765625 417.75 l 1,32,-1
719.6796875 161.129882812 m 1,36,-1
498.549804688 -59.08984375 l 1,37,-1
389.349609375 50.1103515625 l 1,38,-1
610.48046875 271.240234375 l 1,39,-1
719.6796875 161.129882812 l 1,36,-1
EndSplineSet
EndChar

StartChar: closebox
Encoding: 490 9744 472
Width: 1881
Flags: W
LayerCount: 2
Fore
SplineSet
136 1304 m 1,0,-1
1744 1304 l 1,1,-1
1744 -304 l 1,2,-1
136 -304 l 1,3,-1
136 1304 l 1,0,-1
0 1448 m 1,4,-1
0 -432 l 1,5,-1
1881 -432 l 1,6,-1
1881 1448 l 1,7,-1
0 1448 l 1,4,-1
EndSplineSet
EndChar
EndChars
EndSplineFont
38 changes: 30 additions & 8 deletions libmui/src/control/listbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,49 @@

#pragma once


#include <mui/mui_types.h>
#include <mui/mui_control.h>

struct mui_control_t;
struct mui_window_t;
struct mui_listbox_elem_t;

/* This is currently unused */
typedef void (*mui_ldef_p)(
struct mui_control_t * c,
uint32_t elem_index,
struct mui_listbox_elem_t * elem);


typedef struct mui_listbox_elem_t {
uint32_t disabled : 1;
// currently this is a UTF8 string using the 'icons' font
char icon[8]; // UTF8 icon
// default 'LDEF' is to draw the 'elem' string
// default 'LDEF' is to draw the 'elem' string using normal font
void * elem; // char * or... ?
} mui_listbox_elem_t;

DECLARE_C_ARRAY(mui_listbox_elem_t, mui_listbox_elems, 2);
IMPLEMENT_C_ARRAY(mui_listbox_elems);

enum mui_ldef_op_e {
/*
* Initialize the LDEF, the 'ldef_param' is passed in, and the
*/
MUI_LDEF_OP_INIT,
/*
* Allow the LDEF to dispose of ldef_param, if applicable
*/
MUI_LDEF_OP_DISPOSE,
MUI_LDEF_OP_DRAW,
MUI_LDEF_OP_GET_TEXT,
MUI_LDEF_OP_EVENT,
MUI_LDEF_OP_COUNT,
};

/* This is currently unused */
typedef void (*mui_ldef_p)(
mui_control_t * c,
enum mui_ldef_op_e op,
void * ldef_param,
uint32_t elem_index,
mui_listbox_elem_t * elem,
void * io_result );


mui_control_t *
mui_listbox_new(
Expand All @@ -46,3 +63,8 @@ mui_listbox_prepare(
mui_listbox_elems_t *
mui_listbox_get_elems(
mui_control_t * c);
void
mui_listbox_set_ldef(
mui_control_t * c,
mui_ldef_p ldef,
void * ldef_param);
7 changes: 5 additions & 2 deletions libmui/src/control/popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
#include <mui/mui_control.h>
#include <mui/mui_menu.h>

/* Popup menu control.
/*
* Popup menu control.
*
* flags are MUI_TEXT_ALIGN_* -- however this corresponds to the margins
* of the popup control itself when placed into it's 'frame' -- the
* popup will be placed left,right,center of the frame rectangle depending.
* popup will be placed left,right,center of the frame rectangle depending
* on these flags.
*/
mui_control_t *
mui_popupmenu_new(
Expand Down
10 changes: 5 additions & 5 deletions libmui/src/control/scrollbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include <mui/mui_types.h>
#include <mui/mui_control.h>



/* Page step and line step are optional, they default to '30' pixels and
* the 'visible' area of the scrollbar, respectively.
* If you want to for example have a scrollbar that scrolls by 5 when you
/*
* Page step and line step are optional, they default to '30' pixels and the
* 'visible' area of the scrollbar, respectively.
*
* If you want to -for example- have a scrollbar that scrolls by 5 when you
* click the arrows, and by 20 when you click the bar, you would set the
* line_step to 5, and the page_step to 20.
*/
Expand Down
68 changes: 67 additions & 1 deletion libmui/src/mui_cdef_listbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef struct mui_listbox_control_t {
uint8_t elem_height;
mui_listbox_elems_t elems;
mui_ldef_p ldef;
void * ldef_param; // returned from MUI_LDEF_OP_INIT
// to handle double-click
mui_time_t last_click;
// typehead search related
Expand All @@ -37,6 +38,56 @@ typedef struct mui_listbox_control_t {

extern const mui_control_color_t mui_control_color[MUI_CONTROL_STATE_COUNT];

typedef struct mui_ldef_default_t {
mui_font_t * main;
mui_font_t * icons;
} mui_ldef_default_t;

/*
* CURRENTLY NOT IN USE
*/
static void
mui_ldef_default(
mui_control_t * c,
enum mui_ldef_op_e op,
void * ldef_param,
uint32_t elem_index,
mui_listbox_elem_t * elem,
void * io_result )
{
switch (op) {
case MUI_LDEF_OP_INIT: {
mui_ldef_default_t * d = calloc(1, sizeof(*d));
d->main = mui_font_find(c->win->ui, "main");
d->icons = mui_font_find(c->win->ui, "icons");
*((mui_ldef_default_t **)io_result) = d;
} break;
case MUI_LDEF_OP_DISPOSE:
if (ldef_param)
free(ldef_param);
break;
case MUI_LDEF_OP_DRAW: {
mui_drawable_t * dr = io_result;
mui_font_t * main = mui_font_find(c->win->ui, "main");
c2_rect_t f = c->frame;
c2_rect_offset(&f, c->win->content.l, c->win->content.t);
f.t += elem_index * ((mui_listbox_control_t *)c)->elem_height;
f.b = f.t + ((mui_listbox_control_t *)c)->elem_height;
mui_font_text_draw(main, dr, f.tl, elem->elem, 0,
mui_control_color[elem->disabled ?
MUI_CONTROL_STATE_DISABLED : 0].text);
} break;
case MUI_LDEF_OP_GET_TEXT:
*((char **)io_result) = elem->elem;
break;
case MUI_LDEF_OP_EVENT:
break;
default:
break;
}
}


static void
mui_listbox_draw(
mui_window_t * win,
Expand All @@ -52,7 +103,7 @@ mui_listbox_draw(
cg_rectangle(cg, f.l, f.t,
c2_rect_width(&f), c2_rect_height(&f));
cg_stroke(cg);
{
{ // this clips the frame so we don't draw over the border
c2_rect_t clip = f;
c2_rect_inset(&clip, 1, 1);
mui_drawable_clip_push(dr, &clip);
Expand Down Expand Up @@ -403,3 +454,18 @@ mui_listbox_prepare(
mui_control_inval(lb->scrollbar);
mui_control_inval(c);
}

void
mui_listbox_set_ldef(
mui_control_t * c,
mui_ldef_p ldef,
void * ldef_param)
{
mui_listbox_control_t *lb = (mui_listbox_control_t *)c;
if (lb->ldef)
lb->ldef(c, MUI_LDEF_OP_DISPOSE, lb->ldef_param, 0, NULL, NULL);
lb->ldef = ldef;
lb->ldef_param = ldef_param;
if (lb->ldef)
lb->ldef(c, MUI_LDEF_OP_INIT, ldef_param, 0, NULL, &lb->ldef_param);
}
Loading

0 comments on commit d6d4eba

Please sign in to comment.