ray 0.0.0.pre1 → 0.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/.gitmodules +3 -0
- data/Rakefile +148 -5
- data/VERSION +1 -1
- data/ext/event.c +535 -0
- data/ext/extconf.rb +7 -1
- data/ext/image.c +110 -18
- data/ext/joystick.c +145 -0
- data/ext/ray.c +288 -35
- data/ext/ray.h +54 -2
- data/lib/ray/config.rb +84 -0
- data/lib/ray/dsl.rb +19 -0
- data/lib/ray/dsl/converter.rb +65 -0
- data/lib/ray/dsl/event.rb +52 -0
- data/lib/ray/dsl/event_raiser.rb +21 -0
- data/lib/ray/dsl/event_runner.rb +39 -0
- data/lib/ray/dsl/event_translator.rb +38 -0
- data/lib/ray/dsl/handler.rb +71 -0
- data/lib/ray/dsl/listener.rb +30 -0
- data/lib/ray/dsl/matcher.rb +60 -0
- data/lib/ray/dsl/type.rb +58 -0
- data/lib/ray/game.rb +107 -0
- data/lib/ray/helper.rb +17 -0
- data/lib/ray/image.rb +11 -0
- data/lib/ray/ray.rb +8 -0
- data/lib/ray/scene.rb +102 -0
- data/psp/SDL_psp_main.c +84 -0
- data/psp/bigdecimal/README +60 -0
- data/psp/bigdecimal/bigdecimal.c +4697 -0
- data/psp/bigdecimal/bigdecimal.h +216 -0
- data/psp/bigdecimal/lib/bigdecimal/jacobian.rb +85 -0
- data/psp/bigdecimal/lib/bigdecimal/ludcmp.rb +84 -0
- data/psp/bigdecimal/lib/bigdecimal/math.rb +235 -0
- data/psp/bigdecimal/lib/bigdecimal/newton.rb +77 -0
- data/psp/bigdecimal/lib/bigdecimal/util.rb +65 -0
- data/psp/digest/bubblebabble/bubblebabble.c +142 -0
- data/psp/digest/defs.h +20 -0
- data/psp/digest/digest.c +643 -0
- data/psp/digest/digest.h +32 -0
- data/psp/digest/lib/digest.rb +50 -0
- data/psp/digest/lib/md5.rb +27 -0
- data/psp/digest/lib/sha1.rb +27 -0
- data/psp/digest/md5/md5.c +420 -0
- data/psp/digest/md5/md5.h +80 -0
- data/psp/digest/md5/md5init.c +40 -0
- data/psp/digest/rmd160/rmd160.c +457 -0
- data/psp/digest/rmd160/rmd160.h +56 -0
- data/psp/digest/rmd160/rmd160init.c +40 -0
- data/psp/digest/sha1/sha1.c +269 -0
- data/psp/digest/sha1/sha1.h +39 -0
- data/psp/digest/sha1/sha1init.c +40 -0
- data/psp/digest/sha2/lib/sha2.rb +73 -0
- data/psp/digest/sha2/sha2.c +919 -0
- data/psp/digest/sha2/sha2.h +109 -0
- data/psp/digest/sha2/sha2init.c +52 -0
- data/psp/enumerator/enumerator.c +298 -0
- data/psp/etc/etc.c +559 -0
- data/psp/ext.c +285 -0
- data/psp/fcntl/fcntl.c +187 -0
- data/psp/lib/rbconfig.rb +178 -0
- data/psp/nkf/lib/kconv.rb +367 -0
- data/psp/nkf/nkf-utf8/config.h +88 -0
- data/psp/nkf/nkf-utf8/nkf.c +6040 -0
- data/psp/nkf/nkf-utf8/utf8tbl.c +8500 -0
- data/psp/nkf/nkf-utf8/utf8tbl.h +34 -0
- data/psp/nkf/nkf.c +654 -0
- data/psp/socket/addrinfo.h +173 -0
- data/psp/socket/getaddrinfo.c +676 -0
- data/psp/socket/getnameinfo.c +270 -0
- data/psp/socket/pspsocket.c +71 -0
- data/psp/socket/pspsocket.h +28 -0
- data/psp/socket/socket.c +4662 -0
- data/psp/socket/sockport.h +76 -0
- data/psp/stringio/stringio.c +1306 -0
- data/psp/strscan/strscan.c +1320 -0
- data/psp/syck/bytecode.c +1166 -0
- data/psp/syck/emitter.c +1242 -0
- data/psp/syck/gram.c +1894 -0
- data/psp/syck/gram.h +79 -0
- data/psp/syck/handler.c +174 -0
- data/psp/syck/implicit.c +2990 -0
- data/psp/syck/node.c +408 -0
- data/psp/syck/rubyext.c +2367 -0
- data/psp/syck/syck.c +504 -0
- data/psp/syck/syck.h +456 -0
- data/psp/syck/token.c +2725 -0
- data/psp/syck/yaml2byte.c +257 -0
- data/psp/syck/yamlbyte.h +170 -0
- data/psp/thread/thread.c +1175 -0
- data/psp/zlib/zlib.c +3547 -0
- data/script.rb +10 -0
- data/spec/ray/config_spec.rb +90 -0
- data/spec/ray/conversion_spec.rb +43 -0
- data/spec/ray/event_spec.rb +191 -0
- data/spec/ray/image_spec.rb +43 -1
- data/spec/ray/joystick_spec.rb +17 -0
- data/spec/ray/matcher_spec.rb +73 -0
- data/spec/ray/ray_spec.rb +72 -1
- data/spec/ray/type_spec.rb +17 -0
- data/spec/res/aqua.bmp +0 -0
- data/spec/res/aqua.png +0 -0
- data/spec/res/not_a_jpeg.jpeg +0 -0
- data/spec_runner.rb +4 -0
- metadata +101 -9
- data/ext/Makefile +0 -189
- data/ext/ray +0 -0
- data/ext/ray.bundle +0 -0
- data/ext/ray_ext.bundle +0 -0
- data/ext/ray_ext.so +0 -0
- data/ext/test.rb +0 -21
@@ -0,0 +1,30 @@
|
|
1
|
+
module Ray
|
2
|
+
module DSL
|
3
|
+
# The module that allows you to do something when something else happened.
|
4
|
+
module Listener
|
5
|
+
# The args part of this method may help you to say when you want your
|
6
|
+
# block to be called. Each argument applies to one argument of the
|
7
|
+
# event, and they must all match or your block won't get called.
|
8
|
+
#
|
9
|
+
# It will use == to see if two objects match, except in two cases: if you
|
10
|
+
# pass a Matcher, it will use match?, and if you pass a regex it will try
|
11
|
+
# to use =~.
|
12
|
+
#
|
13
|
+
# Your block will be called with the same arguments as the event, just in
|
14
|
+
# case you'd need them.
|
15
|
+
#
|
16
|
+
def on(event, *args, &block)
|
17
|
+
return unless listener_runner
|
18
|
+
listener_runner.add_handler(event, args, block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def listener_runner
|
22
|
+
@__listener_runner
|
23
|
+
end
|
24
|
+
|
25
|
+
def listener_runner=(arg)
|
26
|
+
@__listener_runner = arg
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Ray
|
2
|
+
# This is the module including all of your matchers as private methods,
|
3
|
+
# allowing you to use them when you call on.
|
4
|
+
module Matchers; end
|
5
|
+
|
6
|
+
module DSL
|
7
|
+
class Matcher
|
8
|
+
def initialize(target, &block)
|
9
|
+
@target = Ray.resolve_type(target)
|
10
|
+
@block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [true, false] True if we can match on the object of that class
|
14
|
+
def can_match_on?(klass)
|
15
|
+
Ray.resolve_type(klass).ancestors.include? @target
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [true, false] True if the block this object was created with
|
19
|
+
# returns true when called with obj.
|
20
|
+
def match?(obj)
|
21
|
+
can_match_on?(obj.class) && @block.call(obj)
|
22
|
+
end
|
23
|
+
|
24
|
+
alias :=== :match?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Describes a new matcher.
|
29
|
+
#
|
30
|
+
# @param [Symbol] name The name you'll use to call your matcher
|
31
|
+
# @param [Symbol, Module] target the type on which the matcher operates.
|
32
|
+
# @param [Proc] create_block a block called with the arguments of your matcher
|
33
|
+
# method, and returning the block that will be used
|
34
|
+
# to check if the condition is matched.
|
35
|
+
# @example
|
36
|
+
# Ray.describe_matcher(:match, :string) do |regex|
|
37
|
+
# lambda { |str| str =~ regex }
|
38
|
+
# end
|
39
|
+
def self.describe_matcher(name, target = :anything, &create_block)
|
40
|
+
Matchers.module_eval do
|
41
|
+
define_method(name) do |*args, &block|
|
42
|
+
DSL::Matcher.new(target, &create_block.call(*args, &block))
|
43
|
+
end
|
44
|
+
|
45
|
+
private name
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# This is the universal matcher, using a lambda so you can create
|
50
|
+
# an anonymous matcher if you only need it once, hence you don't want
|
51
|
+
# to name it.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# on :foo, where { |i| i > 10 } do |i|
|
55
|
+
# puts "#{i} is greater than 10!"
|
56
|
+
# end
|
57
|
+
describe_matcher(:where) do |&block|
|
58
|
+
lambda { |o| block.call(o) }
|
59
|
+
end
|
60
|
+
end
|
data/lib/ray/dsl/type.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
module Ray
|
2
|
+
module DSL
|
3
|
+
# The module that knows about all the type you registred.
|
4
|
+
module Type
|
5
|
+
@@types = {}
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def register_type(name, klass)
|
9
|
+
@@types[name] = klass
|
10
|
+
end
|
11
|
+
|
12
|
+
def know_type?(name)
|
13
|
+
(@@types[name] != nil)
|
14
|
+
end
|
15
|
+
|
16
|
+
def resolve_type(name)
|
17
|
+
@@types[name]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Registers a type. It allows you to say name instead of klass
|
24
|
+
# when Ray asks you for a typename.
|
25
|
+
# @param [Symbol] name The object that will represent klass
|
26
|
+
# @param [Module] klass The class name will be resolved as
|
27
|
+
def self.register_type(name, klass)
|
28
|
+
DSL::Type.register_type(name, klass)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [true, false] True if name is a known type
|
32
|
+
def self.know_type?(name)
|
33
|
+
DSL::Type.know_type?(name)
|
34
|
+
end
|
35
|
+
|
36
|
+
# @param [Module, Symbol] name An object supposed to identify a module or a
|
37
|
+
# class.
|
38
|
+
# @return [Module, nil] The matchig module
|
39
|
+
def self.resolve_type(name)
|
40
|
+
if name.is_a? Module
|
41
|
+
name
|
42
|
+
else
|
43
|
+
DSL::Type.resolve_type(name)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
register_type(:image, Ray::Image)
|
48
|
+
register_type(:color, Ray::Color)
|
49
|
+
|
50
|
+
register_type(:string, String)
|
51
|
+
register_type(:array, Array)
|
52
|
+
register_type(:hash, Hash)
|
53
|
+
register_type(:integer, Integer)
|
54
|
+
register_type(:float, Float)
|
55
|
+
register_type(:numeric, Numeric)
|
56
|
+
|
57
|
+
register_type(:anything, Object)
|
58
|
+
end
|
data/lib/ray/game.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
module Ray
|
2
|
+
# a game is represented as a stack of scenes : you register scenes,
|
3
|
+
# and then you push and pop them until the stack is empty.
|
4
|
+
#
|
5
|
+
# The game will run eerything when it is created, and free it when
|
6
|
+
# it is done running.
|
7
|
+
class Game
|
8
|
+
# Creates a new game.
|
9
|
+
# You can poss all the argument you would pass to create_window,
|
10
|
+
# except width and height which should be given in :video_mode, like this :
|
11
|
+
# Ray::Game.new(:video_modes = %w(480x272 640x480))
|
12
|
+
#
|
13
|
+
# It will try to get the biggest resolution available (so it will most
|
14
|
+
# likely choose 640x480).
|
15
|
+
#
|
16
|
+
# If a block is passes, it is instance evaluated, and then the game is
|
17
|
+
# directly run.
|
18
|
+
def initialize(hash = {}, &block)
|
19
|
+
@registred_scenes = {}
|
20
|
+
@scenes = []
|
21
|
+
|
22
|
+
defaults = {
|
23
|
+
:double_buf => true,
|
24
|
+
:bpp => 32,
|
25
|
+
:hw_surface => true,
|
26
|
+
:sw_surface => false
|
27
|
+
}
|
28
|
+
|
29
|
+
options = defaults.merge(hash)
|
30
|
+
|
31
|
+
common_settings = {
|
32
|
+
:sw_surface => options[:sw_surface],
|
33
|
+
:hw_surface => options[:hw_surface],
|
34
|
+
:bpp => options[:bpp] || options[:bits_per_pixel],
|
35
|
+
:async_blit => options[:async_blit],
|
36
|
+
:double_buf => options[:double_buf],
|
37
|
+
:fullscreen => options[:fullscreen],
|
38
|
+
:no_frame => options[:no_frame]
|
39
|
+
}
|
40
|
+
|
41
|
+
modes = options[:video_modes].map { |m| m.split('x').map { |i| i.to_i } }
|
42
|
+
|
43
|
+
# The biggest resolution is privileged
|
44
|
+
modes = modes.sort_by { |(w, h)| w * h }.map do |(w, h)|
|
45
|
+
common_settings.merge(:w => w, :h => h)
|
46
|
+
end
|
47
|
+
|
48
|
+
Ray.init
|
49
|
+
|
50
|
+
last_mode = modes.select { |mode| Ray.can_use_mode? mode }.last
|
51
|
+
raise ArgumentError, "No valid mode found" unless last_mode
|
52
|
+
|
53
|
+
@window = Ray.create_window(last_mode)
|
54
|
+
|
55
|
+
if block
|
56
|
+
instance_eval(&block)
|
57
|
+
run
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Adds a scene to the stack by its name.
|
62
|
+
# You must call Game#scene before this. If you subclassed scene,
|
63
|
+
# then call bind to register it.
|
64
|
+
def push_scene(scene_name)
|
65
|
+
scene = @registred_scenes[scene_name]
|
66
|
+
raise ArgumentError, "Unknown scene #{scene_name}" unless scene
|
67
|
+
|
68
|
+
@scenes << scene
|
69
|
+
end
|
70
|
+
|
71
|
+
# Pops the last scene.
|
72
|
+
def pop_scene
|
73
|
+
@scenes.delete_at(-1)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Registers a new scene with a given name. the block will be passed
|
77
|
+
# to klass.new.
|
78
|
+
#
|
79
|
+
# @param [Symobl] name the name of the new scene
|
80
|
+
# @param [Class] klass the class of the scene.
|
81
|
+
def scene(name, klass = Scene, &block)
|
82
|
+
@registred_scenes[name] = klass.new(&block)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Runs the game until the last scene gets popped.
|
86
|
+
def run
|
87
|
+
until @scenes.empty?
|
88
|
+
@runner = Ray::DSL::EventRunner.new
|
89
|
+
|
90
|
+
@scenes.each do |scene|
|
91
|
+
scene.game = self
|
92
|
+
scene.window = @window
|
93
|
+
scene.event_runner = @runner
|
94
|
+
|
95
|
+
scene.register_events
|
96
|
+
end
|
97
|
+
|
98
|
+
scene = @scenes.last
|
99
|
+
|
100
|
+
scene.need_render!
|
101
|
+
scene.run
|
102
|
+
end
|
103
|
+
|
104
|
+
Ray.stop
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
data/lib/ray/helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Ray
|
2
|
+
# This module includes the methods you may want to use in your code.
|
3
|
+
# It allows you to play with events (listen to them, raise them) and
|
4
|
+
# includes the matchers you described, which you may want to use when
|
5
|
+
# you want to listen to the events matching a condition.
|
6
|
+
module Helper
|
7
|
+
include Ray::DSL::EventRaiser
|
8
|
+
include Ray::DSL::Listener
|
9
|
+
|
10
|
+
include Ray::Matchers
|
11
|
+
|
12
|
+
def event_runner=(value)
|
13
|
+
self.listener_runner = value
|
14
|
+
self.raiser_runner = value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/ray/image.rb
ADDED
data/lib/ray/ray.rb
CHANGED
data/lib/ray/scene.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
module Ray
|
2
|
+
class Scene
|
3
|
+
include Ray::Helper
|
4
|
+
|
5
|
+
class << self
|
6
|
+
# If you want to subclass Scene, this is the method you need to call.
|
7
|
+
# It will return a subclass, responding to bind, which allows you to
|
8
|
+
# register it.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# Klass = Scene.create(:foo) do ... end
|
12
|
+
# Klass.bind(game)
|
13
|
+
# game.push_scene(:foo)
|
14
|
+
def create(scene_name, &block)
|
15
|
+
klass = Class.new(self)
|
16
|
+
klass.instance_variable_set("@block", block)
|
17
|
+
|
18
|
+
(class << klass; self; end).class_eval do
|
19
|
+
define_method(:bind) do |game|
|
20
|
+
game.scene(scene_name, self, &@block)
|
21
|
+
end
|
22
|
+
|
23
|
+
define_method(:inspect) { "Scene:#{scene_name}" }
|
24
|
+
define_method(:block) { @block }
|
25
|
+
end
|
26
|
+
|
27
|
+
klass.class_eval do
|
28
|
+
define_method(:initialize) do
|
29
|
+
super(&self.class.block)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
return klass
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates a new scene. block will be instance evaluated
|
38
|
+
# every time the current scene changes.
|
39
|
+
def initialize(&block)
|
40
|
+
@exit = false
|
41
|
+
@block = block
|
42
|
+
end
|
43
|
+
|
44
|
+
def register_events
|
45
|
+
instance_eval(&@block)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Runs until you exit the scene.
|
49
|
+
# This will also raise events if the mouse moves, ... allowing you
|
50
|
+
# to directly listen to a such event.
|
51
|
+
def run
|
52
|
+
until @exit
|
53
|
+
ev = DSL::EventTranslator.translate_event(Ray::Event.new)
|
54
|
+
raise_event(*ev) if ev
|
55
|
+
|
56
|
+
@always.call if @always
|
57
|
+
|
58
|
+
listener_runner.run
|
59
|
+
|
60
|
+
if @need_render
|
61
|
+
@need_render = false
|
62
|
+
|
63
|
+
@render.call(@window)
|
64
|
+
@window.flip
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Exits the scene, but does not pops the scene (the next scene
|
70
|
+
# will be the same one)
|
71
|
+
def exit
|
72
|
+
@exit = true
|
73
|
+
end
|
74
|
+
|
75
|
+
# Exits the scene and pops it.
|
76
|
+
def exit!
|
77
|
+
exit
|
78
|
+
game.pop_scene
|
79
|
+
end
|
80
|
+
|
81
|
+
# Register a block to be excuted as often as possible.
|
82
|
+
def always(&block)
|
83
|
+
@always = block
|
84
|
+
end
|
85
|
+
|
86
|
+
# Marks the scene should be redrawn.
|
87
|
+
def need_render!
|
88
|
+
@need_render = true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Registers the block to draw the scene.
|
92
|
+
#
|
93
|
+
# @yield [window] Block to render this scene.
|
94
|
+
# @yieldparam [Ray::Image] window The window you should draw on
|
95
|
+
def render(&block)
|
96
|
+
@render = block
|
97
|
+
end
|
98
|
+
|
99
|
+
attr_accessor :game
|
100
|
+
attr_accessor :window
|
101
|
+
end
|
102
|
+
end
|
data/psp/SDL_psp_main.c
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
/*
|
2
|
+
SDL - Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2004 Sam Lantinga
|
4
|
+
|
5
|
+
This library is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU Library General Public
|
7
|
+
License as published by the Free Software Foundation; either
|
8
|
+
version 2 of the License, or (at your option) any later version.
|
9
|
+
|
10
|
+
This library is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
Library General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU Library General Public
|
16
|
+
License along with this library; if not, write to the Free
|
17
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
+
|
19
|
+
Sam Lantinga
|
20
|
+
slouken@libsdl.org
|
21
|
+
*/
|
22
|
+
|
23
|
+
/*
|
24
|
+
PSP port contributed by:
|
25
|
+
Marcus R. Brown <mrbrown@ocgnet.org>
|
26
|
+
Jim Paris <jim@jtan.com>
|
27
|
+
Matthew H <matthewh@webone.com.au>
|
28
|
+
*/
|
29
|
+
|
30
|
+
#include <SDL/SDL_main.h>
|
31
|
+
|
32
|
+
#include <pspkernel.h>
|
33
|
+
#include <pspdebug.h>
|
34
|
+
#include <pspsdk.h>
|
35
|
+
#include <pspthreadman.h>
|
36
|
+
#include <stdlib.h>
|
37
|
+
#include <stdio.h>
|
38
|
+
|
39
|
+
/* If application's main() is redefined as SDL_main, and libSDLmain is
|
40
|
+
linked, then this file will create the standard exit callback,
|
41
|
+
define the PSP_MODULE_INFO macro, and exit back to the browser when
|
42
|
+
the program is finished.
|
43
|
+
|
44
|
+
You can still override other parameters in your own code if you
|
45
|
+
desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR,
|
46
|
+
PSP_MAIN_THREAD_STACK_SIZE, etc.
|
47
|
+
*/
|
48
|
+
|
49
|
+
extern int SDL_main(int argc, char *argv[]);
|
50
|
+
|
51
|
+
PSP_MODULE_INFO("ray", 0, 1, 1);
|
52
|
+
|
53
|
+
int sdl_psp_exit_callback(int arg1, int arg2, void *common) {
|
54
|
+
exit(0);
|
55
|
+
return 0;
|
56
|
+
}
|
57
|
+
|
58
|
+
int sdl_psp_callback_thread(SceSize args, void *argp) {
|
59
|
+
int cbid;
|
60
|
+
cbid = sceKernelCreateCallback("Exit Callback",
|
61
|
+
sdl_psp_exit_callback, NULL);
|
62
|
+
sceKernelRegisterExitCallback(cbid);
|
63
|
+
sceKernelSleepThreadCB();
|
64
|
+
return 0;
|
65
|
+
}
|
66
|
+
|
67
|
+
int sdl_psp_setup_callbacks(void) {
|
68
|
+
int thid = 0;
|
69
|
+
thid = sceKernelCreateThread("update_thread",
|
70
|
+
sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
|
71
|
+
if(thid >= 0)
|
72
|
+
sceKernelStartThread(thid, 0, 0);
|
73
|
+
return thid;
|
74
|
+
}
|
75
|
+
|
76
|
+
int main(int argc, char *argv[]) {
|
77
|
+
pspDebugScreenInit();
|
78
|
+
sdl_psp_setup_callbacks();
|
79
|
+
|
80
|
+
/* Register sceKernelExitGame() to be called when we exit */
|
81
|
+
atexit(sceKernelExitGame);
|
82
|
+
|
83
|
+
return SDL_main(argc, argv);
|
84
|
+
}
|