Skip to content

Commit aa2f670

Browse files
committed
Fix klog saving and text size on emergency reboot screen
1 parent f311d1d commit aa2f670

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

multirom.c

+13-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
#include <sys/stat.h>
18+
#include <sys/stat.h>
1919
#include <fcntl.h>
2020
#include <stdio.h>
2121
#include <string.h>
2222
#include <dirent.h>
23-
#include <sys/types.h>
23+
#include <sys/types.h>
2424
#include <sys/wait.h>
2525
#include <stdlib.h>
2626
#include <errno.h>
@@ -252,6 +252,7 @@ void multirom_emergency_reboot(void)
252252
fb_text_proto *p;
253253
fb_img *t;
254254
char *tail;
255+
char *last_end;
255256
int cur_y;
256257
if(multirom_init_fb(0) < 0)
257258
{
@@ -271,21 +272,24 @@ void multirom_emergency_reboot(void)
271272
fb_add_rect(0, t->y + t->h + 5*DPI_MUL, fb_width, 1, GRAYISH);
272273

273274
tail = klog+strlen(klog);
275+
last_end = tail;
274276
cur_y = fb_height;
275277
const int start_y = (t->y + t->h + 2);
276278
while(tail > klog)
277279
{
278280
--tail;
279281
if(*tail == '\n')
280282
{
281-
*tail = 0;
282-
283-
p = fb_text_create(0, cur_y, GRAYISH, 4, tail+1);
283+
p = fb_text_create(0, cur_y, GRAYISH, 4*4, NULL);
284+
p->text = malloc(last_end - tail);
285+
memcpy(p->text, tail + 1, last_end - (tail + 1));
286+
p->text[last_end - (tail + 1)] = 0;
284287
p->style = STYLE_MONOSPACE;
285288
t = fb_text_finalize(p);
286289

287290
cur_y -= t->h;
288291
t->y = cur_y;
292+
last_end = tail;
289293

290294
if(cur_y < start_y)
291295
{
@@ -875,7 +879,7 @@ void multirom_import_internal(void)
875879
char path[256];
876880

877881
// multirom
878-
mkdir(multirom_dir, 0777);
882+
mkdir(multirom_dir, 0777);
879883

880884
// roms
881885
snprintf(path, sizeof(path), "%s/roms", multirom_dir);
@@ -1169,7 +1173,7 @@ int multirom_prep_android_mounts(struct multirom_rom *rom)
11691173
if(has_fw)
11701174
mkdir_with_perms("/firmware", 0771, "system", "system");
11711175

1172-
static const char *folders[2][3] =
1176+
static const char *folders[2][3] =
11731177
{
11741178
{ "system", "data", "cache" },
11751179
{ "system.img", "data.img", "cache.img" },
@@ -1277,7 +1281,8 @@ int multirom_process_android_fstab(char *fstab_name, int has_fw, struct fstab_pa
12771281
if(!tab)
12781282
goto exit;
12791283

1280-
if(fstab_disable_part(tab, "/system") || fstab_disable_part(tab, "/data") || fstab_disable_part(tab, "/cache"))
1284+
const int disable_res = fstab_disable_part(tab, "/system") + fstab_disable_part(tab, "/data") + fstab_disable_part(tab, "/cache");
1285+
if(disable_res != 0)
12811286
{
12821287
#if MR_DEVICE_HOOKS >= 4
12831288
if(!mrom_hook_allow_incomplete_fstab())

0 commit comments

Comments
 (0)