Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Add CI-CD #26

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
69b2db8
Create azure-pipelines.yml
networkfusion Aug 11, 2019
c6edc24
change makefile to windows
networkfusion Aug 14, 2019
e404393
add more detailed version string
networkfusion Aug 14, 2019
8590a06
corrections to previous commit
networkfusion Aug 14, 2019
242a1d4
fix libdragon warning
networkfusion Aug 14, 2019
ac38e87
add required defines for images
networkfusion Aug 14, 2019
0cd62fc
update stb libs
networkfusion Aug 14, 2019
58fea35
fix some compiler warnings
networkfusion Aug 14, 2019
6a0fb06
add back removed var
networkfusion Aug 14, 2019
6021240
add libs download
networkfusion Aug 29, 2019
d6333b0
make sure temp directory is created
networkfusion Aug 29, 2019
ac93c41
move function to start
networkfusion Aug 29, 2019
b77ed66
remove dodgy chars
networkfusion Aug 29, 2019
531b0b3
change to use expand-archive
networkfusion Aug 29, 2019
fe433d3
use latest version of toolchain
networkfusion Aug 29, 2019
68476d7
correct branch
networkfusion Aug 29, 2019
410b664
correct correction
networkfusion Aug 29, 2019
9de0f05
fixed?
networkfusion Aug 29, 2019
923b250
reorder lib building
networkfusion Aug 29, 2019
8efeb8e
fix some warnings
networkfusion Sep 4, 2019
c258e9d
change optimisation flags
networkfusion Sep 5, 2019
2c98aa0
playing with flags...
networkfusion Sep 5, 2019
24aefda
trial of snprintf
networkfusion Sep 5, 2019
ebb7040
correct last commit...
networkfusion Sep 5, 2019
36faa71
less optimisation...
networkfusion Sep 5, 2019
21969b9
add gcc
networkfusion Sep 5, 2019
c4317bc
remove lib gcc
networkfusion Sep 5, 2019
dbe1c69
fix some more warnings
networkfusion Sep 6, 2019
84c56ca
fix more warnings
networkfusion Sep 6, 2019
8c54370
missed some text when commenting out function
networkfusion Sep 6, 2019
5182114
eliminate small data section
networkfusion Sep 6, 2019
4e8b2fd
fix more warnings
networkfusion Sep 6, 2019
484a481
add c++ lib
networkfusion Sep 6, 2019
fd26639
rearrange libs
networkfusion Sep 6, 2019
ff515c2
comment out warning disable
networkfusion Sep 6, 2019
ef330ea
small data fix?
networkfusion Sep 6, 2019
9d0328d
increase size of some str buffers
networkfusion Sep 6, 2019
ef327dc
fix more warnings
networkfusion Sep 6, 2019
0338145
fix more warnings
networkfusion Sep 6, 2019
deebc99
few more warning fixes
networkfusion Sep 6, 2019
27bdd48
fix more warnings
networkfusion Sep 6, 2019
9d72571
string sizes
networkfusion Sep 6, 2019
55702e2
more string size fixes
networkfusion Sep 6, 2019
79ea3e0
more string fixes
networkfusion Sep 6, 2019
8d1bf5b
more string fixes
networkfusion Sep 6, 2019
7cf181e
try allocating memory on the fly
networkfusion Sep 6, 2019
4e6eac7
fix null pointer warning
networkfusion Sep 6, 2019
c315a7b
move more strings over to using malloc
networkfusion Sep 6, 2019
a93b8d6
test using case insensitive compare
networkfusion Sep 6, 2019
971f344
add function to header
networkfusion Sep 6, 2019
07d5563
add required include
networkfusion Sep 6, 2019
8f546d8
move inline function to the header
networkfusion Sep 6, 2019
74bfda9
more warning fixes
networkfusion Sep 6, 2019
8e8bba0
more string warning fixes
networkfusion Sep 6, 2019
b75cbb9
more string fixes
networkfusion Sep 6, 2019
cbb10f9
add required include
networkfusion Sep 6, 2019
a8a5d3c
set size
networkfusion Sep 6, 2019
6f5a742
more fixes
networkfusion Sep 6, 2019
0fff7d1
use char not int
networkfusion Sep 6, 2019
5320e3b
trim corrections
networkfusion Sep 6, 2019
abca982
more fixes
networkfusion Sep 6, 2019
b9b3313
volitile vars
networkfusion Sep 6, 2019
0f2506f
variables
networkfusion Sep 6, 2019
11e30a6
more vars
networkfusion Sep 6, 2019
dab4766
strings
networkfusion Sep 7, 2019
5f4737b
more
networkfusion Sep 7, 2019
b2e815f
stupid changes?!
networkfusion Sep 7, 2019
e33627a
revert stupid part 1
networkfusion Sep 7, 2019
0868179
revert stupid part 2
networkfusion Sep 7, 2019
8977208
revert stupid pt 3
networkfusion Sep 7, 2019
134da60
str length
networkfusion Sep 7, 2019
a7d5f26
more string fixes
networkfusion Sep 8, 2019
431cb53
correct ints
networkfusion Sep 8, 2019
495c47c
use rome_name instead of buf
networkfusion Sep 8, 2019
77421c4
use char instead of unsigned char
networkfusion Sep 8, 2019
d7de8f0
code simplification
networkfusion Sep 9, 2019
9d43a7a
try using a c function
networkfusion Sep 9, 2019
fc79513
no need to free anymore!
networkfusion Sep 9, 2019
d98c6eb
dissable warning for the external lib...
networkfusion Sep 9, 2019
b84e445
widen the scope?
networkfusion Sep 9, 2019
346b87d
use correct warning?!
networkfusion Sep 9, 2019
1a7449b
set as char?
networkfusion Sep 9, 2019
a04b725
remove char conversion
networkfusion Sep 9, 2019
c71c67f
strcpy fix?
networkfusion Sep 9, 2019
26a6c18
to char?
networkfusion Sep 9, 2019
0fb8c23
revert
networkfusion Sep 9, 2019
a0348bb
correct strcpy
networkfusion Sep 10, 2019
fc5be8d
further changes
networkfusion Sep 10, 2019
b577c7b
return 0 on main
networkfusion Sep 10, 2019
5dc72cb
remove c++ and nosys libs
networkfusion Sep 13, 2019
31f5c73
resolve resdir
networkfusion Sep 13, 2019
1c5346b
make sure dfs is created
networkfusion Sep 13, 2019
88eba2c
correct dfs exe path
networkfusion Sep 13, 2019
d789f62
correct exe name
networkfusion Sep 13, 2019
ab877fc
Work on local builds
networkfusion Jan 27, 2020
6ee070f
Correct makefile
networkfusion Jan 28, 2020
0483431
Further fixes to makefile
networkfusion Jan 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@
*properties.json
/.vs
/.vscode

/toolchain/*
/lib/*
/include/*
/temp
101 changes: 62 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,61 +1,84 @@
#
# Copyright (c) 2017 The Altra64 project contributors
# Copyright (c) 2020 The Altra64 project contributors
# See LICENSE file in the project root for full license information.
#

ROOTDIR = $(N64_INST)
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
MKDFSPATH = $(ROOTDIR)/bin/mkdfs
N64TOOL = $(ROOTDIR)/bin/n64tool
ifdef SystemRoot
FIXPATH = $(subst /,\,$1)
RM = DEL /Q
else
FIXPATH = $1
RM = rm -f
endif

ROOTDIR = $(CURDIR)
SRCDIR = $(ROOTDIR)/src
OBJDIR = $(ROOTDIR)/obj
BINDIR = $(ROOTDIR)/bin
LIBDIR = $(ROOTDIR)/lib
RESDIR = $(ROOTDIR)/res

CHKSUM64 = $(ROOTDIR)/toolchain/libdragon/tools/chksum64.exe
MKDFS = $(ROOTDIR)/toolchain/libdragon/tools/mkdfs.exe
N64TOOL = $(ROOTDIR)/toolchain/libdragon/tools/n64tool.exe

HEADERNAME = header.ed64
HEADERTITLE = "EverDrive OS"
PROG_NAME = OS64

SRCDIR = ./src
INCDIR = ./inc
RESDIR = ./res
OBJDIR = ./obj
BINDIR = ./bin
TOOLSDIR = ./tools
INCLUDE_DIRS = -I$(ROOTDIR)/inc -I$(ROOTDIR)/include -I$(ROOTDIR)/toolchain/gcc-toolchain-mips64/include -I$(ROOTDIR)/toolchain/gcc-toolchain-mips64/mips64-elf/include -I$(ROOTDIR)/toolchain/libdragon/include

LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmikmod -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64ld.x
PROG_NAME = OS64
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I$(INCDIR) -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG)
COMMON_FLAGS = -std=gnu17 -march=vr4300 -mtune=vr4300 -Wall -Wrestrict -Wno-pointer-sign -D_REENTRANT -DUSE_TRUETYPE $(INCLUDE_DIRS) $(SET_DEBUG)
FLAGS_VT = -O0 $(COMMON_FLAGS)
FLAGS = -O2 $(COMMON_FLAGS)
ASFLAGS = -mtune=vr4300 -march=vr4300
CC = $(GCCN64PREFIX)gcc
AS = $(GCCN64PREFIX)as
LD = $(GCCN64PREFIX)ld
LINK_FLAGS = -G0 -L$(ROOTDIR)/lib -L$(ROOTDIR)/toolchain/gcc-toolchain-mips64/mips64-elf/lib -L$(ROOTDIR)/toolchain/libdragon/lib -ldragon -lmikmod -lmad -lyaml -lm -lc -ldragonsys -Tn64ld.x

GCCN64PREFIX = $(ROOTDIR)/toolchain/gcc-toolchain-mips64/bin/mips64-elf-
CC = $(GCCN64PREFIX)gcc.exe
AS = $(GCCN64PREFIX)as.exe
LD = $(GCCN64PREFIX)ld.exe
OBJCOPY = $(GCCN64PREFIX)objcopy

SOURCES := $(wildcard $(SRCDIR)/*.c)
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

$(PROG_NAME).v64: $ $(PROG_NAME).elf $(PROG_NAME).dfs
$(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary
rm -f $(BINDIR)/$(PROG_NAME).v64
$(N64TOOL) -l 4M -t $(HEADERTITLE) -h $(RESDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs
$(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64
SRC = $(wildcard $(SRCDIR)/*.c)

OBJ = $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRC))

all: $(PROG_NAME).v64

$(PROG_NAME).elf : $(OBJECTS)
@mkdir -p $(BINDIR)
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS) $(LINK_FLAGS)
release: $(PROG_NAME).v64

$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
debug: SET_DEBUG=-DDEBUG
debug: $(PROG_NAME).v64

send: $(PROG_NAME).v64
$(TOOLSDIR)/up.bat


$(PROG_NAME).v64: $(PROG_NAME).elf $(PROG_NAME).dfs
$(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary
$(N64TOOL) -l 4M -t $(HEADERTITLE) -h $(RESDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs
$(CHKSUM64) $(BINDIR)/$(PROG_NAME).v64

copy: $(PROG_NAME).v64
sh $(TOOLSDIR)/upload.sh
$(PROG_NAME).elf : $(OBJ) $(OBJS)
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJ) $(OBJS) $(LINK_FLAGS)

$(PROG_NAME).dfs:
$(MKDFSPATH) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/
$(MKDFS) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/

all: $(PROG_NAME).v64
$(OBJDIR)/gscore.o: $(SRCDIR)/gscore.c
$(CC) $(FLAGS_VT) -c $(SRCDIR)/gscore.c -o $(OBJDIR)/gscore.o

debug: $(PROG_NAME).v64
$(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(FLAGS) -c $< -o $@

debug: SET_DEBUG=-DDEBUG
$(OBJDIR)/%.o : $(SRCDIR)/%.s
$(AS) $(ASFLAGS) $< -o $@


clean:
rm -f $(BINDIR)/*.v64 $(BINDIR)/*.elf $(OBJDIR)/*.o $(BINDIR)/*.bin $(BINDIR)/*.dfs
$(info "Cleaning $(PROG_NAME)...")
@$(RM) $(call FIXPATH,$(BINDIR)/$(PROG_NAME).v64)
@$(RM) $(call FIXPATH,$(BINDIR)/$(PROG_NAME).bin)
@$(RM) $(call FIXPATH,$(BINDIR)/$(PROG_NAME).elf)
@$(RM) $(call FIXPATH,$(OBJ))
25 changes: 3 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,13 @@ originally written by saturnu, and released on the
[Everdrive64 forum](http://krikzz.com/forum/index.php?topic=816.0).

## Building

If you want to build the menu, you need an n64 toolchain. When using windows 10 or Ubuntu, installation is totally automated through a script.

### Dependencies (installed automatically)
* Windows 10 (Aniversary Update or above) / Ubuntu 16.04 (or above)
* [libdragon](https://github.com/DragonMinded/libdragon)
* [libmikmod (with n64 driver)](https://github.com/networkfusion/libmikmod)
* [libmad-n64](https://github.com/networkfusion/libmad-n64)
* [libyaml](http://pyyaml.org/wiki/LibYAML)

### Build the Toolchain

*You may skip this step if it's already installed.*

Clone this `Altra64` repo to a directory of your choice.

On Windows 10:
* Ensure that ["Windows Subsystem For Linux (Ubuntu)"](https://msdn.microsoft.com/en-gb/commandline/wsl/install_guide) is installed.
* browse to the tools directory and double click on ```setup-wsfl.cmd```.

On Ubuntu, browse to the tools directory and run the command ```$ chmod +x ./setup-linux.sh;source ./setup-linux.sh```


### Build `Altra64`
If this is the first time building, ensure you create the following folders in the root directory `bin` `obj` and `lib`
To install the dependencies run: `update-libs.ps1`

To build the Rom
To build the ROM

from the projects root directory,
On Windows 10 run
Expand Down
68 changes: 68 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'

variables:
outputStorageUri: ''
outputStorageContainerSasToken: ''
binaryVersion: '$(Year:yy)$(DayOfYear)$(Rev:r)'

steps:
- task: PowerShell@2
inputs:
targetType: 'filePath' # Optional. Options: filePath, inline
filePath: 'update-libs.ps1' # Required when targetType == FilePath
#arguments: # Optional
#errorActionPreference: 'stop' # Optional. Options: stop, continue, silentlyContinue
failOnStderr: false # Optional
#workingDirectory: # Optional
displayName: Install tool-chain and libs

- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$path = "$($Env:BUILD_SOURCESDIRECTORY)\inc\version.h"
# should possibly be setting this through the make file!
$versionStr = '#define OS_BUILD_VERSION "' + $Env:Build_BuildNumber + '"'
(Get-Content $path).Replace('#define OS_BUILD_VERSION "0"',$versionStr) | Set-Content $path
errorActionPreference: 'stop'
failOnStderr: 'false'
displayName: Update build version

- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
# needs converting to proper powershell or bash!
cmd.exe /c "set PATH=%PATH%;%BUILD_SOURCESDIRECTORY%\gcc-toolchain-mips64\bin"
cmd.exe /c "md bin"
cmd.exe /c "md obj"
If ($Env.Build_SourceBranchName -eq "master") {
cmd.exe /c "make"
}
Else {
cmd.exe /c "make debug"
}
errorActionPreference: 'stop'
failOnStderr: 'false'
displayName: 'Build ROM'
continueOnError: false

- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)
contents: 'bin\*.v64'
targetFolder: $(Build.ArtifactStagingDirectory)
flattenFolders: true
displayName: 'Copy ROM'
continueOnError: false

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'binaries'
publishLocation: 'Container'
displayName: Publish Build Artifacts
continueOnError: false
21 changes: 5 additions & 16 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
::
:: Copyright (c) 2017 The Altra64 project contributors
:: See LICENSE file in the project root for full license information.
::

set PATH=%~dp0toolchain\gcc-toolchain-mips64\bin
@echo off
set "SystemPath=%SystemRoot%\\System32"
IF EXIST %WINDIR%\\sysnative\\reg.exe (
set "SystemPath=%SystemRoot%\Sysnative"
echo. "32-bit process..."
)

set env="/usr/local/libdragon"

IF %1.==. (
echo. "no parameter"
%SystemPath%\\bash --verbose -c "export N64_INST=%env%; make"
::echo. "no parameter"
make
) ELSE (
echo. "parameter: %1"
%SystemPath%\\bash --verbose -c "export N64_INST=%env%; make %1"
::echo. "parameter: %1"
make -d %1
)

:pause
27 changes: 26 additions & 1 deletion inc/image.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
//
// Copyright (c) 2017 The Altra64 project contributors
// Copyright (c) 2019 The Altra64 project contributors
// See LICENSE file in the project root for full license information.
//

#ifndef _IMAGE_H
#define _IMAGE_H

// enable palette (tlut)
#define EN_TLUT 0x00800000000000

// enable atomic prim, 1st primitive bandwidth save
#define ATOMIC_PRIM 0x80000000000000

// enable perspective correction
#define PERSP_TEX_EN 0x08000000000000

// select alpha dither
#define ALPHA_DITHER_SEL_PATTERN 0x00000000000000
#define ALPHA_DITHER_SEL_PATTERNB 0x00001000000000
#define ALPHA_DITHER_SEL_NOISE 0x00002000000000
#define ALPHA_DITHER_SEL_NO_DITHER 0x00003000000000

// select rgb dither
#define RGB_DITHER_SEL_MAGIC_SQUARE_MATRIX 0x00000000000000
#define RGB_DITHER_SEL_STANDARD_BAYER_MATRIX 0x00004000000000
#define RGB_DITHER_SEL_NOISE 0x00008000000000
#define RGB_DITHER_SEL_NO_DITHER 0x0000C000000000

// enable texture filtering
#define SAMPLE_TYPE 0x00200000000000


sprite_t *loadImage32DFS(char *fname);
sprite_t *loadImageDFS(char *fname);
sprite_t *loadImage32(u8 *tbuf, int size);
Expand Down
16 changes: 8 additions & 8 deletions inc/ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ extern "C" {
stop on first error), -1 on file open error, or -2 on memory allocation
error (only when INI_USE_STACK is zero).
*/
int ini_parse(const char* filename,
int (*handler)(void* user, const char* section,
const char* name, const char* value),
void* user);
// int ini_parse(const char* filename,
// int (*handler)(void* user, const char* section,
// const char* name, const char* value),
// void* user);

/* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't
close the file when it's finished -- the caller must do that. */
int ini_parse_file(FILE* file,
int (*handler)(void* user, const char* section,
const char* name, const char* value),
void* user);
// int ini_parse_file(FILE* file,
// int (*handler)(void* user, const char* section,
// const char* name, const char* value),
// void* user);

int ini_parse_str(char* ini_string,
int (*handler)(void*, const char*, const char*,
Expand Down
Loading