Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

Commit d8a8af2

Browse files
committed
don't check for 3ds requirements when building for switch (and vice versa)
1 parent 7fee232 commit d8a8af2

File tree

7 files changed

+98
-5
lines changed

7 files changed

+98
-5
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
label: Software Version
1010
description: LÖVEBrew Version
1111
options:
12-
- 0.5.1 (Latest)
12+
- 0.5.3 (Latest)
1313
validations:
1414
required: true
1515
- type: textarea

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
dist/
2+
test/build
3+
test/romfs
4+
test/icon.*

lovebrew.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Package
22

3-
version = "0.5.2"
3+
version = "0.5.3"
44
author = "TurtleP"
55
description = "LÖVE Potion Game Distribution Helper"
66
license = "MIT"

src/environment.nim

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ import strutils
55
import configure
66
import strings
77

8+
import types/target
9+
810
let FirstRunFile = ConfigDirectory & "/.first_run"
911
let CurrentDirectory* = getCurrentDir()
1012

1113
proc findBinary(name: string): bool =
14+
var package = case name:
15+
of "tex3ds":
16+
name
17+
of "nacptool":
18+
"switch-tools"
19+
else:
20+
"3dstools"
21+
1222
if isEmptyOrWhitespace(findExe(name)):
13-
raise newException(Exception, strings.BinaryNotFound.format(name))
23+
raise newException(Exception, strings.BinaryNotFound.format(name, package))
1424

1525
return true
1626

@@ -30,7 +40,16 @@ proc checkToolchainInstall*(): bool =
3040
let ctrBinaries = @["3dsxtool", "tex3ds"]
3141
let hacBinaries = @["nacptool"]
3242

33-
return ctrBinaries.anyIt(it.findBinary) or hacBinaries.anyIt(it.findBinary)
43+
let targets = config.targets
44+
var pass = false
45+
46+
if Target_Ctr in targets:
47+
pass = ctrBinaries.allIt(it.findBinary)
48+
49+
if Target_Hac in targets:
50+
pass = hacBinaries.anyIt(it.findBinary)
51+
52+
return pass
3453

3554
if not fileExists(FirstRunFile):
3655
os.createDir(ConfigDirectory)

src/strings.nim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ const NoConfig* = """
2424
Config not found! Try creating one with the init argument."""
2525

2626
const BinaryNotFound* = """
27-
Binary '$1' is not in your PATH environment.
27+
Binary '$1' is not in your PATH environment. Please ensure that the
28+
package '$2' is installed from devkitpro-pacman.
29+
2830
On macOS and Linux, install the devkit-env package. Windows users need
2931
to add the path 'C:\devkitPro\tools\bin' to their PATH."""
3032

test/game/main.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function love.draw()
2+
love.graphics.print("Hello World!")
3+
end
4+
5+
function love.gamepadpressed(_, button)
6+
if button == "start" then
7+
love.event.quit()
8+
end
9+
end

test/lovebrew.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## --- Metadata Options --- ##
2+
3+
# [string] @name : Name of the game, default: name of the directory.
4+
# [string] @author : Author of the game.
5+
# [string] @description : Description of the game.
6+
# [string] @version : Version of the game in {major}.{minor}.{revision} format.
7+
[metadata]
8+
name = "SuperGame"
9+
author = "SuperAuthor"
10+
description = "SuperDescription"
11+
version = "0.1.0"
12+
13+
## --- Build Options --- ##
14+
15+
# [bool] @clean : Clean the build artifacts and directory before a new build.
16+
# This helps reduce chances of cluttering the built data.
17+
# Default: false.
18+
#
19+
# [array] @targts : Target console(s) to build for. Default: ["3ds", "switch"].
20+
#
21+
# [string] @source : Game source directory; relative to the config
22+
# file. Default: "game".
23+
#
24+
# [string] @icon : Icon name. Do not provide the extension.
25+
# lovebrew will automatically provide this.
26+
# It can include a prepended path. This is relative
27+
# to the config file. Default: "icon".
28+
#
29+
# [string] @binSearchPath : Location to search for the elf binaries.
30+
# Default: ""
31+
[build]
32+
clean = false
33+
targets = ["3ds", "switch"]
34+
source = "game"
35+
icon = "icon"
36+
binSearchPath = ""
37+
38+
## --- Output Options --- ##
39+
40+
# [string] @build : Output directory for compilation; relative to the config
41+
# file. When false, it will use current directory.
42+
# Default: "build".
43+
#
44+
# [bool] @rawData : Whether or not to properly build a 3DS project binary.
45+
# This will not build a 3DS application. See @build.targets.
46+
# When false, outputs as a 3dsx; when true, output only
47+
# as the "raw" game folder used for testing purposes.
48+
# Default: false.
49+
#
50+
# [string] @romFS : The directory within the build directory which gets
51+
# zipped and appended to the resulting binary. Default: "game".
52+
# NOTE: if "rawData" is true, this does not get zipped and can
53+
# be used for quick testing. However, the directory must be named
54+
# as the default, "game".
55+
[output]
56+
build = "build"
57+
rawData = false
58+
romFS = "game"
59+
60+
# VERSION 0.5.0 #

0 commit comments

Comments
 (0)