Compare commits

...

1 Commits

View File

@ -934,26 +934,31 @@ static const ULONG device_vectors[] =
* @param checkFire If true, only modify when gameport 1 button is pressed
* @param increment Amount to increase both device and boot node priorities
*/
void AdjustBootPriority(struct ExecBase *SysBase, char *bootname, struct List *MountList, bool checkFire, int increment) {
void AdjustBootPriority(struct ExecBase *SysBase, char *deviceName, char *bootname, struct List *MountList, bool checkFire, int increment) {
volatile struct CIA *ciaa = (struct CIA *)0x0bfe001;
struct BootNode *bn;
struct DeviceNode *dn;
struct FileSysStartupMsg *fssm;
for (bn = (struct BootNode *)MountList->lh_Head;
bn->bn_Node.ln_Succ;
bn = (struct BootNode *)bn->bn_Node.ln_Succ)
{
dn = bn->bn_DeviceNode;
if (dn->dn_Priority != -128)
{
if (L_CompareBSTR(BADDR(dn->dn_Name),bootname)) {
if(!checkFire || (ciaa->ciapra & CIAF_GAMEPORT1)==0) {
dn->dn_Priority+=increment;
bn->bn_Node.ln_Pri+=increment;
Remove((struct Node *)bn);
Enqueue(MountList,(struct Node *)bn);
break;
}
fssm = BADDR(dn->dn_Startup);
char *bn_deviceName = (char *)BADDR(fssm->fssm_Device) + 1;
// Only tweak boot nodes created by this instance
if (strcmp(bn_deviceName,deviceName) != 0)
continue;
if (dn->dn_Priority != -128 && L_CompareBSTR(BADDR(dn->dn_Name),bootname)) {
if(!checkFire || (ciaa->ciapra & CIAF_GAMEPORT1)==0) {
dn->dn_Priority+=increment;
bn->bn_Node.ln_Pri+=increment;
Remove((struct Node *)bn);
Enqueue(MountList,(struct Node *)bn);
break;
}
}
}
@ -969,7 +974,7 @@ void AdjustBootPriority(struct ExecBase *SysBase, char *bootname, struct List *M
*
* @param SysBase Pointer to the ExecBase system library base
*/
void TweakBootList(struct ExecBase *SysBase) {
void TweakBootList(struct ExecBase *SysBase, char *deviceName) {
struct ExpansionBase *ExpansionBase;
if (ExpansionBase = (struct ExpansionBase *)OpenLibrary("expansion.library",0)) {
@ -979,12 +984,12 @@ void TweakBootList(struct ExecBase *SysBase) {
Forbid();
AdjustBootPriority(SysBase,bootname,&ExpansionBase->MountList,true,2);
AdjustBootPriority(SysBase,deviceName,bootname,&ExpansionBase->MountList,true,2);
bootname[5]=0x30+(major/10);
bootname[6]=0x30+(major%10);
AdjustBootPriority(SysBase,bootname,&ExpansionBase->MountList,false,1);
AdjustBootPriority(SysBase,deviceName,bootname,&ExpansionBase->MountList,false,1);
Permit();
@ -1031,7 +1036,7 @@ static struct Library * init(BPTR seg_list asm("a0"))
MountDrive(&ms);
if (!seg_list) // Only tweak if we're in boot
TweakBootList(SysBase);
TweakBootList(SysBase,mydev->lib.lib_Node.ln_Name);
}
done:
return (struct Library *)mydev;