logs archiveBotHelp.net / Freenode / #3dsdev / 2015 / September / 18 / 1
yuriks
"Everything _except_ libstd works, which is most of the useful stuff in the standard library (core, collections, libc)."
furyhunter: aren't collections a separate crate?
also core
furyhunter
yes, libstd is comprised of reexports from core, collections and alloc
and lots more stuff
yuriks
yeah, I think that's a bit misleading then
furyhunter
so you can add the core and collections features and extern crate collections;
ahh yeah I should rewrite that, you're right
yuriks
furyhunter: you've been tweeted by @rustlang, btw
furyhunter
WHAT REALLY
oh yeah steve commented on it
endrift
furyhunter: congrats
furyhunter
lol thanks
endrift
furyhunter: I should poke pcwalton about this :P
if you know that name
furyhunter
rings a bell but not sure who?
endrift
Patrick Walton, one of the Servo guys
oh wait he's in France right now
yuriks
(Action) was about to say "is there anyone who does Rust and doesn't know pcwalton?" XD
I think sprocketnes was what got me interested in Rust
furyhunter
ahh I think I've seen the name from Servo
and sprocketnes!
endrift
yep exactly
SprocketNES is how I know him
furyhunter
adjusted the makefile to make building on linux work
what do aptInit() et al return when they fail? non-zero values?
yuriks
don't they return Result?
furyhunter
yeah which is just int
yuriks
then <0 is an error
(or, specifically, if bit 31 is set)
furyhunter
any way to tell what the cause of the error is?
Subv
the error itself tells you what happened
yuriks
http://3dbrew.org/wiki/Error_codes
if it's a ctrulib-generated error it probably just returns -1 though
furyhunter
ahh...
then I'll just return Result<Srv, ()>
or i32
yuriks
note that sometimes there are non-0 success results
and sometimes checking for them is important
so I think you need to use something other than Result entirely
furyhunter
yeah, I'll make sure as I work through the modules
yuriks
no, I mean, those are returned from nintendo service calls sometimes
aliaspider
ahh non 0 success ? I've been doing it all wrong xD
hmm, is there a way to map memory at an address smaller than 0x02000000?
yuriks
what kind of memory?
the program image is mapped down there, but you can't map anything using SVC calls there afaik
aliaspider
hmm :/ I need to allocate memory for a dynarec that is in the 32mbyte of the main program, so it can do a branch
oh, code can also be loaded in the 0x14000000 region, this might help
yuriks
while that's *possible*, it means you can access the linear heap, so...
can't*
aliaspider
wouldn't it just reduce the size available , when __linear_heap is set ?
ill try it out
furyhunter
wrapped a bunch of modules in structs
3ds software will now be implemented by the Application trait -- provides main_loop(&mut self, apt: &mut Apt) -> (), and ready_to_quit(&self) -> bool;
https://github.com/Furyhunter/rust3ds-template/blob/master/src/main.rs#L29-L51
yuriks
aliaspider: also, I suspect that doesn't even work in the first place for APP region procs
aliaspider
yeah it doesn't seem to have an affect
hmm I guess I'll just have copy the whole program near the dynarec buffer, add an offset to all branches, and hope for the best ...
mapping the program itself near allocatable memory is out of the question too right ? even with kernel access ?
yuriks
well, it's easier to make your JIT emit PIE :P
smea
i love pie
aliaspider
well it isn't mine :D
yuriks
(Action) sleeps
smea
like
pie is great
aliaspider
wait don't confuse me lol , I wanted to ask what PIE means in this case :P
i only know PIC code
endrift
position independent execution
aliaspider
ah ok same thing different name then. will certainly have to go there is everything else fails :/
furyhunter
pie is indeed good
smea
it is
furyhunter
ahh... gfxInit calls gspInit
will calling gspInit twice cause any problems?
Lectem
why not just call gfxInit?
and yeah, it can do sh*t
furyhunter
i'm writing a safe wrapper around ctrulib
Lectem
just send a PR with a if for https://github.com/smealum/ctrulib/blob/master/libctru/source/services/gsp.c#L29
furyhunter
rust discourages global state
Lectem
can't help it when dealing with IO
furyhunter
the way to encapsulate gfxInit/gfxExit in rust is to use a struct that represents the resource, which is what i have, but i also have to initialize gsp, but gsp can be created outside too ;-;
for Gfx struct i would have to create a dummy _without_ calling gspinit and store it, but then you can't safely move Gsp out of Gfx if you, say, no longer wanted to use Gfx
I guess the only truly correct way to do this is to use only the srv functions in the rust wrapper and then reimplement the various service layers in rust
Lectem
well, gfx isnt a service
its only a wrapper around gsp
furyhunter
yeah, that has to be quantified within the Gfx struct and its implementation of Drop. Rust has RAII
the idea is that you can't call, say, gfxGetFramebuffer unless gfxInit was called first, and the type system can be used to enforce that
Lectem
well yeah, cant expose both gfx and gsp then
at least not in a nice way
furyhunter
gfx is simple enough that it could be reimplemented in pure rust
which I might just do
« prev next »