Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
retro8
Commits
f93bd808
Commit
f93bd808
authored
Dec 27, 2019
by
Jack
Browse files
fixes max compressed length for stegano data, added poke2 and peek2
parent
7f53689f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/io/stegano.cpp
View file @
f93bd808
...
...
@@ -8,6 +8,11 @@ using namespace io;
constexpr
size_t
RAW_DATA_LENGTH
=
0x4300
;
#if DEBUGGER
#include <fstream>
static
std
::
string
fileName
;
#endif
uint8_t
Stegano
::
assembleByte
(
const
uint32_t
v
)
{
constexpr
uint32_t
MASK_ALPHA
=
0xff000000
;
...
...
@@ -63,6 +68,8 @@ void Stegano::load(const PngData& data, Machine& m)
/* skip 2 null*/
o
+=
2
;
compressedLength
=
std
::
min
(
32769ULL
-
RAW_DATA_LENGTH
,
compressedLength
);
const
std
::
string
lookup
=
"
\n
0123456789abcdefghijklmnopqrstuvwxyz!#%(){}[]<>+=/*:;.,~_"
;
std
::
string
code
;
...
...
@@ -100,8 +107,13 @@ void Stegano::load(const PngData& data, Machine& m)
}
}
m
.
code
().
initFromSource
(
code
);
#if DEBUGGER
std
::
ofstream
output
(
fileName
);
output
<<
code
;
output
.
close
();
#endif
m
.
code
().
initFromSource
(
code
);
}
//TODO: remove SDL_image and use lighter library
...
...
@@ -109,6 +121,10 @@ void Stegano::load(const PngData& data, Machine& m)
void
Stegano
::
load
(
const
std
::
string
&
path
,
Machine
&
m
)
{
#if DEBUGGER
fileName
=
path
.
substr
(
0
,
path
.
length
()
-
4
)
+
".p8"
;
#endif
SDL_Surface
*
surface
=
IMG_Load
(
path
.
c_str
());
if
(
!
surface
)
...
...
src/lua/llex.c
View file @
f93bd808
...
...
@@ -586,6 +586,16 @@ static int llex (LexState *ls, SemInfo *seminfo) {
}
while
(
anyValid
);
}
/*case 0x8B:
{
seminfo->i = 0;
return TK_INT;
}
case 0x91:
{
seminfo->i = 1;
return TK_INT;
}*/
case
EOZ
:
{
return
TK_EOS
;
...
...
src/vm/lua_bridge.cpp
View file @
f93bd808
...
...
@@ -240,7 +240,7 @@ namespace draw
uint8_t
w
=
lua_tonumber
(
L
,
3
);
uint8_t
h
=
lua_tonumber
(
L
,
4
);
machine
.
memory
().
clipRect
()
->
set
(
x0
,
y0
,
x0
+
w
,
y0
+
h
);
machine
.
memory
().
clipRect
()
->
set
(
x0
,
y0
,
std
::
min
(
x0
+
w
,
int32_t
(
gfx
::
SCREEN_WIDTH
-
1
)),
std
::
min
(
y0
+
h
,
int32_t
(
gfx
::
SCREEN_HEIGHT
-
1
))
);
}
return
0
;
...
...
@@ -746,6 +746,18 @@ namespace platform
return
0
;
}
int
poke2
(
lua_State
*
L
)
{
address_t
addr
=
lua_tonumber
(
L
,
1
);
uint32_t
value
=
lua_tonumber
(
L
,
2
);
machine
.
memory
().
base
()[
addr
]
=
value
&
0xFF
;
machine
.
memory
().
base
()[
addr
+
1
]
=
(
value
&
0xFF00
)
>>
8
;
return
0
;
}
int
peek
(
lua_State
*
L
)
{
address_t
addr
=
lua_tonumber
(
L
,
1
);
...
...
@@ -756,6 +768,17 @@ namespace platform
return
1
;
}
int
peek2
(
lua_State
*
L
)
{
address_t
addr
=
lua_tonumber
(
L
,
1
);
uint8_t
low
=
machine
.
memory
().
base
()[
addr
];
uint8_t
high
=
machine
.
memory
().
base
()[
addr
+
1
];
lua_pushnumber
(
L
,
(
low
|
high
<<
8
));
return
1
;
}
int
memset
(
lua_State
*
L
)
{
address_t
addr
=
lua_tonumber
(
L
,
1
);
...
...
@@ -983,6 +1006,8 @@ void lua::registerFunctions(lua_State* L)
lua_register
(
L
,
"dget"
,
platform
::
dget
);
lua_register
(
L
,
"poke"
,
platform
::
poke
);
lua_register
(
L
,
"peek"
,
platform
::
peek
);
lua_register
(
L
,
"poke2"
,
platform
::
poke
);
lua_register
(
L
,
"peek2"
,
platform
::
peek
);
lua_register
(
L
,
"memset"
,
platform
::
memset
);
lua_register
(
L
,
"memcpy"
,
platform
::
memcpy
);
lua_register
(
L
,
"reload"
,
platform
::
reload
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment