Using a local script for installing devkitpro to force a certain version

- Added new vpad functions
This commit is contained in:
Maschell 2017-11-18 13:07:36 +01:00
parent 5220c3a741
commit 7d706477b2
5 changed files with 401 additions and 1 deletions

View File

@ -19,7 +19,7 @@ addons:
- p7zip-full
before_install:
- wget https://raw.githubusercontent.com/devkitPro/installer/master/perl/devkitPPCupdate.pl
- wget https://raw.githubusercontent.com/Maschell/dynamic_libs/lib/other/devkitPPCupdatePPCr29.pl
install:
- perl devkitPPCupdate.pl

View File

@ -0,0 +1,250 @@
#!/usr/bin/perl
#-----------------------------------------------------------------------------
#
# Copyright (C) 2011 - 2016
# Michael Theall (mtheall)
# Dave Murphy (WinterMute)
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any
# purpose, including commercial applications, and to alter it and
# redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you
# must not claim that you wrote the original software. If you use
# this software in a product, an acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and
# must not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#
#-----------------------------------------------------------------------------
use strict;
my $dir = "$ENV{HOME}/devkitPro";
my $downloader;
my $archname;
if($ENV{"DEVKITPRO"} ne "")
{
$dir = $ENV{"DEVKITPRO"};
}
if($#ARGV eq 0)
{
$dir = $ARGV[0];
}
# Ensure full pathname
if(!($dir =~ /^\//))
{
my $pwd = `pwd`;
chomp($pwd);
$dir = "$pwd/$dir";
}
printf("devkitPPC Updater/Installer\n");
printf("Installing to %s\n", $dir);
# Get OS information
my $os = `uname`;
my $arch = `uname -m`;
chomp($os);
chomp($arch);
# Check OS information
if($os eq "Linux" and ($arch eq "i686" or $arch eq "x86_64"))
{
$downloader = "wget -q";
$archname = $arch . "-linux";
}
elsif($os eq "Darwin" and ($arch eq "i386" or $arch eq "x86_64"))
{
$downloader = "curl -L -O -s";
$archname = $arch . "-osx";
}
else
{
printf(STDERR "Not on Linux i686/x86_64 or Darwin i386/x86_64!\n");
exit(1);
}
# Set up directories
if(!(-d "$dir"))
{
mkdir("$dir") or die $!;
}
if(!(-d "$dir/libogc"))
{
mkdir("$dir/libogc") or die $!;
}
if(!(-d "$dir/examples"))
{
mkdir("$dir/examples") or die $!;
}
if(!(-d "$dir/examples/wii"))
{
mkdir("$dir/examples/wii") or die $!;
}
if(!(-d "$dir/examples/gamecube"))
{
mkdir("$dir/examples/gamecube") or die $!;
}
# Grab update file
if(-e "devkitProUpdatePPCr29.ini")
{
unlink("devkitProUpdatePPCr29.ini") or die $!;
}
printf("Downloading update file...");
system($downloader . " https://raw.githubusercontent.com/Maschell/dynamic_libs/lib/other/devkitProUpdatePPCr29.ini") and die "Failed to download!";
printf("OK!\n");
# Initialize versions & newVersions
my %versions =
(
'devkitPPC' => 0,
'libogc' => 0,
'libogcfat' => 0,
'wiiexamples' => 0,
'cubeexamples' => 0,
);
my %newVersions = %versions;
my %files = ();
my $current = "";
if(-e "$dir/dkppc-update.ini")
{
open(MYFILE, "<$dir/dkppc-update.ini") or die $!;
while(<MYFILE>)
{
chomp;
if($_ =~ /\[(.*)\]/)
{
$current = $1;
}
elsif($_ =~ /Version=(.*)/ and defined($versions{$current}))
{
$versions{$current} = $1;
}
elsif($_ =~ /File=(.*)/)
{
$files{$current} = $1;
}
}
close(MYFILE);
}
my %newFiles = ();
open(MYFILE, "<devkitProUpdatePPCr29.ini") or die $!;
while(<MYFILE>)
{
chomp;
if($_ =~ /\[(.*)\]/)
{
$current = $1;
}
elsif($_ =~ /Version=(.*)/ and defined($newVersions{$current}))
{
$newVersions{$current} = $1;
}
elsif($_ =~ /File=(.*)/)
{
$newFiles{$current} = $1;
}
}
close(MYFILE);
unlink("devkitProUpdatePPCr29.ini") or die $!;
# see what to update
my %updates = ();
foreach my $key (keys %versions)
{
if($versions{$key} ne $newVersions{$key} and $newVersions{$key} ne 0)
{
$newFiles{$key} =~ s/win32\.exe/$archname.tar.bz2/;
$updates{$key} = $newFiles{$key};
}
else
{
printf("%s is up-to-date\n", $key);
}
}
# Download files
foreach my $key (keys %updates)
{
printf("Update %s with %s\n", $key, $updates{$key});
if(-e $updates{$key})
{
unlink($updates{$key});
}
my $cmd = sprintf("%s http://download.sourceforge.net/devkitpro/%s", $downloader, $updates{$key});
printf(" Downloading...");
system($cmd) and die "Failed to download $updates{$key}\n";
printf("OK!\n");
}
# Install files
my %install =
(
'devkitPPC' => '',
'libogc' => 'libogc',
'libogcfat' => 'libogc',
'wiiexamples' => 'examples/wii',
'cubeexamples' => 'examples/gamecube',
);
foreach my $key (keys %updates)
{
my $cmd = sprintf("tar -xjf %s -C $dir/%s", $updates{$key}, $install{$key});
printf("Extracting %s...", $updates{$key});
system($cmd) and die "Failed\n";
printf("OK!\n");
}
# Output update info
open(MYFILE, ">$dir/dkppc-update.ini") or die $!;
foreach my $key (keys %newVersions)
{
printf(MYFILE "[%s]\n", $key);
printf(MYFILE "Version=%s\n", $newVersions{$key});
printf(MYFILE "File=%s\n", $newFiles{$key});
printf(MYFILE "\n");
}
close(MYFILE);
# Check environment variables
printf("Checking DEVKITPRO...");
my $env = `echo \$DEVKITPRO`;
chomp($env);
if($env ne "$dir")
{
printf("Please set DEVKITPRO in your environment as $dir\n");
}
else
{
printf("OK!\n");
}
printf("Checking DEVKITPPC...");
$env = `echo \$DEVKITPPC`;
chomp($env);
if($env ne "$dir/devkitPPC")
{
printf("Please set DEVKITPPC in your environment as \${DEVKITPRO}/devkitPPC\n");
}
else
{
printf("OK!\n");
}
exit(0);

View File

@ -0,0 +1,147 @@
[devkitProUpdate]
Build=46
URL=http://downloads.sourceforge.net/devkitpro
Filename=devkitProUpdater-1.6.0.exe
[msys]
Version=1.0.17-1
File=msys-1.0.17-1.exe
Size=118660
[devkitARM]
Version=46
File=devkitARM_r46-win32.exe
Size=70461
[devkitPPC]
Version=29-1
File=devkitPPC_r29-1-win32.exe
Size=65356
[devkitPSP]
Version=16-1
File=devkitPSP_r16-1-win32.exe
Size=70915
[pspdoc]
Version=20051113
File=pspsdk-doc-20051113.tar.bz2
Size=9344
[libgba]
Version=0.5.0
File=libgba-0.5.0.tar.bz2
Size=268
[libgbafat]
Version=1.1.0
File=libfat-gba-1.1.0.tar.bz2
Size=241
[maxmodgba]
Version=1.0.10
File=maxmod-gba-1.0.10.tar.bz2
Size=
[libnds]
Version=1.6.2
File=libnds-1.6.2.tar.bz2
Size=470
[libndsfat]
Version=1.1.0
File=libfat-nds-1.1.0.tar.bz2
Size=272
[maxmodds]
Version=1.0.10
File=maxmod-nds-1.0.10.tar.bz2
Size=
[dswifi]
Version=0.4.0
File=dswifi-0.4.0.tar.bz2
Size=496
[libctru]
Version=1.2.1
File=libctru-1.2.1.tar.bz2
Size=371
[citro3d]
Version=1.2.0
File=citro3d-1.2.0.tar.bz2
Size=371
[libmirko]
Version=0.9.7
File=libmirko-0.9.7.tar.bz2
Size=1056
[libogc]
Version=1.8.16
File=libogc-1.8.16.tar.bz2
Size=2748
[libogcfat]
Version=1.1.0
File=libfat-ogc-1.1.0.tar.bz2
Size=481
[pnotepad]
Version=2.0.8.718
File=pn2.0.8.718.zip
Size=4958
[insight]
Version=7.3.50.20110803
File=insight-7.3.50.20110803-cvs.exe
Size=32932
[ndsexamples]
Version=20170124
File=nds-examples-20170124.tar.bz2
Size=1191
[defaultarm7]
Version=0.7.1
File=default_arm7-0.7.1.tar.bz2
Size=9
[filesystem]
Version=0.9.13-1
File=libfilesystem-0.9.13-1.tar.bz2
Size=9
[gbaexamples]
Version=20170228
File=gba-examples-20170228.tar.bz2
Size=1019
[gp32examples]
Version=20051021
File=gp32-examples-20051021.tar.bz2
Size=732
[cubeexamples]
Version=20170228
File=gamecube-examples-20170228.tar.bz2
Size=198
[wiiexamples]
Version=20170228
File=wii-examples-20170228.tar.bz2
Size=93
[3dsexamples]
Version=20170226
File=3ds-examples-20170226.tar.bz2
Size=93
[gcube]
Version=0.4.0
File=gcube-0.4.0-win32.tar.bz2
Size=1234
[Settings]
RTL=0

View File

@ -78,6 +78,7 @@ EXPORT_DECL(s32, VPADBASEGetMotorOnRemainingCount, s32 lcdmode);
EXPORT_DECL(s32, VPADBASESetMotorOnRemainingCount, s32 lcdmode, s32 counter);
EXPORT_DECL(void, VPADBASESetSensorBarSetting, s32 chan, s8 setting);
EXPORT_DECL(void, VPADBASEGetSensorBarSetting, s32 chan, s8 *setting);
EXPORT_DECL(s32, VPADSetSensorBar, s32 chan, bool on);
void InitAcquireVPad(void){
if(coreinit_handle == 0){ InitAcquireOS(); };
@ -137,6 +138,7 @@ void InitVPadFunctionPointers(void){
OS_FIND_EXPORT(vpad_handle, VPADGetTPCalibratedPointEx);
OS_FIND_EXPORT(vpad_handle, VPADSetLcdMode);
OS_FIND_EXPORT(vpad_handle, VPADGetLcdMode);
OS_FIND_EXPORT(vpad_handle, VPADSetSensorBar);
OS_FIND_EXPORT(vpadbase_handle, VPADBASEGetMotorOnRemainingCount);
OS_FIND_EXPORT(vpadbase_handle, VPADBASESetMotorOnRemainingCount);
OS_FIND_EXPORT(vpadbase_handle, VPADBASESetSensorBarSetting);

View File

@ -192,6 +192,7 @@ extern s32 (* VPADBASEGetMotorOnRemainingCount)(s32 lcdmode);
extern s32 (* VPADBASESetMotorOnRemainingCount)(s32 lcdmode, s32 counter);
extern void (* VPADBASESetSensorBarSetting)(s32 chan, s8 setting);
extern void (* VPADBASEGetSensorBarSetting)(s32 chan, s8 *setting);
extern s32 (*VPADSetSensorBar)(s32 chan, bool on);
#ifdef __cplusplus
}