mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-10 08:55:33 +02:00
Add FileInt.pos method
This commit is contained in:
parent
f608a94fb7
commit
42cce65482
1 changed files with 13 additions and 1 deletions
|
@ -130,6 +130,14 @@ RB_METHOD(fileIntBinmode)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RB_METHOD(fileIntPos)
|
||||||
|
{
|
||||||
|
SDL_RWops *ops = getPrivateData<SDL_RWops>(self);
|
||||||
|
|
||||||
|
long long pos = SDL_RWtell(ops); // Will return -1 if it doesn't work
|
||||||
|
return LL2NUM(pos);
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
kernelLoadDataInt(const char *filename, bool rubyExc)
|
kernelLoadDataInt(const char *filename, bool rubyExc)
|
||||||
{
|
{
|
||||||
|
@ -227,8 +235,12 @@ fileIntBindingInit()
|
||||||
|
|
||||||
_rb_define_method(klass, "read", fileIntRead);
|
_rb_define_method(klass, "read", fileIntRead);
|
||||||
_rb_define_method(klass, "getbyte", fileIntGetByte);
|
_rb_define_method(klass, "getbyte", fileIntGetByte);
|
||||||
#ifdef OLD_RUBY // Marshal looks for 'getc', not 'getbyte'
|
#ifdef OLD_RUBY
|
||||||
|
// Ruby doesn't see this as an initialized stream,
|
||||||
|
// so either that has to be fixed or necessary
|
||||||
|
// IO functions have to be overridden
|
||||||
rb_define_alias(klass, "getc", "getbyte");
|
rb_define_alias(klass, "getc", "getbyte");
|
||||||
|
_rb_define_method(klass, "pos", fileIntPos);
|
||||||
#endif
|
#endif
|
||||||
_rb_define_method(klass, "binmode", fileIntBinmode);
|
_rb_define_method(klass, "binmode", fileIntBinmode);
|
||||||
_rb_define_method(klass, "close", fileIntClose);
|
_rb_define_method(klass, "close", fileIntClose);
|
||||||
|
|
Loading…
Add table
Reference in a new issue