mirror of
https://github.com/weiju/amiga-stuff
synced 2025-11-21 01:12:43 +00:00
sprite fix added for Kickstart >= 3.0
This commit is contained in:
1
hardware/.gitignore
vendored
Normal file
1
hardware/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
startup
|
||||||
@ -6,6 +6,7 @@
|
|||||||
#include <clib/intuition_protos.h>
|
#include <clib/intuition_protos.h>
|
||||||
#include <exec/execbase.h>
|
#include <exec/execbase.h>
|
||||||
#include <graphics/gfxbase.h>
|
#include <graphics/gfxbase.h>
|
||||||
|
#include <graphics/videocontrol.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -27,6 +28,7 @@ void waitmouse() = "waitmouse:\n\tbtst\t#6,$bfe001\n\tbne\twaitmouse";
|
|||||||
#define EXEC_BASE (4L)
|
#define EXEC_BASE (4L)
|
||||||
#define TASK_PRIORITY 127
|
#define TASK_PRIORITY 127
|
||||||
#define VFREQ_PAL 50
|
#define VFREQ_PAL 50
|
||||||
|
#define WB_SCREEN_NAME "Workbench"
|
||||||
|
|
||||||
static UWORD __chip coplist_pal[] = {
|
static UWORD __chip coplist_pal[] = {
|
||||||
0x100, 0x200, // otherwise no display!
|
0x100, 0x200, // otherwise no display!
|
||||||
@ -50,6 +52,39 @@ static UWORD __chip coplist_ntsc[] = {
|
|||||||
0xffff, 0xfffe
|
0xffff, 0xfffe
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct Screen *wbscreen;
|
||||||
|
static ULONG oldresolution;
|
||||||
|
|
||||||
|
static void ApplySpriteFix()
|
||||||
|
{
|
||||||
|
if (wbscreen = LockPubScreen(WB_SCREEN_NAME)) {
|
||||||
|
struct TagItem video_control_tags[] = {
|
||||||
|
{VTAG_SPRITERESN_GET, SPRITERESN_ECS},
|
||||||
|
{TAG_DONE, 0}
|
||||||
|
};
|
||||||
|
struct TagItem video_control_tags2[] = {
|
||||||
|
{VTAG_SPRITERESN_SET, SPRITERESN_140NS},
|
||||||
|
{TAG_DONE, 0}
|
||||||
|
};
|
||||||
|
VideoControl(wbscreen->ViewPort.ColorMap, video_control_tags);
|
||||||
|
oldresolution = video_control_tags[0].ti_Data;
|
||||||
|
VideoControl(wbscreen->ViewPort.ColorMap, video_control_tags2);
|
||||||
|
MakeScreen(wbscreen);
|
||||||
|
RethinkDisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void UnapplySpriteFix()
|
||||||
|
{
|
||||||
|
if (wbscreen) {
|
||||||
|
struct TagItem video_control_tags[] = {
|
||||||
|
{VTAG_SPRITERESN_SET, oldresolution},
|
||||||
|
{TAG_DONE, 0}
|
||||||
|
};
|
||||||
|
VideoControl(wbscreen->ViewPort.ColorMap, video_control_tags);
|
||||||
|
MakeScreen(wbscreen);
|
||||||
|
UnlockPubScreen(NULL, wbscreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -57,24 +92,27 @@ int main(int argc, char **argv)
|
|||||||
struct Task *current_task = FindTask(NULL);
|
struct Task *current_task = FindTask(NULL);
|
||||||
BYTE old_prio = SetTaskPri(current_task, TASK_PRIORITY);
|
BYTE old_prio = SetTaskPri(current_task, TASK_PRIORITY);
|
||||||
struct View *current_view = ((struct GfxBase *) GfxBase)->ActiView;
|
struct View *current_view = ((struct GfxBase *) GfxBase)->ActiView;
|
||||||
|
UWORD lib_version = ((struct Library *) GfxBase)->lib_Version;
|
||||||
|
BOOL is_pal;
|
||||||
|
|
||||||
LoadView(NULL);
|
LoadView(NULL);
|
||||||
WaitTOF();
|
WaitTOF();
|
||||||
WaitTOF();
|
WaitTOF();
|
||||||
|
|
||||||
// Assuming 1.x, TODO: add handling for >= 2.x
|
// Kickstart > 3.0: fix sprite bug
|
||||||
// Note: FS-UAE reports 0 this, so essentially, there is no information
|
if (lib_version >= 39) {
|
||||||
// for 1.x
|
ApplySpriteFix();
|
||||||
if (((struct ExecBase *) EXEC_BASE)->VBlankFrequency == VFREQ_PAL) {
|
is_pal = (((struct GfxBase *) GfxBase)->DisplayFlags & PAL) == PAL;
|
||||||
// Handle PAL
|
|
||||||
printf("PAL: %d\n", (int) ((struct ExecBase *) EXEC_BASE)->VBlankFrequency);
|
|
||||||
custom.cop1lc = (ULONG) coplist_pal;
|
|
||||||
} else {
|
} else {
|
||||||
// Handle NTSC
|
// Note: FS-UAE reports 0 this, so essentially, there is no information
|
||||||
printf("NTSC: %d\n", (int) ((struct ExecBase *) EXEC_BASE)->VBlankFrequency);
|
// for 1.x
|
||||||
custom.cop1lc = (ULONG) coplist_ntsc;
|
printf("PAL/NTSC: %d\n", (int) ((struct ExecBase *) EXEC_BASE)->VBlankFrequency);
|
||||||
|
is_pal = ((struct ExecBase *) EXEC_BASE)->VBlankFrequency == VFREQ_PAL;
|
||||||
}
|
}
|
||||||
|
custom.cop1lc = is_pal ? (ULONG) coplist_pal : (ULONG) coplist_ntsc;
|
||||||
|
|
||||||
waitmouse();
|
waitmouse();
|
||||||
|
if (lib_version >= 39) UnapplySpriteFix();
|
||||||
LoadView(current_view);
|
LoadView(current_view);
|
||||||
WaitTOF();
|
WaitTOF();
|
||||||
WaitTOF();
|
WaitTOF();
|
||||||
|
|||||||
Reference in New Issue
Block a user