Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17d4490aca | ||
|
|
f8044d2d65 |
No files matched your search
+52
-35
@@ -1,5 +1,6 @@
|
||||
#define MEMSIZE 1024*60
|
||||
|
||||
#define MEMSIZE 1024*40
|
||||
#include "..\lib\strings.h"
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\gui.h"
|
||||
#include "..\lib\obj\proc_lib.h"
|
||||
#include "..\lib\patterns\simple_open_dialog.h"
|
||||
@@ -14,8 +15,9 @@
|
||||
|
||||
#define WINW 570
|
||||
#define WINH 300
|
||||
#define CONX 28 //content X pos
|
||||
#define CONY 25 //content Y pos
|
||||
#define CONX 30 //content X pos
|
||||
#define SCRX WINW-180
|
||||
#define SCRY 20
|
||||
|
||||
char default_dir[] = "/sys";
|
||||
od_filter filter2;
|
||||
@@ -32,29 +34,30 @@ od_filter filter2;
|
||||
//===================================================//
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define WINDOW_TITLE_TEXT "Внимание!"
|
||||
?define CONTENT_HEADER_TEXT "KolibriOS работает в режиме дискеты"
|
||||
?define DESCRIPTION_TEXT "Многие приложения сейчас недоступны.
|
||||
|
||||
Причина в том, что не смонтирован дополнительный системный
|
||||
каталог. Но вы можете найти и задать его вручную. Его название
|
||||
'kolibrios'. Вы также можете загрузить latest-dirstr.7z через
|
||||
WebView и найти его внутри."
|
||||
?define WINDOW_TITLE_TEXT "Внимание! Это важно."
|
||||
?define CONTENT_HEADER_TEXT "ПАПКА /KOLIBRIOS/ НЕ НАЙДЕНА"
|
||||
?define DESCRIPTION_TEXT "Попробуйте найти ее самостоятельно.
|
||||
Содержимое искомой папки показано на
|
||||
картинке справа. В случае неверно
|
||||
выбранной папки требуется выполнить
|
||||
перезагрузку ПК и попробовать снова."
|
||||
?define MANUALLY_BUTTON_TEXT "Указать папку /kolibrios/..."
|
||||
?define OPEN_ANYWAY_BUTTON_TEXT "Запустить APP+ (некоторые программы будут недоступны)"
|
||||
#else
|
||||
?define WINDOW_TITLE_TEXT "Warning!"
|
||||
?define CONTENT_HEADER_TEXT "KolibriOS is running in floppy mode"
|
||||
?define DESCRIPTION_TEXT "A lot of apps aren't available.
|
||||
|
||||
The reason is that additional system directory is not mounted.
|
||||
But you can find and set it manually. Its name is 'kolibrios'.
|
||||
You can also download latest-dirstr.7z via WebView and find
|
||||
it inside."
|
||||
?define WINDOW_TITLE_TEXT "Warning! It's important."
|
||||
?define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED"
|
||||
?define DESCRIPTION_TEXT "Try to find it manually. It should look
|
||||
like image on the right.
|
||||
Note: this action can be done only once
|
||||
per 1 session of the OS running. If you
|
||||
will choose the wrong folder then you
|
||||
need to reboot a system to try again."
|
||||
?define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
|
||||
?define OPEN_ANYWAY_BUTTON_TEXT "Open APP+ anyway (some programs won't be available)"
|
||||
?define OPEN_ANYWAY_BUTTON_TEXT "Open APP+ anyway (some programs won't be available) "
|
||||
#endif
|
||||
|
||||
char kolibrios_dirs[] = "..\0 3D \0demos \0develop\0drivers\0emul \0games \0grafx2";
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// CODE //
|
||||
@@ -101,22 +104,38 @@ void draw_window()
|
||||
{
|
||||
sc.get();
|
||||
DefineAndDrawWindow(screen.w-WINW/2, 100, WINW, WINH+skin_h, 0x34, sc.work, WINDOW_TITLE_TEXT,0);
|
||||
draw_icon_16w(CONX+2, CONY-3, 5);
|
||||
WriteTextB(CONX+27+2,CONY+2,0x81,MixColors(sc.work, 0xB92234,220),CONTENT_HEADER_TEXT);
|
||||
WriteTextB(CONX+27,CONY,0x81,0xB92234,CONTENT_HEADER_TEXT);
|
||||
WriteTextLines(CONX,CONY+42,0x90,sc.work_text,DESCRIPTION_TEXT,20);
|
||||
DrawButtons();
|
||||
WriteTextB(CONX+2,SCRY+2,0x81,MixColors(sc.work, 0xB92234,220),CONTENT_HEADER_TEXT);
|
||||
WriteTextB(CONX,SCRY,0x81,0xB92234,CONTENT_HEADER_TEXT);
|
||||
draw_screen();
|
||||
WriteTextLines(CONX,SCRY+50,0x90,sc.work_text,DESCRIPTION_TEXT,20);
|
||||
DrawButtons();
|
||||
}
|
||||
|
||||
void draw_screen()
|
||||
{
|
||||
char i;
|
||||
int icon_n=1;
|
||||
DrawRectangle(WINW-180-1,SCRY-1, 145+1,170+1, sc.line);
|
||||
DrawBar(SCRX,SCRY,145,170,0xFFFfff);
|
||||
DrawBar(SCRX+25,SCRY+5,144-25,20,0xBBDDFF);
|
||||
for (i=0; i<8; i++) {
|
||||
draw_icon_16(SCRX+5, i*20+SCRY+5, icon_n);
|
||||
WriteText(SCRX+27, i*20+SCRY+11, 0x80, 0, i*8 + #kolibrios_dirs);
|
||||
icon_n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawButtons()
|
||||
{
|
||||
DrawStandartCaptButton(CONX, WINH-CONY-58, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
|
||||
DrawStandartCaptButton(CONX, WINH-CONY-22, BTN_OPEN_ANYWAY, OPEN_ANYWAY_BUTTON_TEXT);
|
||||
DrawStandartCaptButton(CONX, WINH-80, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
|
||||
DrawStandartCaptButton(CONX, WINH-42, BTN_OPEN_ANYWAY, OPEN_ANYWAY_BUTTON_TEXT);
|
||||
//DrawCaptButton(CONX, WINH-80, 300, 25, BTN_MANUAL_SEARCH, sc.button, sc.button_text, MANUALLY_BUTTON_TEXT);
|
||||
//DrawCaptButton(CONX, WINH-42, 500, 25, BTN_OPEN_ANYWAY, sc.button, sc.button_text, OPEN_ANYWAY_BUTTON_TEXT);
|
||||
}
|
||||
|
||||
void CheckKosMounted()
|
||||
{
|
||||
if (dir_exists("/kolibrios"))
|
||||
if (dir_exists("/kolibrios"))
|
||||
{
|
||||
if (file_exists(APP_PLUS_INI_PATH)) EventOpenApp();
|
||||
ExitProcess();
|
||||
@@ -139,13 +158,13 @@ void EventManualSearch()
|
||||
OpenDialog_start stdcall (#o_dialog);
|
||||
if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path+1);
|
||||
pause(3);
|
||||
CheckKosMounted();
|
||||
CheckKosMounted();
|
||||
}
|
||||
|
||||
void EventOpenApp()
|
||||
{
|
||||
if (RunProgram("/sys/syspanel", APP_PLUS_INI_PATH) < 0) {
|
||||
notify("'App+ cannot start because\n/sys/syspanel does not exist' -E");
|
||||
notify("'App+ can not be started because\n/sys/syspanel does not exists' -E");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,10 +172,8 @@ void EventButton(dword id)
|
||||
{
|
||||
if (id==CLOSE_BTN) ExitProcess();
|
||||
else if (id==BTN_MANUAL_SEARCH) EventManualSearch();
|
||||
else if (id==BTN_OPEN_ANYWAY) {
|
||||
EventOpenApp();
|
||||
ExitProcess();
|
||||
}
|
||||
else if (id==BTN_OPEN_ANYWAY) { EventOpenApp(); ExitProcess(); }
|
||||
}
|
||||
|
||||
|
||||
stop:
|
||||
+15
-11
@@ -22,9 +22,8 @@ void TWebBrowser::RenderLine(dword _line)
|
||||
zoom = list.font_w / BASIC_CHAR_W;
|
||||
|
||||
//there is some shit happens!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
if (debug_mode) && (pw > draw_w + BODY_MARGIN) {
|
||||
debugln("anomaly");
|
||||
debugln(_line);
|
||||
if (pw > draw_w + BODY_MARGIN) {
|
||||
//debugln("shit");
|
||||
}
|
||||
|
||||
if (debug_mode) {
|
||||
@@ -81,12 +80,14 @@ void TWebBrowser::RenderTextbuf()
|
||||
//Yes, we do. Lets calculate where...
|
||||
br = len;
|
||||
|
||||
//debugln(" \\n");
|
||||
|
||||
//Is a new line fits in the maximum line width?
|
||||
if (br * list.font_w + draw_x - left_gap >= draw_w) {
|
||||
br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
|
||||
br = draw_w - draw_x / list.font_w;
|
||||
if (br < 0) br = 0;
|
||||
while(br) {
|
||||
if (ESBYTE[lbp + br]==' ') || (ESBYTE[lbp + br]=='-') {
|
||||
if (ESBYTE[lbp + br]==' ') {
|
||||
if (br < len) br++;
|
||||
break;
|
||||
}
|
||||
@@ -95,10 +96,15 @@ void TWebBrowser::RenderTextbuf()
|
||||
}
|
||||
//Maybe a new line is too big for the whole new line? Then we have to split it
|
||||
if (!br) && (len * list.font_w >= draw_w) {
|
||||
br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
|
||||
//debugln("bigbr");
|
||||
//debugval("draw_x", draw_x);
|
||||
//debugval("draw_w", draw_w);
|
||||
br = draw_w - draw_x / list.font_w;
|
||||
//debugval("cut into 1", br * list.font_w);
|
||||
if (br < 0) {
|
||||
NewLine();
|
||||
br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
|
||||
br = draw_w - draw_x / list.font_w;
|
||||
//debugval("cut into 2", br * list.font_w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +117,7 @@ void TWebBrowser::RenderTextbuf()
|
||||
if (ESBYTE[lbp]) NewLine();
|
||||
} else {
|
||||
NewLine();
|
||||
RenderLine(lbp);
|
||||
}
|
||||
}
|
||||
RenderLine(lbp);
|
||||
@@ -160,11 +167,8 @@ bool TWebBrowser::RenderImage(dword cur_img)
|
||||
|
||||
if (img_y + img_h >= canvas.bufh) canvas.IncreaseBufSize();
|
||||
|
||||
if (secondrun)
|
||||
if (secondrun)
|
||||
{
|
||||
if (bg_colors.get_last() - bg_colors.get(0)) {
|
||||
canvas.DrawBar(draw_x, draw_y, img_w, list.item_h, bg_colors.get_last());
|
||||
}
|
||||
if (ESDWORD[cur_img+20] != IMAGE_BPP32) {
|
||||
img_convert stdcall(cur_img, 0, IMAGE_BPP32, 0, 0);
|
||||
$push eax
|
||||
|
||||
+8
-20
@@ -89,7 +89,7 @@ void TWebBrowser::tag_font()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (text_colors.count>1) text_colors.pop();
|
||||
if (bg_colors.count>1) text_colors.pop();
|
||||
if (bg_colors.count>1) bg_colors.pop(); //never pop the last color
|
||||
}
|
||||
}
|
||||
@@ -190,9 +190,8 @@ void TWebBrowser::tag_ol_ul_dt()
|
||||
|
||||
void TWebBrowser::tag_li()
|
||||
{
|
||||
if (style.nav) {
|
||||
chrncat(#linebuf, ' ', sizeof(TWebBrowser.linebuf));
|
||||
} else if (tag.opened) {
|
||||
//if (style.nav) return;
|
||||
if (tag.opened) {
|
||||
if (!style.tag_list.level) style.tag_list.upd_level(1, 'u');
|
||||
if (!style.pre) NewLine();
|
||||
if (style.tag_list.order_type() == 'u') {
|
||||
@@ -304,9 +303,6 @@ void TWebBrowser::tag_img()
|
||||
{
|
||||
char img_path[4096]=0;
|
||||
dword base64img;
|
||||
dword img_data=0, img_size=0;
|
||||
|
||||
if (!secondrun) return;
|
||||
|
||||
if (!tag.get_value_of("data-large-image"))
|
||||
if (!tag.get_value_of("data-src"))
|
||||
@@ -337,22 +333,16 @@ void TWebBrowser::tag_img()
|
||||
if (EAX) goto IMGOK; else goto NOIMG;
|
||||
}
|
||||
|
||||
if (cache2.is_contain(#img_path))
|
||||
{
|
||||
read_file(cache2.path.get(cache2.cur), #img_data, #img_size);
|
||||
if (img_size) {
|
||||
img_decode stdcall (img_data, img_size, 0);
|
||||
if (EAX) goto IMGOK;
|
||||
} else {
|
||||
//cache2.url.set_null(cache2.cur);
|
||||
}
|
||||
if (cache.has(#img_path)) {
|
||||
img_decode stdcall (cache.current_buf, cache.current_size, 0);
|
||||
if (EAX) goto IMGOK; else goto NOIMG;
|
||||
} else {
|
||||
if (img_url.get_pos_by_name(#img_path)==-1) img_url.add(#img_path);
|
||||
goto NOIMG;
|
||||
}
|
||||
goto NOIMG;
|
||||
|
||||
IMGOK:
|
||||
if (RenderImage(EAX)) goto IMG_END;
|
||||
if (RenderImage(EAX)) return;
|
||||
|
||||
NOIMG:
|
||||
if (tag.get_value_of("title")) || (tag.get_value_of("alt")) {
|
||||
@@ -370,8 +360,6 @@ NOIMG:
|
||||
RenderTextbuf();
|
||||
style.image = false;
|
||||
text_colors.pop();
|
||||
IMG_END:
|
||||
free(img_data);
|
||||
}
|
||||
|
||||
struct TABLE {
|
||||
|
||||
+61
-92
@@ -78,6 +78,7 @@ char search_engine[256];
|
||||
#include "settings.h"
|
||||
#include "tabs.h"
|
||||
|
||||
dword cur_img_url;
|
||||
dword shared_url;
|
||||
dword http_get_type=PAGE;
|
||||
dword render_start_time;
|
||||
@@ -90,10 +91,6 @@ char editURL[URL_SIZE+1];
|
||||
edit_box omnibox_edit = {250, 0, 0, 0xffffff,
|
||||
0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19};
|
||||
|
||||
int img_downloaders[256];
|
||||
int img_downloaders_count = 0;
|
||||
bool img_loading = false;
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// CODE //
|
||||
@@ -143,9 +140,8 @@ void main()
|
||||
LoadLibraries();
|
||||
LoadIniConfig();
|
||||
HandleParam();
|
||||
cache2.load();
|
||||
|
||||
omnibox_edit.left = PADDING+TSZE*3+PADDING+8;
|
||||
omnibox_edit.left = PADDING+TSZE*2+PADDING+6;
|
||||
omnibox_edit.top = PADDING+3;
|
||||
|
||||
WB1.list.SetFont(8, 14, 10011000b);
|
||||
@@ -206,8 +202,9 @@ void main()
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2-random(80),
|
||||
skin_h-WIN_H/2-random(80),WIN_W,WIN_H,0x73,0,0,0);
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2-random(80),GetScreenHeight()-WIN_H/2-random(80),
|
||||
//DefineAndDrawWindow(0,0,
|
||||
WIN_W,WIN_H,0x73,0,0,0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
ProcessMenuClick();
|
||||
sc.get();
|
||||
@@ -220,13 +217,12 @@ void main()
|
||||
case evNetwork:
|
||||
if (http.transfer <= 0) break;
|
||||
http.receive();
|
||||
if (http.receive_result != 0) break;
|
||||
|
||||
if (http.receive_result != 0) break;
|
||||
if (debug_mode) {
|
||||
EAX = http.transfer;
|
||||
debugln(#EAX.http_msg.http_header);
|
||||
}
|
||||
|
||||
if (http.status_code >= 300) && (http.status_code < 400)
|
||||
{
|
||||
// Handle redirects
|
||||
@@ -236,6 +232,7 @@ void main()
|
||||
} else {
|
||||
StopLoading();
|
||||
redirect_count = 0;
|
||||
if (http_get_type==IMG) goto _IMG_RES;
|
||||
notify("'Too many redirects.' -E");
|
||||
}
|
||||
} else {
|
||||
@@ -259,6 +256,18 @@ void main()
|
||||
free(http.content_pointer);
|
||||
DrawOmnibox();
|
||||
}
|
||||
else if (http_get_type==IMG) {
|
||||
_IMG_RES:
|
||||
if (http.status_code >= 200) && (http.status_code < 300) {
|
||||
cache.add(cur_img_url, http.content_pointer, http.content_received, IMG, NULL);
|
||||
} else {
|
||||
cache.add(cur_img_url, 0, 0, IMG, NULL);
|
||||
}
|
||||
http.hfree();
|
||||
free(http.content_pointer);
|
||||
GetImg(false);
|
||||
}
|
||||
debugln("end evNetwork");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -267,7 +276,6 @@ void main()
|
||||
ESDWORD[shared_url] = '\0';
|
||||
ActivateWindow(GetProcessSlot(Form.ID));
|
||||
}
|
||||
if (img_loading) CheckImgDownloads();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +290,7 @@ void ProcessButtonClick(dword id__)
|
||||
{
|
||||
switch (id__)
|
||||
{
|
||||
case 1: cache2.save(); ExitProcess();
|
||||
case 1: ExitProcess();
|
||||
case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: EventTabClose(id__ - TAB_CLOSE_ID); return;
|
||||
case TAB_ID...TAB_ID+TABS_MAX: EventAllTabsClick(id__ - TAB_ID); return;
|
||||
case ENCODINGS...ENCODINGS+6: EventManuallyChangeEncoding(id__-ENCODINGS); return;
|
||||
@@ -355,7 +363,7 @@ void ProcessKeyEvent()
|
||||
|
||||
void SetElementSizes()
|
||||
{
|
||||
omnibox_edit.width = Form.cwidth - omnibox_edit.left - 51;
|
||||
omnibox_edit.width = Form.cwidth - BUTTON_W - SEARCH_GO_GAP - BUTTON_W - omnibox_edit.left - 52 - 16;
|
||||
if (Form.cwidth - scroll_wv.size_x != WB1.list.w) {
|
||||
//temporary fix for crash
|
||||
//related to 'cur_img_url' var read
|
||||
@@ -383,15 +391,14 @@ void draw_window()
|
||||
DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, MixColors(sc.dark, sc.work, 180));
|
||||
DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, sc.line);
|
||||
DrawBar(0, PADDING, omnibox_edit.left-2, TSZE+1, sc.work);
|
||||
DrawBar(omnibox_edit.left+omnibox_edit.width+2, PADDING, Form.cwidth-omnibox_edit.left-omnibox_edit.width-2, TSZE+1, sc.work);
|
||||
DrawBar(omnibox_edit.left+omnibox_edit.width+18, PADDING, Form.cwidth-omnibox_edit.left-omnibox_edit.width-18, TSZE+1, sc.work);
|
||||
|
||||
DrawTopPanelButton(BACK_BUTTON, PADDING-1, PADDING, 30, false);
|
||||
DrawTopPanelButton(FORWARD_BUTTON, PADDING+TSZE+PADDING-2, PADDING, 31, false);
|
||||
DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE + 2 , PADDING, -1, burger_active); //burger menu
|
||||
|
||||
DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE-4, PADDING, -1, burger_active); //burger menu
|
||||
|
||||
//DrawTopPanelButton(SEARCH_BUTTON, Form.cwidth - PADDING - TSZE - 3 - BUTTON_W, PADDING, 49, false); // Search web button
|
||||
//DrawTopPanelButton(GO_BUTTON, Form.cwidth - PADDING - TSZE - 3 - BUTTON_W - SEARCH_GO_GAP - BUTTON_W, PADDING, 12, false); // go to address button
|
||||
DrawTopPanelButton(SEARCH_BUTTON, Form.cwidth - PADDING - TSZE - 3 - BUTTON_W, PADDING, 49, false); // Search web button
|
||||
DrawTopPanelButton(GO_BUTTON, Form.cwidth - PADDING - TSZE - 3 - BUTTON_W - SEARCH_GO_GAP - BUTTON_W, PADDING, 12, false); // go to address button
|
||||
|
||||
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.line);
|
||||
|
||||
@@ -438,16 +445,9 @@ void EventScrollUpAndDown(int _direction)
|
||||
|
||||
void EventToggleDebugMode()
|
||||
{
|
||||
int cy = WB1.list.first;
|
||||
debug_mode ^= 1;
|
||||
WB1.Reparse();
|
||||
WB1.list.first = WB1.list.cur_y = cy;
|
||||
WB1.DrawPage();
|
||||
if (debug_mode) {
|
||||
DrawStatusBar("Debug mode = ON");
|
||||
} else {
|
||||
DrawStatusBar("Debug mode = OFF");
|
||||
}
|
||||
if (debug_mode) notify("'Debug mode ON'-I");
|
||||
else notify("'Debug mode OFF'-I");
|
||||
}
|
||||
|
||||
void EventAllTabsClick(dword _n)
|
||||
@@ -485,10 +485,8 @@ void EventCopyLinkToClipboard()
|
||||
|
||||
void StopLoading()
|
||||
{
|
||||
http.stop();
|
||||
//if (http.stop()) pause(10);
|
||||
if (http.stop()) pause(10);
|
||||
prbar.value = 0;
|
||||
img_loading = false;
|
||||
}
|
||||
|
||||
//rewrite into
|
||||
@@ -568,8 +566,6 @@ void OpenPage(dword _open_URL)
|
||||
anchors.take_anchor_from(#new_url);
|
||||
}
|
||||
|
||||
debug("\nWebView GET => "); debugln(#new_url);
|
||||
|
||||
/*
|
||||
There could be several possible types of addresses:
|
||||
- cached page (only http/https)
|
||||
@@ -770,9 +766,9 @@ void LoadInternalPage(dword _bufdata, _in_bufsize){
|
||||
WB1.DrawPage();
|
||||
}
|
||||
http.hfree();
|
||||
if (WB1.img_url.count) {
|
||||
GetImg();
|
||||
DrawOmnibox();
|
||||
if (WB1.img_url.count) {
|
||||
GetImg(true);
|
||||
DrawOmnibox();
|
||||
} else {
|
||||
PageLoaded();
|
||||
}
|
||||
@@ -796,11 +792,11 @@ bool UrlExtIs(dword base, ext)
|
||||
|
||||
void DrawProgress()
|
||||
{
|
||||
dword pct = 10, fullw = omnibox_edit.width + 23; // full omnibox width incl. icon
|
||||
dword pct;
|
||||
if (!http.transfer) return;
|
||||
if (http_get_type==IMG) pct = prbar.value*70/prbar.max + 30;
|
||||
if (http_get_type==PAGE) && (prbar.max) pct = prbar.value*30/prbar.max;
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top+20, pct*fullw/100, 2, 0x72B7EB);
|
||||
if (http_get_type==PAGE) && (prbar.max) pct = prbar.value*30/prbar.max; else pct = 10;
|
||||
if (http_get_type==IMG) pct = prbar.value * 70 / prbar.max + 30;
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top+20, pct*omnibox_edit.width+16/100, 2, 0x72B7EB);
|
||||
}
|
||||
|
||||
void EventShowPageMenu()
|
||||
@@ -922,18 +918,18 @@ void DrawStatusBar(dword _msg)
|
||||
void DrawOmnibox()
|
||||
{
|
||||
int imgxoff;
|
||||
DrawOvalBorder(omnibox_edit.left-2, omnibox_edit.top-3, omnibox_edit.width+2, 24, sc.line,
|
||||
DrawOvalBorder(omnibox_edit.left-2, omnibox_edit.top-3, omnibox_edit.width+18, 24, sc.line,
|
||||
sc.line, sc.line, sc.dark);
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top-2, omnibox_edit.width+2, 1, 0xD8DCD8);
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top-1, omnibox_edit.width+2, 1, omnibox_edit.bg_color);
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top-2, omnibox_edit.width+18, 1, 0xD8DCD8);
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top-1, omnibox_edit.width+18, 1, omnibox_edit.bg_color);
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top, 1, 22, omnibox_edit.bg_color);
|
||||
|
||||
if (http.transfer) || (img_loading) { imgxoff = 67; } else imgxoff = 66;
|
||||
DrawTopPanelButton(REFRESH_BUTTON, PADDING+TSZE*2+PADDING+2, PADDING, imgxoff, false);
|
||||
|
||||
if (omnibox_edit.flags & ed_focus) omnibox_edit.flags = ed_focus; else omnibox_edit.flags = 0;
|
||||
EditBox_UpdateText(#omnibox_edit, omnibox_edit.flags);
|
||||
edit_box_draw stdcall(#omnibox_edit);
|
||||
if (http.transfer) imgxoff = 16*23*3; else imgxoff = 0;
|
||||
PutImage(omnibox_edit.left+omnibox_edit.width+1, omnibox_edit.top-1, 16, 23, imgxoff + #editbox_icons);
|
||||
DefineHiddenButton(omnibox_edit.left+omnibox_edit.width-1, omnibox_edit.top-2, 17, 23, REFRESH_BUTTON);
|
||||
|
||||
DrawProgress();
|
||||
}
|
||||
@@ -998,64 +994,37 @@ void HandleRedirect()
|
||||
free(redirect_url);
|
||||
}
|
||||
|
||||
void GetImg()
|
||||
dword GetImg(bool _new)
|
||||
{
|
||||
int i;
|
||||
char cur_downloader_path[4096];
|
||||
char local_path[64];
|
||||
dword cur_img_url;
|
||||
if (!show_images) return;
|
||||
http_get_type = IMG;
|
||||
|
||||
if (!show_images) || (!WB1.img_url.count) return;
|
||||
|
||||
img_downloaders_count = math.min(WB1.img_url.count, 256);
|
||||
CreateDir("/tmp0/1/Cache");
|
||||
|
||||
for (i = 0; i < img_downloaders_count; i++) {
|
||||
for (i = 0; i < WB1.img_url.count; i++)
|
||||
{
|
||||
cur_img_url = WB1.img_url.get(i);
|
||||
if (cache2.is_contain(cur_img_url)) continue;
|
||||
sprintf(#local_path, "/tmp0/1/Cache/wv_%i_%i.png", Form.ID, cache2.url.count + 1);
|
||||
sprintf(#cur_downloader_path, "-i %s|%s", cur_img_url, #local_path);
|
||||
cache2.add(cur_img_url, #local_path);
|
||||
img_downloaders[i] = RunProgram("/sys/network/dl", #cur_downloader_path);
|
||||
}
|
||||
|
||||
img_loading = true;
|
||||
prbar.max = img_downloaders_count;
|
||||
prbar.value = 0;
|
||||
}
|
||||
|
||||
void CheckImgDownloads()
|
||||
{
|
||||
int i;
|
||||
int done_count = 0;
|
||||
|
||||
for (i = 0; i < img_downloaders_count; i++) {
|
||||
if (!img_downloaders[i]) || (!GetProcessSlot(img_downloaders[i])) {
|
||||
img_downloaders[i] = 0;
|
||||
done_count++;
|
||||
if (cache.has(cur_img_url)==false) {
|
||||
prbar.max = WB1.img_url.count;
|
||||
prbar.value = i;
|
||||
if (GetUrl(cur_img_url)) {
|
||||
DrawStatusBar(cur_img_url);
|
||||
DrawProgress();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (done_count < img_downloaders_count) {
|
||||
prbar.max = img_downloaders_count;
|
||||
prbar.value = done_count;
|
||||
DrawProgress();
|
||||
sprintf(#param, "Downloading images: %i/%i...", prbar.value, prbar.max);
|
||||
DrawStatusBar(#param);
|
||||
} else {
|
||||
DrawStatusBar(T_RENDERING);
|
||||
WB1.Reparse();
|
||||
WB1.DrawPage();
|
||||
PageLoaded();
|
||||
img_loading = false;
|
||||
DrawOmnibox();
|
||||
}
|
||||
if (_new) return;
|
||||
DrawOmnibox();
|
||||
DrawStatusBar(T_RENDERING);
|
||||
WB1.Reparse();
|
||||
WB1.DrawPage();
|
||||
PageLoaded();
|
||||
}
|
||||
|
||||
void PageLoaded()
|
||||
{
|
||||
DrawStatusBar(sprintf(#param, T_DONE_IN_SEC, GetStartTime()-render_start_time/100,
|
||||
GetStartTime()-render_start_time*10));
|
||||
GetStartTime()-render_start_time*10));
|
||||
}
|
||||
|
||||
stop:
|
||||
@@ -59,70 +59,4 @@ void _cache::clear()
|
||||
type.drop();
|
||||
current_buf = NULL;
|
||||
current_size = NULL;
|
||||
current_type = NULL;
|
||||
current_charset = NULL;
|
||||
}
|
||||
|
||||
|
||||
struct _cache2
|
||||
{
|
||||
collection url;
|
||||
collection path;
|
||||
dword cur;
|
||||
|
||||
void add();
|
||||
bool is_contain();
|
||||
void clear();
|
||||
|
||||
void save();
|
||||
void load();
|
||||
} cache2;
|
||||
|
||||
void _cache2::add(dword _url, _path)
|
||||
{
|
||||
if (!is_contain(_url)) {
|
||||
url.add(_url);
|
||||
path.add(_path);
|
||||
}
|
||||
}
|
||||
|
||||
bool _cache2::is_contain(dword _url)
|
||||
{
|
||||
cur = url.get_pos_by_name(_url);
|
||||
if (cur == -1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void _cache2::clear()
|
||||
{
|
||||
url.drop();
|
||||
path.drop();
|
||||
}
|
||||
|
||||
void _cache2::save()
|
||||
{
|
||||
dword buf, buf_size, i;
|
||||
buf_size = url.data_size + path.data_size + url.count + url.count + 7;
|
||||
buf = malloc(buf_size);
|
||||
strcpy(buf, "[img]\n");
|
||||
for ( i = 0 ; i < path.count ; i++ ) {
|
||||
if (!url.get(i)) continue;
|
||||
strcat(buf, url.get(i));
|
||||
strcat(buf, "=");
|
||||
strcat(buf, path.get(i));
|
||||
strcat(buf, "\n");
|
||||
}
|
||||
strcat(buf, "\0");
|
||||
CreateFile(math.min(buf_size, strlen(buf)), buf, "/tmp0/1/Cache/_list_db.ini");
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void _cache2::load()
|
||||
{
|
||||
ini_enum_keys stdcall ("/tmp0/1/Cache/_list_db.ini", "img", #_cache2_load_sections);
|
||||
}
|
||||
|
||||
byte _cache2_load_sections(dword key_value, key_name, sec_name, f_name)
|
||||
{
|
||||
cache2.add(key_name, key_value);
|
||||
}
|
||||
+3
-1
@@ -108,9 +108,11 @@ enum {
|
||||
TAB_CLOSE_ID = 900
|
||||
};
|
||||
|
||||
char editbox_icons[] = FROM "res/editbox_icons.raw";
|
||||
|
||||
#define WIN_W 850
|
||||
#define WIN_H 920
|
||||
|
||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||
|
||||
char version[]="WebView 4";
|
||||
char version[]="WebView 3.95";
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 199 B |
@@ -1 +1 @@
|
||||
▐▐▌бЯЮВБ~xwtВБ~бЯЮ▐▐▌ ╜╗╗ ¤¤¤млк{xuЙЕГСОМЦУССОМЙЕГ{xuмлл╗╗╣rpm нмй~{ПНКЙЕГ~{x{xu|yЙЕГПНККЖДЙЕГxvs ▐▐▌{xuПНКБ|ввЯччх√√√ччхеввКИДЩХТЩХТyxu вЯЯЙЕГЙЕГввЯ ╛╜╗КЖДЩХТЩХТyxu ГБСОМ~{xччх ╜╗╗rpmxvsyxuyxutqo xwtЦУС{xu··· ДБСОМ~{xшчч бЮЭЙЕГЙЕГдба пон}yx┤│▓ ▌▌▌{xuПНКБ|двбччч√√√чччдвб~{ЙЕГ|yv нкк~{ПНКЙЕГ~{x{xu~{xЙЕГПНК~{нлй √√√нкк{xuЙЕГСОМЦУССОМЙЕГ{xuнкк№№№ ▐▌▌вЯЯВБxwtВБвЯЯ▐▌▌ ▄▄▄ ,╨ ,╨ ,╨ФОъ,╨ ,╨ФОъ,╨ ,╨ФОъJA┘JA┘JA┘ JA┘ФОъJA┘JA┘,╨ ,╨JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ жJA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ж жJA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ж ,╨JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ж ,╨JA┘JA┘JA┘JA┘JA┘JA┘,╨ ,╨JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘ ж ,╨ФОъJA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ,╨ФОъJA┘JA┘JA┘JA┘,╨,╨JA┘JA┘JA┘JA┘JA┘,╨ ,╨JA┘JA┘JA┘JA┘,╨ ,╨JA┘JA┘JA┘,╨ ж ,╨JA┘,╨ ж ,╨JA┘,╨ ж ж ж ,╨ ж ▄▄▄
|
||||
№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№ЇЇЇ╠╠╠мммМММммм╠╠╠ЇЇЇ№№№№№№№№№№№№№№№№№№№№№№№№▄▄▄МММММММММММММММММММММ▄▄▄№№№╠╠╠№№№№№№№№№№№№▄▄▄ММММММ╠╠╠ЇЇЇ№№№ЇЇЇ╠╠╠ММММММ╠╠╠МММ№№№№№№№№№ЇЇЇММММММ▄▄▄№№№№№№№№№№№№№№№ЇЇЇМММММММММ№№№№№№№№№╠╠╠МММ╠╠╠№№№№№№№№№№№№№№№№№№╠╠╠МММММММММ№№№№№№№№№мммМММЇЇЇ№№№№№№№№№№№№№№№╠╠╠ММММММММММММ№№№№№№№№№МММммм№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№мммМММЇЇЇ№№№№№№№№№№№№№№№№№№№№№ЇЇЇММММММ№№№№№№№№№╠╠╠МММ╠╠╠№№№№№№№№№№№№№№№№№№№№№╠╠╠МММ╠╠╠№№№№№№№№№ЇЇЇММММММ▄▄▄№№№№№№№№№№№№№№№▄▄▄ММММММЇЇЇ№№№№№№№№№№№№▄▄▄ММММММ╠╠╠ЇЇЇ№№№ЇЇЇ╠╠╠ММММММ▄▄▄№№№№№№№№№№№№№№№№№№▄▄▄МММММММММММММММММММММ▄▄▄№№№№№№№№№№№№№№№№№№№№№№№№ЇЇЇ╠╠╠мммМММммм╠╠╠ЇЇЇ№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№▄▄▄№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№\L╘№№№№№№№№№№№№\L╘№№№№№№№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘№№№№№№\L╘\L╘\L╘№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘\L╘\L╘\L╘\L╘\L╘\L╘4$д№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘\L╘\L╘\L╘\L╘4$д№№№№№№№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘\L╘\L╘4$д№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘\L╘\L╘4$д№№№№№№№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘\L╘\L╘\L╘\L╘\L╘№№№№№№№№№№№№№№№№№№№№№\L╘\L╘\L╘\L╘4$д4$д\L╘\L╘\L╘4$д№№№№№№№№№№№№№№№№№№№№№\L╘\L╘4$д№№№№№№4$д\L╘4$д№№№№№№№№№№№№№№№№№№№№№№№№№№№4$д№№№№№№№№№№№№4$д№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№▄▄▄
|
||||
@@ -42,7 +42,7 @@ By the way,
|
||||
' |
|
||||
() .-.,="``"=. - o -
|
||||
'=/_ \ |
|
||||
* | '=.<a href=WebView:test> </a> |
|
||||
* | '=._ |
|
||||
\ `=./`, '
|
||||
. '=.__.=' `=' *
|
||||
+ +
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
' |
|
||||
() .-.,="``"=. - o -
|
||||
'=/_ \ |
|
||||
* | '=.<a href=WebView:test> </a> |
|
||||
* | '=._ |
|
||||
\ `=./`, '
|
||||
. '=.__.=' `=' *
|
||||
+ +
|
||||
|
||||
+30
-31
@@ -1,40 +1,39 @@
|
||||
<html>
|
||||
<title>TEST</title>
|
||||
<body bgcolor=#fff>
|
||||
<style>a {display:block;font-size:130%;margin:5px 40px 5px 0;}</style>
|
||||
<body>
|
||||
|
||||
<pre><h3><kosicon n=21>Tables</h3>
|
||||
<pre><h2>HTTP</h2>
|
||||
<a href=//th99.infania.net>Total Hardware 1999</a>
|
||||
<a href=//xcal1.vodafone.co.uk>Vodafone Test Files</a>
|
||||
<a href=//vetusware.com>vetusware.com</a>
|
||||
<a href=//wiby.org>wiby.org</a>
|
||||
<a href=//menuetos.net>menuetos.net</a>
|
||||
<a href=//macintosh.garden/>Macintosh Garden</a>
|
||||
<a href=//pci-ids.ucw.cz>pci.ids</a>
|
||||
<a href=//toastytech.com/guis/index.html>GUI Gallery</a>
|
||||
<a href=//www.weitek.com/textual/support/driver.html>weitek</a>
|
||||
<a href=http://www.retro-computing.com/Home/retro-computing.php>retro-computing</a>
|
||||
<a href=https://www.alanwood.net/unicode/cyrillic.html>cyrillic</a>
|
||||
<a href=//www.abandonwarering.com/?Page=Listing>abandonware</a>
|
||||
<a href=//neonfloppy.sytes.net/articles/win3-usb/>neonfloppy</a>
|
||||
<a href=//www.win31.de/eindex.htm>win31.de</a>
|
||||
|
||||
<pre><h3><kosicon n=22>Demoscene</h3>
|
||||
<a href="https://amp.dascene.net/home.php">Amiga Music Preservation</a>
|
||||
<a href="https://files.scene.org">Scene.org</a>
|
||||
<a href=https://www.pouet.net/>Pouet.net</a>
|
||||
<a href="https://aminet.net/tree?path=mods">Aminet</a>
|
||||
<a href=https://barefeats.com/indarch.html>barefeats</a>
|
||||
<h3>VPN-only</h3>
|
||||
<a href=//dgmag.in>dgmag.in</a>
|
||||
<a href=//fdd5-25.pdp-11.ru>fdd5-25</a>
|
||||
<a href=//old-dos.ru>old-dos.ru</a>
|
||||
<a href=//artcon.ru>artcon.ru</a>
|
||||
<a href=//nubo.ru>nubo.ru</a>
|
||||
<a href=//mirrors.pdp-11.ru>mirrors.pdp-11.ru</a>
|
||||
<a href=//nostalgy.net.ru/>nostalgy.net.ru</a>
|
||||
|
||||
<h3><kosicon n=13>Forms</h3>
|
||||
<a href=//wiby.org>wiby.org</a>
|
||||
|
||||
|
||||
<h3><kosicon n=3>Other</h3>
|
||||
<a href=//menuetos.net>menuetos.net</a>
|
||||
<a href=//osnews.com>osnews.com</a>
|
||||
|
||||
<kosicon n=6><a href=https://cobradile.neocities.org>145 images</a>
|
||||
|
||||
<h3><kosicon n=54>Cyrillic only</h3>
|
||||
<a href=//dgmag.in>dgmag.in</a> <a href=//old-dos.ru>old-dos.ru</a> <a href=//lionovsky.us>lionovsky.us</a> <a href=//mirrors.pdp-11.ru>mirrors.pdp-11.ru</a>
|
||||
<a href=//artcon.ru>artcon.ru</a> <a href=//nubo.ru>nubo.ru</a> <a href=//nostalgy.net.ru/>nostalgy.net.ru</a> <a href=//acmp.ru/index.asp?main=tasks>acmp.ru</a>
|
||||
<a href=//opennet.ru>opennet</a> <a href=//linux.org.ru>LOR</a>
|
||||
<h2>HTTPS :(</h2>
|
||||
<a href=//os-menuet.narod.ru>os-menuet.narod.ru</a>
|
||||
<a href=//mestack.narod.ru/index.html>mestack.narod.ru</a>
|
||||
<a href=//coolthemes.narod.ru/indexold.html>coolthemes.narod.ru</a>
|
||||
<a href=//lionovsky.us>lionovsky.us</a>
|
||||
<a href=//acmp.ru/index.asp?main=tasks>acmp.ru</a>
|
||||
<a href=//xn--80abh7bk0c.xn--p1ai>bashorg</a>
|
||||
<a href=//opennet.ru>opennet</a>
|
||||
<a href=//linux.org.ru>LOR</a>
|
||||
<a href=//www.xlr8yourmac.com/OSX/os_x_network_cards.html>OSX network cards</a>
|
||||
<a href=//samlib.ru/b>samlib.ru/b</a>
|
||||
<a href=//os-menuet.narod.ru>os-menuet.narod.ru</a> <a href=//coolthemes.narod.ru/indexold.html>coolthemes.narod.ru</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href=//vetusware.com>vetusware.com</a>
|
||||
<a href=//electromyne.de>electromyne.de</a>
|
||||
+4
-1
@@ -16,10 +16,13 @@ void SourceBufAdd(dword _mode, src)
|
||||
|
||||
if (font_found_pointer = strstr(src, "</font>")) {
|
||||
opened_font_counter--;
|
||||
src = font_found_pointer+2;
|
||||
}
|
||||
|
||||
if (font_found_pointer = strstr(src_orig, "<font ")) {
|
||||
src = src_orig;
|
||||
if (font_found_pointer = strstr(src, "<font ")) {
|
||||
opened_font_counter++;
|
||||
src = font_found_pointer+2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@
|
||||
|
||||
char dl_shared[] = "DL";
|
||||
|
||||
#define URL_SPEED_TEST "http://kolibrios.org/speedtest/100MB.zip"
|
||||
#define URL_SPEED_TEST "http://speedtest.tele2.net/100MB.zip"
|
||||
|
||||
enum {
|
||||
BTN_EXIT=1,
|
||||
|
||||
+40
-87
@@ -13,7 +13,6 @@
|
||||
#include "const.h"
|
||||
|
||||
bool open_file = false;
|
||||
bool invisible = false;
|
||||
|
||||
dword speed;
|
||||
|
||||
@@ -33,7 +32,6 @@ char proxy_address[256];
|
||||
#include "settings.h"
|
||||
|
||||
char* active_status;
|
||||
int save_path_set = false;
|
||||
|
||||
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,
|
||||
0x10000000, sizeof(uEdit)-2, #uEdit, 0, ed_focus + ed_always_focus, 19, 19};
|
||||
@@ -43,8 +41,6 @@ progress_bar pb = {0, GAPX, 52, WIN_W - GAPX - GAPX, 17, 0, NULL, NULL,
|
||||
|
||||
void main()
|
||||
{
|
||||
dword save_path_separator_pos;
|
||||
dword path_pointer;
|
||||
// dword shared_url; // only used by the disabled -mem branch (long URL via SHM)
|
||||
|
||||
load_dll(libini, #lib_init,1);
|
||||
@@ -59,30 +55,15 @@ void main()
|
||||
sc.get();
|
||||
InitDownload();
|
||||
|
||||
if (param[0]) {
|
||||
path_pointer = #param;
|
||||
//save path specified? Example: https://example.com/file|/sys/media/ac97snd
|
||||
if (save_path_separator_pos = strchr(#param, '|')) {
|
||||
save_path_set = true;
|
||||
strcpy(#filepath, save_path_separator_pos+1);
|
||||
ESBYTE[save_path_separator_pos] = '\0';
|
||||
}
|
||||
// invisible window
|
||||
if (!strncmp(#param, "-i ", 3)) {
|
||||
if (param) {
|
||||
if (streqrp(#param, "-e ")) {
|
||||
autoclose.checked = true;
|
||||
invisible = true;
|
||||
path_pointer += 3;
|
||||
param += 3;
|
||||
}
|
||||
// autoclose
|
||||
if (!strncmp(#param, "-e ", 3)) {
|
||||
autoclose.checked = true;
|
||||
path_pointer += 3;
|
||||
}
|
||||
// autoclose and open file
|
||||
if (!strncmp(#param, "-eo ", 4)) {
|
||||
if (streqrp(#param, "-eo ")) {
|
||||
autoclose.checked = true;
|
||||
open_file = true;
|
||||
path_pointer += 4;
|
||||
param += 4;
|
||||
}
|
||||
|
||||
// Disabled long-URL-via-SHM ("DL") channel. memopen was never
|
||||
@@ -92,12 +73,12 @@ void main()
|
||||
// shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
|
||||
// strcpy(#uEdit, shared_url);
|
||||
// } else {
|
||||
strcpy(#uEdit, #param);
|
||||
// }
|
||||
|
||||
if (streq(#param, "-test")) {
|
||||
strcpy(#uEdit, URL_SPEED_TEST);
|
||||
} else {
|
||||
strcpy(#uEdit, path_pointer);
|
||||
}
|
||||
// }
|
||||
}
|
||||
if (uEdit[0]) StartDownloading(); else {
|
||||
edit_box_set_text stdcall (#ed, "http://");
|
||||
@@ -160,8 +141,6 @@ void DrawDlButton(int x, id, t)
|
||||
|
||||
void DefineWindow()
|
||||
{
|
||||
if (invisible) return;
|
||||
|
||||
sc.get();
|
||||
pb.frame_color = ed.border_color = ed.focus_border_color = sc.line;
|
||||
DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9,
|
||||
@@ -172,9 +151,6 @@ void DefineWindow()
|
||||
void DrawWindow()
|
||||
{
|
||||
#define BUT_Y 58;
|
||||
|
||||
if (invisible) return;
|
||||
|
||||
if (!http.transfer) && (!filepath) {
|
||||
DrawBar(GAPX, 102, WIN_W - GAPX - GAPX+1, 24+1, sc.work);
|
||||
DeleteButton(BTN_DIR);
|
||||
@@ -196,11 +172,7 @@ void DrawWindow()
|
||||
DrawBar(GAPX, WIN_H - 58, WIN_W - GAPX - GAPX, 1, sc.light);
|
||||
DrawBar(GAPX, WIN_H - 58 + 1, WIN_W - GAPX - GAPX, 1, sc.dark);
|
||||
WriteTextWithBg(GAPX, WIN_H - 48, 0xD0, sc.work_text, T_SAVE_TO, sc.work);
|
||||
if (save_path_set) {
|
||||
WriteTextWithBg(GAPX + 108, WIN_H - 48, 0xD0, sc.work_text, #filepath, sc.light);
|
||||
} else {
|
||||
WriteTextWithBg(GAPX + 108, WIN_H - 48, 0xD0, sc.work_text, #save_dir, sc.light);
|
||||
}
|
||||
WriteTextWithBg(GAPX + 108, WIN_H - 48, 0xD0, sc.work_text, #save_dir, sc.light);
|
||||
edit_box_draw stdcall (#ed);
|
||||
progressbar_draw stdcall(#pb);
|
||||
autoclose.draw(GAPX, WIN_H - 24);
|
||||
@@ -234,7 +206,6 @@ void StartDownloading()
|
||||
DrawWindow();
|
||||
} else {
|
||||
pb.progress_color = PB_COL_ERROR;
|
||||
if (invisible) ExitProcess();
|
||||
notify(T_ERROR_STARTING_DOWNLOAD);
|
||||
StopDownloading();
|
||||
EditBox_UpdateText(#ed, ed_focus + ed_always_focus);
|
||||
@@ -320,9 +291,7 @@ void MonitorProgress()
|
||||
void CompleteDownload()
|
||||
{
|
||||
SaveFile(0);
|
||||
if (autoclose.checked) {
|
||||
ExitProcess();
|
||||
}
|
||||
if (autoclose.checked) ExitProcess();
|
||||
pb.value = pb.max;
|
||||
pb.progress_color = PB_COL_COMPLETE;
|
||||
StopDownloading();
|
||||
@@ -335,59 +304,43 @@ void SaveFile(int attempt)
|
||||
int i;
|
||||
char notify_message[4296];
|
||||
char file_name[URL_SIZE+96];
|
||||
bool quote = false;
|
||||
dword filename_pos;
|
||||
|
||||
//if save_path is not set then we have to combine it
|
||||
if (!save_path_set) {
|
||||
strcpy(#filepath, #save_dir);
|
||||
chrcat(#filepath, '/'); ///need to check the last symbol
|
||||
|
||||
if (attempt > 9) {
|
||||
notify("'Too many saving attempts' -E");
|
||||
return;
|
||||
}
|
||||
strcpy(#filepath, #save_dir);
|
||||
chrcat(#filepath, '/'); ///need to check the last symbol
|
||||
|
||||
if (attempt > 0) {
|
||||
chrcat(#filepath, attempt+'0');
|
||||
chrcat(#filepath, '_');
|
||||
}
|
||||
|
||||
//Content-Disposition: attachment; filename="RealFootball_2018_Nokia_5800_EN_IGP_EU_TS_101.zip"
|
||||
if (http.header_field("content-disposition", #file_name, sizeof(file_name))) {
|
||||
filename_pos = strstr(#file_name,"filename=");
|
||||
if (filename_pos) {
|
||||
if (ESBYTE[filename_pos] == '\"') {
|
||||
quote = true;
|
||||
filename_pos++;
|
||||
}
|
||||
strcat(#filepath, filename_pos+9);
|
||||
ESBYTE[strchr(#filepath,'\"')] = '\0';
|
||||
ESBYTE[strchr(#filepath,' ')] = '\0';
|
||||
ESBYTE[strchr(#filepath,';')] = '\0';
|
||||
}
|
||||
}
|
||||
if (!filename_pos) {
|
||||
// Clean all slashes at the end
|
||||
strcpy(#file_name, #uEdit);
|
||||
while (file_name[strlen(#file_name)-1] == '/') {
|
||||
file_name[strlen(#file_name)-1] = 0;
|
||||
}
|
||||
strcat(#filepath, #file_name+strrchr(#file_name, '/'));
|
||||
}
|
||||
|
||||
for (i=0; i<strlen(#filepath); i++) if(filepath[i]==':')||(filepath[i]=='?')filepath[i]='-';
|
||||
if (attempt > 9) {
|
||||
notify("'Too many saving attempts' -E");
|
||||
return;
|
||||
}
|
||||
|
||||
// When an explicit save path is given, overwrite it instead of
|
||||
// auto-renaming - otherwise the fixed path always exists and recurses forever.
|
||||
if (!save_path_set) {
|
||||
while (file_exists(#filepath)) {
|
||||
SaveFile(attempt+1);
|
||||
return;
|
||||
}
|
||||
if (attempt > 0) {
|
||||
chrcat(#filepath, attempt+'0');
|
||||
chrcat(#filepath, '_');
|
||||
}
|
||||
|
||||
//Content-Disposition: attachment; filename="RealFootball_2018_Nokia_5800_EN_IGP_EU_TS_101.zip"
|
||||
if (http.header_field("content-disposition", #file_name, sizeof(file_name))) {
|
||||
if (EDX = strstr(#file_name,"filename=\"")) {
|
||||
strcat(#filepath, EDX+10);
|
||||
ESBYTE[strchr(#filepath,'\"')] = '\0';
|
||||
}
|
||||
} else {
|
||||
// Clean all slashes at the end
|
||||
strcpy(#file_name, #uEdit);
|
||||
while (file_name[strlen(#file_name)-1] == '/') {
|
||||
file_name[strlen(#file_name)-1] = 0;
|
||||
}
|
||||
strcat(#filepath, #file_name+strrchr(#file_name, '/'));
|
||||
}
|
||||
|
||||
for (i=0; i<strlen(#filepath); i++) if(filepath[i]==':')||(filepath[i]=='?')filepath[i]='-';
|
||||
|
||||
while (file_exists(#filepath)) {
|
||||
SaveFile(attempt+1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CreateFile(http.content_received, http.content_pointer, #filepath)==0) {
|
||||
miniprintf(#notify_message, T_FILE_SAVED_AS, #filepath);
|
||||
} else {
|
||||
|
||||
@@ -260,7 +260,7 @@ inline fastcall void GetCurDir( ECX, EDX)
|
||||
previous but here virtual folders like
|
||||
'/' and '/tmp' are not recognised as FOLDERS
|
||||
by GetFileInfo() => BDVK.isfolder attribute :( */
|
||||
:bool real_dir_exists(dword fpath)
|
||||
bool real_dir_exists(dword fpath)
|
||||
{
|
||||
BDVK fpath_atr;
|
||||
if (GetFileInfo(fpath, #fpath_atr) != 0) return false;
|
||||
|
||||
+6
-5
@@ -223,13 +223,14 @@ void _http::receive()
|
||||
|
||||
switch(ESBYTE[new_URL]) {
|
||||
case '.':
|
||||
if (ESBYTE[new_URL+1] == '/') {
|
||||
new_URL+=2;
|
||||
new_URL++;
|
||||
if (ESBYTE[new_URL] == '/') {
|
||||
new_URL++;
|
||||
}
|
||||
else if (ESBYTE[new_URL+1] == '.') && (ESBYTE[new_URL+2] == '/') {
|
||||
else if (ESBYTE[new_URL] == '.') && (ESBYTE[new_URL+1] == '/') {
|
||||
_GO_UP:
|
||||
new_URL+=3;
|
||||
newurl[strrchr(#newurl, '/')-1] = '\0';
|
||||
new_URL+=2;
|
||||
newurl[strrchr(#newurl, '/')-1] = '\0';
|
||||
}
|
||||
goto _DEFAULT;
|
||||
case '?':
|
||||
|
||||
+10
-14
@@ -905,20 +905,16 @@ inline signed csshexdec(dword text)
|
||||
:dword miniprintf(dword dst, format, insert_line)
|
||||
{
|
||||
dword in_pos = strchr(format, '%');
|
||||
if (!in_pos) || (!insert_line) {
|
||||
strcpy(dst, format);
|
||||
} else {
|
||||
EBX = ESBYTE[EAX+1];
|
||||
if (EBX == 's') {
|
||||
strncpy(dst, format, in_pos - format);
|
||||
strcat(dst, insert_line);
|
||||
strcat(dst, in_pos+2);
|
||||
}
|
||||
if (EBX == 'd') || (EBX == 'i') {
|
||||
strncpy(dst, format, in_pos - format);
|
||||
strcat(dst, itoa(insert_line));
|
||||
strcat(dst, in_pos+2);
|
||||
}
|
||||
EBX = ESBYTE[EAX+1];
|
||||
if (EBX == 's') {
|
||||
strncpy(dst, format, in_pos - format);
|
||||
strcat(dst, insert_line);
|
||||
strcat(dst, in_pos+2);
|
||||
}
|
||||
if (EBX == 'd') || (EBX == 'i') {
|
||||
strncpy(dst, format, in_pos - format);
|
||||
strcat(dst, itoa(insert_line));
|
||||
strcat(dst, in_pos+2);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
if tup.getconfig("NO_CMM") ~= "" then return end
|
||||
if tup.getconfig("LANG") == "ru_RU"
|
||||
then C_LANG = "LANG_RUS"
|
||||
elseif tup.getconfig("LANG") == "es_ES"
|
||||
then C_LANG = "LANG_SPA"
|
||||
else C_LANG = "LANG_ENG" -- this includes default case without config
|
||||
end
|
||||
tup.foreach_rule("*.c", "c-- /D=AUTOBUILD /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "%B.com")
|
||||
-335
@@ -1,335 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// unimg - FAT12 (floppy) image unpacker
|
||||
// Copyright (C) 2020-2026 KolibriOS Team
|
||||
//
|
||||
// Contributor Magomed Kostoev (Boppan, mkostoevr) - initial version in C
|
||||
// Contributor Kyryl Lipatov (Leency) - rewrite to C--, support any image type
|
||||
// Contributor Burer - Russian and Spanish translations, small fixes
|
||||
//
|
||||
// Usage:
|
||||
// unimg /path/to/img ["/output/dir"]
|
||||
// If output folder is not specified, image will be unpacked at /tmp0/1/[img_name.img_ext]
|
||||
|
||||
|
||||
#define MEMSIZE 1024*30
|
||||
#define ENTRY_POINT #main
|
||||
|
||||
#include "../lib/fs.h"
|
||||
|
||||
// NB: this file is stored in CP866 (for the Russian strings below).
|
||||
// Edit it with a CP866-aware editor, not UTF-8.
|
||||
#ifdef LANG_RUS
|
||||
?define MSG_USAGE "'unimg\nРаспаковщик образов FAT12.\nИспользование: unimg /путь/к/образу [\"/папка/вывода\"]' -tI"
|
||||
?define MSG_READ "'unimg\nОшибка чтения файла\n%s' -tE"
|
||||
?define MSG_FORMAT "'unimg\nОбраз не FAT12.\n%s' -tE"
|
||||
?define MSG_MKDIR "'unimg\nОшибка создания папки\n%s' -tE"
|
||||
?define MSG_DONE "'unimg\nРаспаковано в:\n%s' -tO"
|
||||
?define MSG_NOMEM "'unimg\nНедостаточно памяти' -tE"
|
||||
?define MSG_OOB "'unimg\nКластера FAT вне границ' -tE"
|
||||
?define INFO_NAME "\nВнутреннее имя "
|
||||
?define INFO_BPS "\nБайт в секторе "
|
||||
?define INFO_SPC "\nСекторов в кластере "
|
||||
?define INFO_RSC "\nРезервных секторов "
|
||||
?define INFO_NFAT "\nКоличество FAT "
|
||||
?define INFO_MRE "\nЗаписей в корне "
|
||||
?define INFO_BPC "\nБайт в кластере "
|
||||
?define INFO_SPF "\nСекторов в FAT "
|
||||
?define INFO_FATOFF "\nПервая FAT "
|
||||
?define INFO_ROOTOFF "\nКорневой каталог "
|
||||
?define INFO_DATAOFF "\nОбласть данных "
|
||||
#else
|
||||
#ifdef LANG_SPA
|
||||
?define MSG_USAGE "'unimg\nDescompresor de imagenes FAT12.\nUso: unimg /ruta/a/imagen [\"/carpeta/salida\"]' -tI"
|
||||
?define MSG_READ "'unimg\nError al leer el archivo\n%s' -tE"
|
||||
?define MSG_FORMAT "'unimg\nNo es una imagen FAT12.\n%s' -tE"
|
||||
?define MSG_MKDIR "'unimg\nNo se pudo crear la carpeta\n%s' -tE"
|
||||
?define MSG_DONE "'unimg\nDescomprimido en\n%s' -tO"
|
||||
?define MSG_NOMEM "'unimg\nSin memoria' -tE"
|
||||
?define MSG_OOB "'unimg\nCluster FAT fuera de limites' -tE"
|
||||
?define INFO_NAME "\nNombre interno "
|
||||
?define INFO_BPS "\nBytes en sector "
|
||||
?define INFO_SPC "\nSectores en cluster "
|
||||
?define INFO_RSC "\nSectores reservados "
|
||||
?define INFO_NFAT "\nNumero de FATs "
|
||||
?define INFO_MRE "\nEntradas raiz max "
|
||||
?define INFO_BPC "\nBytes en cluster "
|
||||
?define INFO_SPF "\nSectores en FAT "
|
||||
?define INFO_FATOFF "\nPrimera FAT "
|
||||
?define INFO_ROOTOFF "\nDirectorio raiz "
|
||||
?define INFO_DATAOFF "\nRegion de datos "
|
||||
#else
|
||||
?define MSG_USAGE "'unimg\nFAT12 image unpacker.\nUsage: unimg /path/to/img [\"/output/dir\"]' -tI"
|
||||
?define MSG_READ "'unimg\nFile read error\n%s' -tE"
|
||||
?define MSG_FORMAT "'unimg\nNot a FAT12 image.\n%s' -tE"
|
||||
?define MSG_MKDIR "'unimg\nCannot create output folder\n%s' -tE"
|
||||
?define MSG_DONE "'unimg\nUnpacked to\n%s' -tO"
|
||||
?define MSG_NOMEM "'unimg\nOut of memory' -tE"
|
||||
?define MSG_OOB "'unimg\nFAT cluster out of bounds' -tE"
|
||||
?define INFO_NAME "\nInternal name "
|
||||
?define INFO_BPS "\nBytes per sector "
|
||||
?define INFO_SPC "\nSectors per cluster "
|
||||
?define INFO_RSC "\nReserved sectors "
|
||||
?define INFO_NFAT "\nNumber of FATs "
|
||||
?define INFO_MRE "\nMax root entries "
|
||||
?define INFO_BPC "\nBytes per cluster "
|
||||
?define INFO_SPF "\nSectors per FAT "
|
||||
?define INFO_FATOFF "\nFirst FAT "
|
||||
?define INFO_ROOTOFF "\nRoot directory "
|
||||
?define INFO_DATAOFF "\nData region "
|
||||
#endif
|
||||
#endif
|
||||
|
||||
dword img_ptr;
|
||||
dword img_sz;
|
||||
|
||||
int bps;
|
||||
int spc;
|
||||
int rsc;
|
||||
int nfat;
|
||||
int mre;
|
||||
int spf;
|
||||
int bpc;
|
||||
int fat_off;
|
||||
int root_off;
|
||||
int data_off;
|
||||
|
||||
char cur_path[4096];
|
||||
int cur_path_len;
|
||||
|
||||
inline int fat_u8(int offset) { return DSBYTE[img_ptr + offset] & 0xFF; }
|
||||
inline int fat_u16(int offset) { return DSWORD[img_ptr + offset] & 0xFFFF; }
|
||||
inline dword fat_u32(int offset) { return ESDWORD[img_ptr + offset]; }
|
||||
|
||||
void fat12__open()
|
||||
{
|
||||
bps = fat_u16(11);
|
||||
spc = fat_u8(13);
|
||||
rsc = fat_u16(14);
|
||||
nfat = fat_u8(16);
|
||||
mre = fat_u16(17);
|
||||
spf = fat_u16(22);
|
||||
bpc = bps * spc;
|
||||
fat_off = rsc * bps;
|
||||
root_off = nfat * spf * bps + fat_off;
|
||||
data_off = mre * 32 + root_off;
|
||||
}
|
||||
|
||||
dword GetImageInfo(dword buf)
|
||||
{
|
||||
strcpy(buf, INFO_NAME); strncpy(buf+21, img_ptr+3, 8);
|
||||
strcat(buf, INFO_BPS); strcat(buf, itoa(bps));
|
||||
strcat(buf, INFO_SPC); strcat(buf, itoa(spc));
|
||||
strcat(buf, INFO_RSC); strcat(buf, itoa(rsc));
|
||||
strcat(buf, INFO_NFAT); strcat(buf, itoa(nfat));
|
||||
strcat(buf, INFO_MRE); strcat(buf, itoa(mre));
|
||||
strcat(buf, INFO_BPC); strcat(buf, itoa(bpc));
|
||||
strcat(buf, INFO_SPF); strcat(buf, itoa(spf));
|
||||
strcat(buf, INFO_FATOFF); strcat(buf, itoa(fat_off));
|
||||
strcat(buf, INFO_ROOTOFF); strcat(buf, itoa(root_off));
|
||||
strcat(buf, INFO_DATAOFF); strcat(buf, itoa(data_off));
|
||||
}
|
||||
|
||||
int cluster_to_offset(int c)
|
||||
{
|
||||
return c - 2 * bpc + data_off;
|
||||
}
|
||||
|
||||
int next_cluster(int c)
|
||||
{
|
||||
int v;
|
||||
v = fat_u16(c / 2 + fat_off + c);
|
||||
if (c & 1) return v >> 4;
|
||||
return v & 0xFFF;
|
||||
}
|
||||
|
||||
void extract_file(dword buf, int size, int cluster)
|
||||
{
|
||||
int written, n, src;
|
||||
written = 0;
|
||||
while (cluster >= 2) && (cluster < 0xFF7) {
|
||||
src = cluster_to_offset(cluster);
|
||||
n = bpc;
|
||||
// clamp to remaining size
|
||||
if (written + n > size) n = size - written;
|
||||
if (n <= 0) break;
|
||||
// Stop on a corrupt FAT chain pointing outside the image
|
||||
if (src < 0) || (src + n > img_sz) break;
|
||||
memmov(buf + written, img_ptr + src, n);
|
||||
written += n;
|
||||
cluster = next_cluster(cluster);
|
||||
}
|
||||
}
|
||||
|
||||
void make_parent_dirs(dword initial_dir)
|
||||
{
|
||||
char path[4096];
|
||||
int i;
|
||||
strncpy(#path, initial_dir, strlen(initial_dir) + 1);
|
||||
//debugln(#path);
|
||||
for (i = 1; path[i]; i++) {
|
||||
if (path[i] == '/') {
|
||||
path[i] = '\0';
|
||||
CreateDir(#path);
|
||||
path[i] = '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int entry_short_name(int off, dword out)
|
||||
{
|
||||
int attr, i, n, b;
|
||||
b = fat_u8(off);
|
||||
if (!b) return -1;
|
||||
if (b == 0xE5) return 0;
|
||||
attr = fat_u8(off + 11);
|
||||
if (attr & 0x0F == 0x0F) return 0;
|
||||
if (attr & 0x08) return 0;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
b = fat_u8(off + i);
|
||||
if (b == ' ') break;
|
||||
ESBYTE[out + n] = b;
|
||||
n++;
|
||||
}
|
||||
b = fat_u8(off + 8);
|
||||
if (b != ' ') {
|
||||
ESBYTE[out + n] = '.';
|
||||
n++;
|
||||
for (i = 8; i < 11; i++) {
|
||||
b = fat_u8(off + i);
|
||||
if (b == ' ') break;
|
||||
ESBYTE[out + n] = b;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
ESBYTE[out + n] = '\0';
|
||||
return n;
|
||||
}
|
||||
|
||||
int handle_entry(int off)
|
||||
{
|
||||
char name[13];
|
||||
int nlen, attr, cluster, size, saved_len;
|
||||
dword buf;
|
||||
|
||||
if (off < 0) || (off + 32 > img_sz) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
nlen = entry_short_name(off, #name);
|
||||
|
||||
if (nlen < 0) return -1;
|
||||
if (nlen == 0) return 0;
|
||||
if (name[0] == '.') return 0;
|
||||
|
||||
attr = fat_u8(off + 11);
|
||||
cluster = fat_u16(off + 26);
|
||||
|
||||
saved_len = cur_path_len;
|
||||
cur_path[cur_path_len] = '/';
|
||||
memmov(#cur_path + cur_path_len + 1, #name, nlen + 1);
|
||||
cur_path_len = cur_path_len + 1 + nlen;
|
||||
|
||||
if (attr & 0x10) {
|
||||
CreateDir(#cur_path);
|
||||
handle_folder(cluster);
|
||||
} else {
|
||||
size = fat_u32(off + 28);
|
||||
if (size > 0) {
|
||||
buf = malloc(size);
|
||||
if (!buf) {
|
||||
notify(MSG_NOMEM);
|
||||
} else {
|
||||
extract_file(buf, size, cluster);
|
||||
CreateFile(size, buf, #cur_path);
|
||||
free(buf);
|
||||
}
|
||||
} else {
|
||||
CreateFile(0, img_ptr, #cur_path);
|
||||
}
|
||||
}
|
||||
|
||||
cur_path_len = saved_len;
|
||||
cur_path[cur_path_len] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_folder(int cluster)
|
||||
{
|
||||
int off, entries, i;
|
||||
while (cluster >= 2) && (cluster < 0xFF7) {
|
||||
off = cluster_to_offset(cluster);
|
||||
|
||||
// Check that offset don't go negative
|
||||
// and we don't read over img size (img_sz)
|
||||
if (off < 0) || (off + bpc > img_sz) {
|
||||
notify(MSG_OOB);
|
||||
return;
|
||||
}
|
||||
|
||||
entries = bpc / 32;
|
||||
for (i = 0; i < entries; i++) {
|
||||
if (handle_entry(i * 32 + off) < 0) return;
|
||||
}
|
||||
cluster = next_cluster(cluster);
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyAndExit(dword message, opt)
|
||||
{
|
||||
miniprintf(#param, message, opt);
|
||||
notify(#param);
|
||||
ExitProcess();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
char img_file[4096];
|
||||
char img_info[512];
|
||||
int i;
|
||||
|
||||
mem_init();
|
||||
|
||||
if (!param[0]) {
|
||||
NotifyAndExit(MSG_USAGE, NULL);
|
||||
}
|
||||
|
||||
if (i = strchr(#param, '"')) {
|
||||
ESBYTE[i-1] = '\0';
|
||||
strcpy(#cur_path, i+1);
|
||||
i = strchr(#cur_path, '"');
|
||||
if (i) ESBYTE[i] = '\0';
|
||||
}
|
||||
|
||||
strcpy(#img_file, #param);
|
||||
|
||||
if (!cur_path[0]) {
|
||||
memmov(#cur_path, "/tmp0/1", 8);
|
||||
strcat(#cur_path, #img_file + strrchr(#img_file, '/') - 1);
|
||||
}
|
||||
cur_path_len = strlen(#cur_path);
|
||||
|
||||
read_file(#img_file, #img_ptr, #img_sz);
|
||||
if (!img_ptr) || (!img_sz) {
|
||||
NotifyAndExit(MSG_READ, #img_file);
|
||||
}
|
||||
|
||||
fat12__open();
|
||||
if (root_off > img_sz) || (data_off > img_sz) {
|
||||
GetImageInfo(#img_info);
|
||||
NotifyAndExit(MSG_FORMAT, #img_info);
|
||||
}
|
||||
|
||||
make_parent_dirs(#cur_path);
|
||||
if (CreateDir(#cur_path)) {
|
||||
NotifyAndExit(MSG_MKDIR, #cur_path);
|
||||
}
|
||||
|
||||
for (i = 0; i < mre; i++) {
|
||||
if (handle_entry(i * 32 + root_off) < 0) break;
|
||||
}
|
||||
|
||||
NotifyAndExit(MSG_DONE, #cur_path);
|
||||
}
|
||||
+10
-11
@@ -1,4 +1,4 @@
|
||||
// Mouse Configuration Utility ver 1.71
|
||||
// Mouse Configuration Utility ver 1.7
|
||||
|
||||
#define MEMSIZE 4096*11
|
||||
|
||||
@@ -64,13 +64,11 @@ void main() {
|
||||
{
|
||||
case evMouse:
|
||||
mouse.get();
|
||||
IF (mouse_frame.hovered()) {
|
||||
DrawMouseImage(mouse.key&MOUSE_LEFT,mouse.key&MOUSE_RIGHT,mouse.key&MOUSE_MIDDLE,mouse.vert);
|
||||
}
|
||||
if (mouse.up) DrawMouseImage(0,0,0,0);
|
||||
IF (mouse_frame.hovered()) DrawMouseImage(mouse.lkm,mouse.pkm,mouse.mkm,mouse.vert);
|
||||
IF (mouse.click) || (mouse.up) DrawMouseImage(0,0,0,0);
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
CASE evButton:
|
||||
id = @GetButtonID();
|
||||
IF (1 == id) ExitApp();
|
||||
else IF (pointer_speed.click(id)) ApplyCfg();
|
||||
@@ -121,20 +119,21 @@ void main() {
|
||||
#define white 0xffffff
|
||||
#define dgrey 0x2d353d
|
||||
|
||||
struct IMG_PAL{ dword back, shad1, contour, left, right, middle, mwhite; }
|
||||
:struct IMG_PAL{ dword back, shad1, contour, left, right, middle, mwhite; }
|
||||
pal = { 0xF0F2F3,0xABB0B2, dgrey, white, white, dgrey, white };
|
||||
|
||||
void DrawMouseImage(dword l,r,m,v) {
|
||||
#define IMG_W 59
|
||||
#define IMG_H 100
|
||||
|
||||
IF (l) pal.left = red; else pal.left = white;
|
||||
IF (r) pal.right = red; else pal.right = white;
|
||||
IF (l) pal.left = red;
|
||||
IF (m) pal.middle = red;
|
||||
ELSE IF (v) pal.middle = yellow;
|
||||
ELSE pal.middle = dgrey;
|
||||
IF (r) pal.right = red;
|
||||
IF (v) pal.middle = yellow;
|
||||
|
||||
PutPaletteImage(#panels_img_data,IMG_W,IMG_H,18+30,18+16,8,#pal);
|
||||
pal.left = pal.right = white;
|
||||
pal.middle = dgrey;
|
||||
IF (v) {
|
||||
pause(10);
|
||||
DrawMouseImage(l,r,m,0);
|
||||
|
||||
+2
-13
@@ -29,7 +29,7 @@
|
||||
char default_dir[] = "/sys";
|
||||
od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" };
|
||||
|
||||
#define ABOUT_MESSAGE " v2.95 Final
|
||||
#define ABOUT_MESSAGE " v2.94 Final
|
||||
|
||||
A tiny music folder player.
|
||||
Supports MP3, WAV, XM audio file formats.
|
||||
@@ -415,7 +415,6 @@ void EventStopPlaying()
|
||||
void EventStartPlaying()
|
||||
{
|
||||
word i;
|
||||
dword dl_run_id;
|
||||
char item_path[4096];
|
||||
char notify_message[512];
|
||||
EventStopPlaying();
|
||||
@@ -434,17 +433,7 @@ void EventStartPlaying()
|
||||
DrawPlayList();
|
||||
DrawTopPanel();
|
||||
//start_playing_time =
|
||||
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||
if (player_run_id < 0) {
|
||||
dl_run_id = RunProgram("/sys/network/dl", "-e http://builds.kolibrios.org/en_US/data/programs/media/ac97snd/ac97snd.bin|/sys/media/ac97snd");
|
||||
// wait for the downloader to finish (it autocloses on completion), up to ~30s
|
||||
for (i=0; i<50; i++) {
|
||||
pause(10);
|
||||
if (!GetProcessSlot(dl_run_id)) break;
|
||||
}
|
||||
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||
if (player_run_id < 0) notify("'AC97SND backend not found and its download failed :('-E");
|
||||
}
|
||||
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||
//player_run_id = RunProgram("/kolibrios/media/minimp3", #item_path);
|
||||
sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename);
|
||||
if (!repeat) && (window_mode==WINDOW_MODE_SMALL)
|
||||
|
||||
+3
-2
@@ -128,7 +128,8 @@ void main()
|
||||
break;
|
||||
case SCAN_CODE_TAB:
|
||||
show_system.checked ^= 1;
|
||||
goto _DRAW_WINDOW;
|
||||
SelectList_LineChanged();
|
||||
break;
|
||||
default:
|
||||
if (select_list.ProcessKey(key_scancode)) {
|
||||
SelectList_LineChanged();
|
||||
@@ -156,7 +157,6 @@ void main()
|
||||
case evReDraw:
|
||||
sc.get();
|
||||
DefineAndDrawWindow(Form.left, Form.top, Form.width, Form.height, 0x33, sc.work, T_APP_TITLE, 0);
|
||||
WriteText(GAP+5, WIN_CONTENT_Y-20, 0x90, sc.work_text, T_PROC_HEADER);
|
||||
_DRAW_WINDOW:
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window&ROLLED_UP) break;
|
||||
@@ -168,6 +168,7 @@ void main()
|
||||
}
|
||||
right_w = Form.cwidth - RIGHT_X - GAP;
|
||||
right_w &= ~1; // make sure the number is even
|
||||
WriteText(GAP+5, WIN_CONTENT_Y-20, 0x90, sc.work_text, T_PROC_HEADER);
|
||||
|
||||
DefineButton(RIGHT_X-38,WIN_CONTENT_Y-25,18,18,BTN_SHOWHIDE_SENSORS,sc.button);
|
||||
DrawRectangle3D(RIGHT_X-38,WIN_CONTENT_Y-25,19,18,sc.line,sc.light);
|
||||
|
||||
Reference in new issue
Block a user