summaryrefslogtreecommitdiff
path: root/packages/libogcfpc
diff options
context:
space:
mode:
Diffstat (limited to 'packages/libogcfpc')
-rw-r--r--packages/libogcfpc/Makefile.fpc2
-rw-r--r--packages/libogcfpc/examples/devices/Makefile94
-rw-r--r--packages/libogcfpc/examples/devices/Makefile.fpc2
-rw-r--r--packages/libogcfpc/examples/devices/usbgecko/Makefile.fpc2
-rw-r--r--packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile2
-rw-r--r--packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile.fpc2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile33
-rw-r--r--packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile.fpc37
-rw-r--r--packages/libogcfpc/examples/graphics/gx/gxSprites/gxsprites.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson1/lesson1.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson2/lesson2.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson3/lesson3.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson4/lesson4.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson5/lesson5.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile33
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile.fpc35
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/lesson6.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile33
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile.fpc35
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/lesson7.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile33
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile.fpc35
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/lesson8.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile37
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile.fpc39
-rw-r--r--packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/lesson9.pp2
-rw-r--r--packages/libogcfpc/examples/graphics/gx/triangle/triangle.pp2
-rw-r--r--packages/libogcfpc/fpmake.pp2
-rw-r--r--packages/libogcfpc/src/gccore.inc34
-rw-r--r--packages/libogcfpc/src/ogc/lwp_heap.inc85
-rw-r--r--packages/libogcfpc/src/ogc/lwp_mutex.inc99
-rw-r--r--packages/libogcfpc/src/ogc/lwp_priority.inc49
-rw-r--r--packages/libogcfpc/src/ogc/lwp_threads.inc97
-rw-r--r--packages/libogcfpc/src/ogc/lwp_watchdog.inc83
-rw-r--r--packages/libogcfpc/src/ogc/machine/processor.inc32
35 files changed, 681 insertions, 276 deletions
diff --git a/packages/libogcfpc/Makefile.fpc b/packages/libogcfpc/Makefile.fpc
index 59572ce330..e22673f440 100644
--- a/packages/libogcfpc/Makefile.fpc
+++ b/packages/libogcfpc/Makefile.fpc
@@ -27,7 +27,7 @@ cpu=powerpc
target=wii
fpcdir=../..
-[require]
+[require]
nortl=y
[shared]
diff --git a/packages/libogcfpc/examples/devices/Makefile b/packages/libogcfpc/examples/devices/Makefile
index 3fbde4960e..a5def5a6d0 100644
--- a/packages/libogcfpc/examples/devices/Makefile
+++ b/packages/libogcfpc/examples/devices/Makefile
@@ -265,7 +265,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
endif
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
ifeq ($(FULL_TARGET),powerpc-wii)
-override TARGET_DIRS+=network usbgecko usbkeyboard
+override TARGET_DIRS+=network usbkeyboard usbgecko
endif
override INSTALL_FPCPACKAGE=y
ifdef REQUIRE_UNITSDIR
@@ -1417,8 +1417,8 @@ fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
fpc_makefiles: fpc_makefile fpc_makefile_dirs
ifeq ($(FULL_TARGET),powerpc-wii)
TARGET_DIRS_NETWORK=1
-TARGET_DIRS_USBGECKO=1
TARGET_DIRS_USBKEYBOARD=1
+TARGET_DIRS_USBGECKO=1
endif
ifdef TARGET_DIRS_NETWORK
network_all:
@@ -1465,51 +1465,6 @@ network:
$(MAKE) -C network all
.PHONY: network_all network_debug network_smart network_release network_units network_examples network_shared network_install network_sourceinstall network_exampleinstall network_distinstall network_zipinstall network_zipsourceinstall network_zipexampleinstall network_zipdistinstall network_clean network_distclean network_cleanall network_info network_makefiles network
endif
-ifdef TARGET_DIRS_USBGECKO
-usbgecko_all:
- $(MAKE) -C usbgecko all
-usbgecko_debug:
- $(MAKE) -C usbgecko debug
-usbgecko_smart:
- $(MAKE) -C usbgecko smart
-usbgecko_release:
- $(MAKE) -C usbgecko release
-usbgecko_units:
- $(MAKE) -C usbgecko units
-usbgecko_examples:
- $(MAKE) -C usbgecko examples
-usbgecko_shared:
- $(MAKE) -C usbgecko shared
-usbgecko_install:
- $(MAKE) -C usbgecko install
-usbgecko_sourceinstall:
- $(MAKE) -C usbgecko sourceinstall
-usbgecko_exampleinstall:
- $(MAKE) -C usbgecko exampleinstall
-usbgecko_distinstall:
- $(MAKE) -C usbgecko distinstall
-usbgecko_zipinstall:
- $(MAKE) -C usbgecko zipinstall
-usbgecko_zipsourceinstall:
- $(MAKE) -C usbgecko zipsourceinstall
-usbgecko_zipexampleinstall:
- $(MAKE) -C usbgecko zipexampleinstall
-usbgecko_zipdistinstall:
- $(MAKE) -C usbgecko zipdistinstall
-usbgecko_clean:
- $(MAKE) -C usbgecko clean
-usbgecko_distclean:
- $(MAKE) -C usbgecko distclean
-usbgecko_cleanall:
- $(MAKE) -C usbgecko cleanall
-usbgecko_info:
- $(MAKE) -C usbgecko info
-usbgecko_makefiles:
- $(MAKE) -C usbgecko makefiles
-usbgecko:
- $(MAKE) -C usbgecko all
-.PHONY: usbgecko_all usbgecko_debug usbgecko_smart usbgecko_release usbgecko_units usbgecko_examples usbgecko_shared usbgecko_install usbgecko_sourceinstall usbgecko_exampleinstall usbgecko_distinstall usbgecko_zipinstall usbgecko_zipsourceinstall usbgecko_zipexampleinstall usbgecko_zipdistinstall usbgecko_clean usbgecko_distclean usbgecko_cleanall usbgecko_info usbgecko_makefiles usbgecko
-endif
ifdef TARGET_DIRS_USBKEYBOARD
usbkeyboard_all:
$(MAKE) -C usbkeyboard all
@@ -1555,6 +1510,51 @@ usbkeyboard:
$(MAKE) -C usbkeyboard all
.PHONY: usbkeyboard_all usbkeyboard_debug usbkeyboard_smart usbkeyboard_release usbkeyboard_units usbkeyboard_examples usbkeyboard_shared usbkeyboard_install usbkeyboard_sourceinstall usbkeyboard_exampleinstall usbkeyboard_distinstall usbkeyboard_zipinstall usbkeyboard_zipsourceinstall usbkeyboard_zipexampleinstall usbkeyboard_zipdistinstall usbkeyboard_clean usbkeyboard_distclean usbkeyboard_cleanall usbkeyboard_info usbkeyboard_makefiles usbkeyboard
endif
+ifdef TARGET_DIRS_USBGECKO
+usbgecko_all:
+ $(MAKE) -C usbgecko all
+usbgecko_debug:
+ $(MAKE) -C usbgecko debug
+usbgecko_smart:
+ $(MAKE) -C usbgecko smart
+usbgecko_release:
+ $(MAKE) -C usbgecko release
+usbgecko_units:
+ $(MAKE) -C usbgecko units
+usbgecko_examples:
+ $(MAKE) -C usbgecko examples
+usbgecko_shared:
+ $(MAKE) -C usbgecko shared
+usbgecko_install:
+ $(MAKE) -C usbgecko install
+usbgecko_sourceinstall:
+ $(MAKE) -C usbgecko sourceinstall
+usbgecko_exampleinstall:
+ $(MAKE) -C usbgecko exampleinstall
+usbgecko_distinstall:
+ $(MAKE) -C usbgecko distinstall
+usbgecko_zipinstall:
+ $(MAKE) -C usbgecko zipinstall
+usbgecko_zipsourceinstall:
+ $(MAKE) -C usbgecko zipsourceinstall
+usbgecko_zipexampleinstall:
+ $(MAKE) -C usbgecko zipexampleinstall
+usbgecko_zipdistinstall:
+ $(MAKE) -C usbgecko zipdistinstall
+usbgecko_clean:
+ $(MAKE) -C usbgecko clean
+usbgecko_distclean:
+ $(MAKE) -C usbgecko distclean
+usbgecko_cleanall:
+ $(MAKE) -C usbgecko cleanall
+usbgecko_info:
+ $(MAKE) -C usbgecko info
+usbgecko_makefiles:
+ $(MAKE) -C usbgecko makefiles
+usbgecko:
+ $(MAKE) -C usbgecko all
+.PHONY: usbgecko_all usbgecko_debug usbgecko_smart usbgecko_release usbgecko_units usbgecko_examples usbgecko_shared usbgecko_install usbgecko_sourceinstall usbgecko_exampleinstall usbgecko_distinstall usbgecko_zipinstall usbgecko_zipsourceinstall usbgecko_zipexampleinstall usbgecko_zipdistinstall usbgecko_clean usbgecko_distclean usbgecko_cleanall usbgecko_info usbgecko_makefiles usbgecko
+endif
all: $(addsuffix _all,$(TARGET_DIRS))
debug: $(addsuffix _debug,$(TARGET_DIRS))
smart: $(addsuffix _smart,$(TARGET_DIRS))
diff --git a/packages/libogcfpc/examples/devices/Makefile.fpc b/packages/libogcfpc/examples/devices/Makefile.fpc
index dd4d121f8e..79c7e6ca90 100644
--- a/packages/libogcfpc/examples/devices/Makefile.fpc
+++ b/packages/libogcfpc/examples/devices/Makefile.fpc
@@ -3,7 +3,7 @@
#
[target]
-dirs=network usbkeyboard #usbgecko
+dirs=network usbkeyboard usbgecko
[require]
packages=libogcfpc
diff --git a/packages/libogcfpc/examples/devices/usbgecko/Makefile.fpc b/packages/libogcfpc/examples/devices/usbgecko/Makefile.fpc
index 1aba47853b..cb03ed235d 100644
--- a/packages/libogcfpc/examples/devices/usbgecko/Makefile.fpc
+++ b/packages/libogcfpc/examples/devices/usbgecko/Makefile.fpc
@@ -3,7 +3,7 @@
#
[target]
-dirs=#gdbstub
+dirs=gdbstub
[require]
packages=libogcfpc
diff --git a/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile b/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile
index 5dc815f6a8..f4c0130786 100644
--- a/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile
+++ b/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile
@@ -283,7 +283,7 @@ override CLEAN_FILES+=*.elf *.o *.s *.h *.bin *.map $(BUILD)/* $(INC)/*
endif
override INSTALL_FPCPACKAGE=y
ifeq ($(FULL_TARGET),powerpc-wii)
-override COMPILER_OPTIONS+=-g -Xm
+override COMPILER_OPTIONS+=-g -Xm -k--gc-sections
endif
ifdef REQUIRE_UNITSDIR
override UNITSDIR+=$(REQUIRE_UNITSDIR)
diff --git a/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile.fpc b/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile.fpc
index 663e5ecc99..271ccac6fa 100644
--- a/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile.fpc
+++ b/packages/libogcfpc/examples/devices/usbgecko/gdbstub/Makefile.fpc
@@ -20,7 +20,7 @@ target=wii
fpcdir=../../../../../..
[compiler]
-options=-g -Xm
+options=-g -Xm -k--gc-sections
[clean]
files=*.elf *.o *.s *.h *.bin *.map \
diff --git a/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile b/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile
index 4dbac1a020..fe85b79baf 100644
--- a/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile
+++ b/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile
@@ -270,8 +270,8 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
ifeq ($(FULL_TARGET),powerpc-wii)
override TARGET_PROGRAMS+=gxsprites
endif
@@ -1643,10 +1643,12 @@ ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
dir_make:
ifneq ($(BUILD), $(CURDIR))
@@ -1658,17 +1660,16 @@ endif
ifneq ($(DATA), $(CURDIR))
@$(MKDIR) $(DATA)
endif
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef
diff --git a/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile.fpc b/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile.fpc
index 49e1be6c9c..011ae4086f 100644
--- a/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile.fpc
+++ b/packages/libogcfpc/examples/graphics/gx/gxSprites/Makefile.fpc
@@ -3,7 +3,7 @@
#
[target]
-loaders=
+loaders=
programs=gxsprites
[require]
@@ -33,19 +33,21 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
[rules]
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
#
@@ -65,22 +67,21 @@ endif
#
# Textures processing rule
#
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+
-
#
# Binary files processing rule
#
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef \ No newline at end of file
diff --git a/packages/libogcfpc/examples/graphics/gx/gxSprites/gxsprites.pp b/packages/libogcfpc/examples/graphics/gx/gxSprites/gxsprites.pp
index 64c35c9095..013a3ae6d0 100644
--- a/packages/libogcfpc/examples/graphics/gx/gxSprites/gxsprites.pp
+++ b/packages/libogcfpc/examples/graphics/gx/gxSprites/gxsprites.pp
@@ -5,7 +5,7 @@ program gxsprites;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
{$include inc/textures.tpl.inc}
{$link build/textures.tpl.o}
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson1/lesson1.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson1/lesson1.pp
index f18cb4df9b..1169a3b22d 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson1/lesson1.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson1/lesson1.pp
@@ -4,7 +4,7 @@ program lesson1;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
const
DEFAULT_FIFO_SIZE = (256*1024);
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson2/lesson2.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson2/lesson2.pp
index fcc7bd712e..b171f550ff 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson2/lesson2.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson2/lesson2.pp
@@ -4,7 +4,7 @@ program lesson2;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
const
DEFAULT_FIFO_SIZE = (256*1024);
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson3/lesson3.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson3/lesson3.pp
index ece9cfa5c1..a369133316 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson3/lesson3.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson3/lesson3.pp
@@ -4,7 +4,7 @@ program lesson3;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
const
DEFAULT_FIFO_SIZE = (256*1024);
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson4/lesson4.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson4/lesson4.pp
index f3094bdc84..b66a00f197 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson4/lesson4.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson4/lesson4.pp
@@ -5,7 +5,7 @@ program lesson4;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
const
DEFAULT_FIFO_SIZE = (256 * 1024);
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson5/lesson5.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson5/lesson5.pp
index 5c1264becd..0affebedce 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson5/lesson5.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson5/lesson5.pp
@@ -5,7 +5,7 @@ program lesson5;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
const
DEFAULT_FIFO_SIZE = (256 * 1024);
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile
index 2109732b40..a76476280b 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile
@@ -270,8 +270,8 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
ifeq ($(FULL_TARGET),powerpc-wii)
override TARGET_PROGRAMS+=lesson6
endif
@@ -1643,10 +1643,12 @@ ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
dir_make:
ifneq ($(BUILD), $(CURDIR))
@@ -1658,17 +1660,16 @@ endif
ifneq ($(DATA), $(CURDIR))
@$(MKDIR) $(DATA)
endif
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile.fpc b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile.fpc
index 69cd9ed05c..8ccdc2fdee 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile.fpc
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/Makefile.fpc
@@ -33,19 +33,21 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
[rules]
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
#
@@ -65,22 +67,21 @@ endif
#
# Textures processing rule
#
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+
-
#
# Binary files processing rule
#
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef \ No newline at end of file
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/lesson6.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/lesson6.pp
index d173dd6523..6bbb38c43d 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/lesson6.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson6/lesson6.pp
@@ -5,7 +5,7 @@ program lesson6;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
{$include inc/NeHe.tpl.inc}
{$link build/NeHe.tpl.o}
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile
index 4a96e70452..97a1d91878 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile
@@ -270,8 +270,8 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
ifeq ($(FULL_TARGET),powerpc-wii)
override TARGET_PROGRAMS+=lesson7
endif
@@ -1643,10 +1643,12 @@ ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
dir_make:
ifneq ($(BUILD), $(CURDIR))
@@ -1658,17 +1660,16 @@ endif
ifneq ($(DATA), $(CURDIR))
@$(MKDIR) $(DATA)
endif
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile.fpc b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile.fpc
index bd84d8ff82..020677d8dc 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile.fpc
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/Makefile.fpc
@@ -33,19 +33,21 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
[rules]
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
#
@@ -65,22 +67,21 @@ endif
#
# Textures processing rule
#
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+
-
#
# Binary files processing rule
#
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef \ No newline at end of file
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/lesson7.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/lesson7.pp
index 91a467637b..c242d98a39 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/lesson7.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson7/lesson7.pp
@@ -5,7 +5,7 @@ program lesson7;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
{$include inc/crate.tpl.inc}
{$link build/crate.tpl.o}
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile
index 29e5c3138d..db45651d12 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile
@@ -270,8 +270,8 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
ifeq ($(FULL_TARGET),powerpc-wii)
override TARGET_PROGRAMS+=lesson8
endif
@@ -1643,10 +1643,12 @@ ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
dir_make:
ifneq ($(BUILD), $(CURDIR))
@@ -1658,17 +1660,16 @@ endif
ifneq ($(DATA), $(CURDIR))
@$(MKDIR) $(DATA)
endif
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile.fpc b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile.fpc
index db4dd3d865..d79da2de96 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile.fpc
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/Makefile.fpc
@@ -33,19 +33,21 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
[rules]
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
#
@@ -65,22 +67,21 @@ endif
#
# Textures processing rule
#
-$(TPL_FILES): $(wildcard %.scf)
+$(TPL_FILES):
@echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+
-
#
# Binary files processing rule
#
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef \ No newline at end of file
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/lesson8.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/lesson8.pp
index b593823b2e..54092eb946 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/lesson8.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson8/lesson8.pp
@@ -5,7 +5,7 @@ program lesson8;
{$mode objfpc}
uses
- cmem, ctypes, gccore, math;
+ cmem, ctypes, gctypes, gccore, math;
{$include inc/glass.tpl.inc}
{$link build/glass.tpl.o}
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile
index a0a16c774c..3b3dcdb190 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile
@@ -270,8 +270,8 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
ifeq ($(FULL_TARGET),powerpc-wii)
override TARGET_PROGRAMS+=lesson9
endif
@@ -1643,10 +1643,12 @@ ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
dir_make:
ifneq ($(BUILD), $(CURDIR))
@@ -1658,17 +1660,16 @@ endif
ifneq ($(DATA), $(CURDIR))
@$(MKDIR) $(DATA)
endif
-$(TPL_FILES): $(wildcard %.scf)
- @echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
- @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+$(TPL_FILES):
+ @echo 'Creating tpl file...'
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
+ @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile.fpc b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile.fpc
index 01a9f2992b..99d0c55c90 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile.fpc
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/Makefile.fpc
@@ -33,19 +33,21 @@ BUILD = build
INC = inc
DATA = data
TEXTURES = textures
-TPL_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+SCF_FILES = $(foreach dir,textures,$(notdir $(wildcard $(dir)/*.scf)))
+TPL_FILES = $(basename $(SCF_FILES)).tpl
[rules]
.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(TPL_FILES) $(BIN_FILES) fpc_all
+.PHONY: clean all
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(TPL_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(DATA)
@$(DELTREE) $(CURDIR)/$(INC)
#
@@ -65,22 +67,21 @@ endif
#
# Textures processing rule
#
-$(TPL_FILES): $(wildcard %.scf)
- @echo 'Creating tpl file...'
- $(GXTEXCONV) -s textures/$(@) -o $(DATA)/$(basename $(@)).tpl
+$(TPL_FILES):
+ @echo 'Creating tpl file...'
+ $(GXTEXCONV) -s textures/$(SCF_FILES) -o $(DATA)/$(TPL_FILES)
+ @echo $(DATA)/$(TPL_FILES)
+ @$(bin2o)
+
-
#
# Binary files processing rule
#
-$(BIN_FILES): $(wildcard %.*)
- @echo 'Converting $(@) file to asm...'
- @$(BIN2S) -a 32 data/$(@) > $(BUILD)/$(@).s
- @echo 'Creating $(@).inc include file...'
- @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
- @echo 'Assembling $(@).s file...'
- @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
- @echo 'Done!'
+define bin2o
+ @$(BIN2S) -a 32 $(DATA)/$(@) > $(BUILD)/$(@).s
+ @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
+ @echo "var" > `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo $(INC)"/"$(@F) | tr . .)`.inc
+endef \ No newline at end of file
diff --git a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/lesson9.pp b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/lesson9.pp
index 4f2dd62ab6..eb81a15e14 100644
--- a/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/lesson9.pp
+++ b/packages/libogcfpc/examples/graphics/gx/neheGX/lesson9/lesson9.pp
@@ -5,7 +5,7 @@ program lesson9;
{$mode objfpc}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
{$include inc/startex.tpl.inc}
{$link build/startex.tpl.o}
diff --git a/packages/libogcfpc/examples/graphics/gx/triangle/triangle.pp b/packages/libogcfpc/examples/graphics/gx/triangle/triangle.pp
index e833a1874e..8c7b004930 100644
--- a/packages/libogcfpc/examples/graphics/gx/triangle/triangle.pp
+++ b/packages/libogcfpc/examples/graphics/gx/triangle/triangle.pp
@@ -6,7 +6,7 @@ program triangle;
{$inline on}
uses
- cmem, ctypes, gccore;
+ cmem, ctypes, gctypes, gccore;
var
framebuffer: pcuint32;
diff --git a/packages/libogcfpc/fpmake.pp b/packages/libogcfpc/fpmake.pp
index ab3e55980c..d147c23d06 100644
--- a/packages/libogcfpc/fpmake.pp
+++ b/packages/libogcfpc/fpmake.pp
@@ -18,7 +18,7 @@ begin
{$endif ALLPACKAGES}
P.Version:='2.5.1';
P.SourcePath.Add('src');
-// P.Dependencies.Add('x11');
+ P.Dependencies.Add('mad');
// not linux compilable, skip
diff --git a/packages/libogcfpc/src/gccore.inc b/packages/libogcfpc/src/gccore.inc
index fd803d14ef..82160a0776 100644
--- a/packages/libogcfpc/src/gccore.inc
+++ b/packages/libogcfpc/src/gccore.inc
@@ -25,23 +25,23 @@
{$include ogc/gx_struct.inc}
{$include ogc/lwp.inc}
-{ $include ogc/lwp_config.inc}
-{ $include ogc/lwp_heap.inc}
-
-{ $include ogc/lwp_tqdata.inc}
-{ $include ogc/lwp_objmgr.inc}
-{ $include ogc/lwp_priority.inc}
-{ $include ogc/lwp_watchdog.inc}
-{ $include ogc/lwp_threads.inc}
-
-
-{ $include ogc/lwp_messages.inc}
-{ $include ogc/lwp_mutex.inc}
-{ $include ogc/lwp_sema.inc}
-{ $include ogc/lwp_stack.inc}
-{ $include ogc/lwp_states.inc}
-{ $include ogc/lwp_threadq.inc}
-{ $include ogc/lwp_wkspace.inc}
+ {$include ogc/lwp_config.inc}
+ {$include ogc/lwp_heap.inc}
+
+ {$include ogc/lwp_tqdata.inc}
+ {$include ogc/lwp_objmgr.inc}
+ {$include ogc/lwp_priority.inc}
+ {$include ogc/lwp_watchdog.inc}
+ {$include ogc/lwp_threads.inc} // tradurre lwp_threads.inl
+
+
+ {$include ogc/lwp_messages.inc}
+ {$include ogc/lwp_mutex.inc}
+ {$include ogc/lwp_sema.inc}
+ {$include ogc/lwp_stack.inc}
+ {$include ogc/lwp_states.inc}
+ {$include ogc/lwp_threadq.inc}
+ {$include ogc/lwp_wkspace.inc}
{$include ogc/gu.inc}
diff --git a/packages/libogcfpc/src/ogc/lwp_heap.inc b/packages/libogcfpc/src/ogc/lwp_heap.inc
index 6b5c405c04..3fb2468771 100644
--- a/packages/libogcfpc/src/ogc/lwp_heap.inc
+++ b/packages/libogcfpc/src/ogc/lwp_heap.inc
@@ -44,16 +44,10 @@ type
pheap_cntrl = ^heap_cntrl;
-function __lwp_heap_init(theheap: Pheap_cntrl; start_addr: pointer;
- size, pg_size: cuint32): cuint32; cdecl; external;
-
+function __lwp_heap_init(theheap: Pheap_cntrl; start_addr: pointer; size, pg_size: cuint32): cuint32; cdecl; external;
function __lwp_heap_allocate(theheap: Pheap_cntrl; size: cuint32): pointer; cdecl; external;
-
function __lwp_heap_free(theheap: Pheap_cntrl; ptr: pointer): cbool; cdecl; external;
-
-function __lwp_heap_getinfo(theheap: Pheap_cntrl; theinfo: Pheap_iblock)
- : cuint32; cdecl; external;
-
+function __lwp_heap_getinfo(theheap: Pheap_cntrl; theinfo: Pheap_iblock): cuint32; cdecl; external;
//{$ifdef LIBOGC_INTERNAL}
//{$include libogc/lwp_heap.inl}
@@ -61,3 +55,78 @@ function __lwp_heap_getinfo(theheap: Pheap_cntrl; theinfo: Pheap_iblock)
{$ENDIF}
+{$IFDEF OGC_IMPLEMENTATION}
+function __lwp_heap_head(theheap: pheap_cntrl): pheap_block;
+begin
+ result := theheap^.start;
+end;
+
+function __lwp_heap_tail(heap: pheap_cntrl): pheap_block;
+begin
+ result := heap^.final;
+end;
+
+function __lwp_heap_prevblock(block: pheap_block): pheap_block;
+begin
+ result := pheap_block (pcchar(block)^ - (block^.back_flag and not HEAP_BLOCK_USED));
+end;
+
+function __lwp_heap_nextblock(block: pheap_block): pheap_block;
+begin
+ result := pheap_block(pcchar(block)^ + (block^.front_flag and not HEAP_BLOCK_USED));
+end;
+
+function __lwp_heap_blockat(block: pheap_block; offset: cuint32): pheap_block;
+begin
+ result := pheap_block(pcchar(block) + offset);
+end;
+
+function __lwp_heap_usrblockat(ptr: pointer): pheap_block;
+var
+ offset: cuint32;
+begin
+ offset := (pcuint32(ptr)^ - 1);
+ result := __lwp_heap_blockat(ptr, -offset + (-HEAP_BLOCK_USED_OVERHEAD));
+end;
+
+function __lwp_heap_prev_blockfree(block: pheap_block): boolean;
+begin
+ result := (block^.back_flag and HEAP_BLOCK_USED) = 0;
+end;
+
+function __lwp_heap_blockfree(block: pheap_block): boolean;
+begin
+ result := (block^.front_flag and HEAP_BLOCK_USED) = 0;
+end;
+
+function __lwp_heap_blockused(block: pheap_block): boolean;
+begin
+ result := (block^.front_flag and HEAP_BLOCK_USED) <> 0;
+end;
+
+function __lwp_heap_blocksize(block: pheap_block): cuint32;
+begin
+ result := (block^.front_flag and not HEAP_BLOCK_USED);
+end;
+
+function __lwp_heap_startuser(block: pheap_block): pointer;
+begin
+ result := pointer(block^.next);
+end;
+
+function __lwp_heap_blockin(heap: pheap_cntrl; block: pheap_block): boolean;
+begin
+ result := ((cuint32(block) >= cuint32(heap^.start)) and (cuint32(block) <= cuint32(heap^.final)));
+end;
+
+function __lwp_heap_pgsize_valid(pgsize: cuint32): boolean;
+begin
+ result := (pgsize <> 0) and ((pgsize mod PPC_ALIGNMENT) = 0);
+end;
+
+function __lwp_heap_buildflag(size, flag: cuint32): cuint32;
+begin
+ result := (size or flag);
+end;
+{$ENDIF}
+
diff --git a/packages/libogcfpc/src/ogc/lwp_mutex.inc b/packages/libogcfpc/src/ogc/lwp_mutex.inc
index be01108f58..00277c38e3 100644
--- a/packages/libogcfpc/src/ogc/lwp_mutex.inc
+++ b/packages/libogcfpc/src/ogc/lwp_mutex.inc
@@ -49,8 +49,7 @@ procedure __lwp_mutex_seize_irq_blocking(mutex: Plwp_mutex; timeout: cuint64); c
procedure __lwp_mutex_flush(mutex: Plwp_mutex; status: cuint32); cdecl; external;
-
-function __lwp_mutex_seize_irq_trylock(mutex: plwp_mutex; isr_level: pcuint32): cuint32; cdecl; external;
+function __lwp_mutex_seize_irq_trylock(mutex: plwp_mutex; isr_level: pcuint32): cuint32; inline;
procedure __lwp_mutex_seize(_mutex_t: plwp_mutex; _id: cuint32; _wait: cuint8; _timeout, _level: cuint32); inline;
@@ -58,6 +57,32 @@ procedure __lwp_mutex_seize(_mutex_t: plwp_mutex; _id: cuint32; _wait: cuint8; _
{$IFDEF OGC_IMPLEMENTATION}
+
+function __lwp_mutex_locked(mutex: plwp_mutex): boolean;
+begin
+ result := (mutex^.lock = LWP_MUTEX_LOCKED);
+end;
+
+function __lwp_mutex_isinheritprio(attrs: plwp_mutex_attr): boolean;
+begin
+ result := (attrs^.mode = LWP_MUTEX_INHERITPRIO);
+end;
+
+function __lwp_mutex_isprioceiling(attrs: plwp_mutex_attr): boolean;
+begin
+ result := (attrs^.mode = LWP_MUTEX_PRIORITYCEIL);
+end;
+
+function __lwp_mutex_ispriority(attrs: plwp_mutex_attr): boolean;
+begin
+ result := (attrs^.mode = LWP_MUTEX_PRIORITY);
+end;
+
+function __lwp_mutex_isfifo(attrs: plwp_mutex_attr): boolean;
+begin
+ result := (attrs^.mode = LWP_MUTEX_FIFO);
+end;
+
procedure __lwp_mutex_seize(_mutex_t: plwp_mutex; _id: cuint32; _wait: cuint8; _timeout, _level: cuint32); inline;
begin
repeat
@@ -79,6 +104,76 @@ begin
end;
until false;
end;
+
+function __lwp_mutex_seize_irq_trylock(mutex: plwp_mutex; isr_level: pcuint32): cuint32; inline;
+var
+ exec: plwp_cntrl;
+ level: cuint32;
+ prioceiling, priocurr: cuint32;
+begin
+ level := isr_level^;
+ exec := _thr_executing;
+ exec^.wait.ret_code := LWP_MUTEX_SUCCESSFUL;
+ if not __lwp_mutex_locked(mutex) then
+ begin
+ mutex^.lock := LWP_MUTEX_LOCKED;
+ mutex^.holder := exec;
+ mutex^.nest_cnt := 1;
+ if __lwp_mutex_isinheritprio(@(mutex^.atrrs)) or __lwp_mutex_isprioceiling(@(mutex^.atrrs)) then
+ inc(exec^.res_cnt);
+ if not __lwp_mutex_isprioceiling(@(mutex^.atrrs)) then
+ begin
+ _CPU_ISR_Restore(level);
+ result := 0;
+ end;
+ begin
+ prioceiling := mutex^.atrrs.prioceil;
+ priocurr := exec^.cur_prio;
+ if (priocurr = prioceiling) then
+ begin
+ _CPU_ISR_Restore(level);
+ result := 0;
+ end;
+ if (priocurr > prioceiling) then
+ begin
+ __lwp_thread_dispatchdisable();
+ _CPU_ISR_Restore(level);
+ __lwp_thread_changepriority(mutex^.holder, mutex^.atrrs.prioceil, 0);
+ __lwp_thread_dispatchenable();
+ result := 0;
+ end;
+ exec^.wait.ret_code := LWP_MUTEX_CEILINGVIOL;
+ mutex^.nest_cnt := 0;
+ dec(exec^.res_cnt);
+ _CPU_ISR_Restore(level);
+ result := 0;
+ end;
+ result := 0;
+ end;
+
+ if (__lwp_thread_isexec(mutex^.holder)) <> 0 then
+ begin
+ case mutex^.atrrs.nest_behavior of
+ LWP_MUTEX_NEST_ACQUIRE:
+ begin
+ inc(mutex^.nest_cnt);
+ _CPU_ISR_Restore(level);
+ result := 0;
+ end;
+ LWP_MUTEX_NEST_ERROR:
+ begin
+ exec^.wait.ret_code := LWP_MUTEX_NEST_NOTALLOWED;
+ _CPU_ISR_Restore(level);
+ result := 0;
+ end;
+ LWP_MUTEX_NEST_BLOCK:
+ begin
+ end;
+ end;
+ end;
+ result := 1;
+end;
+
//{$ifdef LIBOGC_INTERNAL}
//{$include libogc/lwp_mutex.inl}
//{$endif}
diff --git a/packages/libogcfpc/src/ogc/lwp_priority.inc b/packages/libogcfpc/src/ogc/lwp_priority.inc
index ef8fcab64f..ed6b776698 100644
--- a/packages/libogcfpc/src/ogc/lwp_priority.inc
+++ b/packages/libogcfpc/src/ogc/lwp_priority.inc
@@ -29,3 +29,52 @@ procedure __lwp_priority_init; cdecl; external;
//{$endif}
{$ENDIF}
+
+{$IFDEF OGC_IMPLEMENTATION}
+procedure __lwp_priomap_init(theprio: pprio_cntrl; prio: cuint32);
+var
+ major,minor,mask: cuint32;
+begin
+ major := prio div 16;
+ minor := prio mod 16;
+
+ theprio^.minor := @(_prio_bitmap[major]);
+
+ mask := $80000000 shr major;
+ theprio^.ready_major := mask;
+ theprio^.block_major := not mask;
+
+ mask := $80000000 shr minor;
+ theprio^.ready_minor := mask;
+ theprio^.block_minor := not mask;
+//#ifdef _LWPPRIO_DEBUG
+// printf("__lwp_priomap_init(%p,%d,%p,%d,%d,%d,%d)\n",theprio,prio,theprio->minor,theprio->ready_major,theprio->ready_minor,theprio->block_major,theprio->block_minor);
+//#endif
+end;
+
+procedure __lwp_priomap_addto(theprio: pprio_cntrl);
+begin
+ theprio^.minor^ := theprio^.minor^ or theprio^.ready_minor;
+ _prio_major_bitmap := _prio_major_bitmap or theprio^.ready_major;
+end;
+
+procedure __lwp_priomap_removefrom(theprio: pprio_cntrl);
+begin
+ theprio^.minor^ := theprio^.minor^ and theprio^.block_minor;
+ if theprio^.minor^ = 0 then
+ _prio_major_bitmap := _prio_major_bitmap and theprio^.block_major;
+end;
+
+function __lwp_priomap_highest(): cuint32;
+var
+ major, minor: cuint32;
+begin
+ major := cntlzw(_prio_major_bitmap);
+ minor := cntlzw(_prio_bitmap[major]);
+//#ifdef _LWPPRIO_DEBUG
+// printf("__lwp_priomap_highest(%d)\n",((major<<4)+minor));
+//#endif
+ result := ((major shl 4) + minor);
+end;
+{$ENDIF}
+
diff --git a/packages/libogcfpc/src/ogc/lwp_threads.inc b/packages/libogcfpc/src/ogc/lwp_threads.inc
index bbdb739b2b..485d7464a5 100644
--- a/packages/libogcfpc/src/ogc/lwp_threads.inc
+++ b/packages/libogcfpc/src/ogc/lwp_threads.inc
@@ -133,9 +133,102 @@ procedure __lwp_thread_dispatchdisable(); inline;
{$ENDIF}
{$IFDEF OGC_IMPLEMENTATION}
-procedure __lwp_thread_dispatchdisable(); inline;
+function __lwp_thread_isexec(thethread: plwp_cntrl): cuint32;
+begin
+ result := 0;
+ if (thethread = _thr_executing) then result := 1;
+end;
+
+function __lwp_thread_isheir(thethread: plwp_cntrl): cuint32;
+begin
+ result := 0;
+ if (thethread = _thr_heir) then result := 1;
+end;
+
+procedure __lwp_thread_calcheir();
+begin
+ _thr_heir := plwp_cntrl(_lwp_thr_ready[__lwp_priomap_highest()].first);
+//#ifdef _LWPTHREADS_DEBUG
+// printf("__lwp_thread_calcheir(%p)\n",_thr_heir);
+//#endif
+end;
+
+function __lwp_thread_isallocatedfp(thethread: plwp_cntrl): cuint32;
+begin
+ result := 0;
+ if (thethread = _thr_allocated_fp) then result := 1;
+end;
+
+procedure __lwp_thread_deallocatefp();
+begin
+ _thr_allocated_fp := nil;
+end;
+
+procedure __lwp_thread_dispatchinitialize();
+begin
+ _thread_dispatch_disable_level := 1;
+end;
+
+procedure __lwp_thread_dispatchenable();
+begin
+ dec(_thread_dispatch_disable_level);
+ if (_thread_dispatch_disable_level = 0) then
+ __thread_dispatch();
+end;
+
+procedure __lwp_thread_dispatchdisable();
+begin
+ inc(_thread_dispatch_disable_level);
+end;
+
+procedure __lwp_thread_dispatchunnest();
begin
- inc(_thread_dispatch_disable_level);
+ dec(_thread_dispatch_disable_level);
end;
+
+procedure __lwp_thread_unblock(thethread: plwp_cntrl);
+begin
+ __lwp_thread_clearstate(thethread, LWP_STATES_BLOCKED);
+end;
+
+function __lwp_thread_getlibcreent(): pointer;
+begin
+ result := __lwp_thr_libc_reent;
+end;
+
+procedure __lwp_thread_setlibcreent(libc_reent: pointer);
+begin
+ __lwp_thr_libc_reent := libc_reent;
+end;
+
+function __lwp_thread_isswitchwant(): cbool;
+begin
+ result := cbool(_context_switch_want);
+end;
+
+function __lwp_thread_isdispatchenabled(): cbool;
+begin
+ result := (_thread_dispatch_disable_level = 0);
+end;
+
+procedure __lwp_thread_inittimeslice();
+begin
+ __lwp_wd_initialize(@_lwp_wd_timeslice, @__lwp_thread_tickle_timeslice, LWP_TIMESLICE_TIMER_ID, nil);
+end;
+
+procedure __lwp_thread_starttimeslice();
+begin
+ __lwp_wd_insert_ticks(@_lwp_wd_timeslice, millisecs_to_ticks(1));
+end;
+
+procedure __lwp_thread_stoptimeslice();
+begin
+ __lwp_wd_remove_ticks(@_lwp_wd_timeslice);
+end;
+
+//procedure __lwp_thread_dispatchdisable(); inline;
+//begin
+// inc(_thread_dispatch_disable_level);
+//end;
{$ENDIF}
diff --git a/packages/libogcfpc/src/ogc/lwp_watchdog.inc b/packages/libogcfpc/src/ogc/lwp_watchdog.inc
index 3482ab39aa..354a7d0694 100644
--- a/packages/libogcfpc/src/ogc/lwp_watchdog.inc
+++ b/packages/libogcfpc/src/ogc/lwp_watchdog.inc
@@ -173,4 +173,87 @@ begin
result := -x;
end;
+
+procedure __lwp_wd_initialize(wd: pwd_cntrl; routine: wd_service_routine; id: cuint32; usr_data: pointer);
+begin
+ wd^.state := LWP_WD_INACTIVE;
+ wd^.id := id;
+ wd^.routine := routine;
+ wd^.usr_data := usr_data;
+end;
+
+function __lwp_wd_first(queue: plwp_queue): pwd_cntrl;
+begin
+ result := pwd_cntrl(@(queue^.first));
+end;
+
+function __lwp_wd_last(queue: plwp_queue): pwd_cntrl;
+begin
+ result := pwd_cntrl(@(queue^.last));
+end;
+
+function __lwp_wd_next(wd: pwd_cntrl): pwd_cntrl;
+begin
+ result := pwd_cntrl(@(wd^.node.next));
+end;
+
+function __lwp_wd_prev(wd: pwd_cntrl): pwd_cntrl;
+begin
+ result := pwd_cntrl(@(wd^.node.prev));
+end;
+
+procedure __lwp_wd_activate(wd: pwd_cntrl);
+begin
+ wd^.state := LWP_WD_ACTIVE;
+end;
+
+procedure __lwp_wd_deactivate(wd: pwd_cntrl);
+begin
+ wd^.state := LWP_WD_REMOVE;
+end;
+
+function __lwp_wd_isactive(wd: pwd_cntrl): cuint32;
+begin
+ result := 0;
+ if (wd^.state = LWP_WD_ACTIVE) then result := 1;
+end;
+
+function __lwp_wd_calc_ticks(const time: ptimespec): cuint64;
+var
+ ticks: cuint64;
+begin
+ ticks := secs_to_ticks(time^.tv_sec);
+ ticks := ticks + nanosecs_to_ticks(time^.tv_nsec);
+ result := ticks;
+end;
+
+procedure __lwp_wd_tickle_ticks();
+begin
+ __lwp_wd_tickle(@_wd_ticks_queue);
+end;
+
+procedure __lwp_wd_insert_ticks(wd: pwd_cntrl; interval: cint64);
+begin
+ wd^.start := gettime();
+ wd^.fire := (wd^.start + LWP_WD_ABS(interval));
+ __lwp_wd_insert(@_wd_ticks_queue, wd);
+end;
+
+procedure __lwp_wd_adjust_ticks(dir: cuint32; interval: cint64);
+begin
+ __lwp_wd_adjust(@_wd_ticks_queue,dir,interval);
+end;
+
+procedure __lwp_wd_remove_ticks(wd: pwd_cntrl);
+begin
+ __lwp_wd_remove(@_wd_ticks_queue,wd);
+end;
+
+procedure __lwp_wd_reset(wd: pwd_cntrl);
+begin
+ __lwp_wd_remove(@_wd_ticks_queue,wd);
+ __lwp_wd_insert(@_wd_ticks_queue,wd);
+end;
+
+
{$ENDIF}
diff --git a/packages/libogcfpc/src/ogc/machine/processor.inc b/packages/libogcfpc/src/ogc/machine/processor.inc
index f6ba329b56..48e32b368d 100644
--- a/packages/libogcfpc/src/ogc/machine/processor.inc
+++ b/packages/libogcfpc/src/ogc/machine/processor.inc
@@ -11,13 +11,13 @@ procedure ppchalt(); inline;
//procedure mfpvr(); inline;
function mfpvr(): cint32; inline;
-procedure mfdcr(_rn: cuint); inline;
+function mfdcr(_rn: cuint): cuint32; inline;
procedure mtdcr(rn, val: cuint); inline;
-procedure mfmsr(); inline;
+function mfmsr(): cuint32; inline;
procedure mtmsr(val: cuint); inline;
-procedure mfdec(); inline;
+function mfdec(): cuint32; inline;
procedure mtdec(_val: cuint); inline;
-procedure mfspr(_rn: cuint); inline;
+function mfspr(_rn: cuint): cuint32; inline;
procedure mtspr(_rn, _val: cuint); inline;
{$define mfwpar() := mfspr(WPAR)}
@@ -46,12 +46,12 @@ procedure mtspr(_rn, _val: cuint); inline;
{$define mfhid4() := mfspr(HID4)}
{$define mthid4(_val) := mtspr(HID4,_val)}
-procedure __lhbrx(base, index: cuint32); inline;
+function __lhbrx(base, index: cuint32): cuint16; inline;
//procedure __lwbrx(base,index: cuint32); inline;
function __lwbrx(base,index: cuint32): cuint32; inline;
procedure __sthbrx(base,index,value: cuint32); inline;
procedure __stwbrx(base,index,value: cuint32); inline;
-procedure cntlzw(_val: cuint32); inline;
+function cntlzw(_val: cuint32): cuint32; inline;
procedure _CPU_MSR_GET( _msr_value: cuint32 ); inline;
procedure _CPU_MSR_SET( _msr_value: cuint32 ); inline;
procedure _CPU_ISR_Enable(); inline;
@@ -118,13 +118,14 @@ begin
result := _rval;
end;
-procedure mfdcr(_rn: cuint); inline;
+function mfdcr(_rn: cuint): cuint32; inline;
var
_rval: cuint32;
begin
asm
// mfdcr r3,_rn // unrecognized opcode?
end;
+ result := _rval;
end;
procedure mtdcr(rn, val: cuint); inline;
@@ -134,13 +135,14 @@ begin
end;
end;
-procedure mfmsr(); inline;
+function mfmsr(): cuint32; inline;
var
_rval: cuint32;
begin
asm
mfmsr r3
end;
+ result := _rval;
end;
procedure mtmsr(val: cuint); inline;
@@ -150,7 +152,7 @@ begin
end;
end;
-procedure mfdec(); inline;
+function mfdec(): cuint32; inline;
var
_rval: cuint32;
begin
@@ -158,6 +160,7 @@ begin
// mfdec r3 // unrecognized opcode?
mfspr r3,22 // unrecognized opcode?
end;
+ result := _rval;
end;
procedure mtdec(_val: cuint); inline;
@@ -168,13 +171,14 @@ begin
end;
end;
-procedure mfspr(_rn: cuint); inline;
+function mfspr(_rn: cuint): cuint32; inline;
var
_rval: cuint32 = 0;
begin
asm
mfspr r3,r4
end;
+ result := _rval;
end;
procedure mtspr(_rn, _val: cuint); inline;
@@ -184,13 +188,14 @@ begin
end;
end;
-procedure __lhbrx(base, index: cuint32); inline;
+function __lhbrx(base, index: cuint32): cuint16; inline;
var
res: cuint16;
begin
asm
lhbrx r3,r4,r5
end;
+ result := res;
end;
//procedure __lwbrx(base,index: cuint32); inline;
@@ -218,13 +223,14 @@ begin
end;
end;
-procedure cntlzw(_val: cuint32); inline;
+function cntlzw(_val: cuint32): cuint32; inline;
var
_rval: cuint32;
begin
asm
cntlzw r3, r4
end;
+ result := _rval;
end;
procedure _CPU_MSR_GET( _msr_value: cuint32 ); inline;
@@ -327,7 +333,7 @@ var
tmp: cuint16;
begin
tmp := val;
- __lhbrx(tmp,0); //??
+ result := __lhbrx(tmp,0); //??
end;
function bswap32(val: cuint32): cuint32; inline;